Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 7 additions & 14 deletions .github/workflows/IntegrationTest.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python application
name: Test

on:
push:
Expand All @@ -12,28 +12,21 @@ on:


jobs:
build:

test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install pytest
if [ -f requirements/runtime.txt ]; then pip install -r requirements/runtime.txt; fi
pip install -e .
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

- name: Integration Test(local plaintext)
run: |
python -m dingo.run.cli --input_path test/data/test_local_plaintext.txt --dataset local -e default --data_format plaintext
Expand Down Expand Up @@ -62,6 +55,6 @@ jobs:
- name: Integration Test(custom config)
run: |
python -m dingo.run.cli --input_path test/data/test_local_json.json --dataset local -e test --data_format json --column_content prediction --custom_config test/config/config_rule.json --log_level=DEBUG
- name: Run unit tests with pytest
- name: Run unit tests
run: |
pytest test/scripts --ignore=test/scripts/data
16 changes: 5 additions & 11 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: lint
name: Lint

on: [push, pull_request]

Expand All @@ -9,19 +9,13 @@ concurrency:
jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.10.15]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install pre-commit hook
python-version: "3.10"
- name: Run pre-commit
run: |
pip install pre-commit==3.8.0
pre-commit install
- name: Linting
run: |
pre-commit run --all-files
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ repos:
hooks:
- id: isort
- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
rev: 6.1.0
hooks:
- id: flake8
args: [ "--max-line-length=2200", "--ignore=E121,E131,E125,W503,W504,W604,E203,E231,E702,E128,F541" ]
exclude: 'app/|examples/|test/|dingo/run/vsl.py'
args: [ "--max-line-length=2200", "--ignore=E121,E131,E125,W503,W504,W604,E203,E231,E702,E128,F541,F401" ]
exclude: 'app/'
20 changes: 9 additions & 11 deletions examples/classify/sdk_3h_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,21 @@ def classify_3H():
"data_format": "jsonl",
"column_prompt": "input",
"column_content": "response",
"custom_config":
{
"prompt_list": ["PromptTextHarmless"], # options:['PromptIsHelpful', 'PromptIsHonest']
"llm_config":
{
"LLMText3HHarmless":
{
"key": "",
"api_url": ""
}
}
"custom_config": {
"prompt_list": ["PromptTextHarmless"], # options:['PromptIsHelpful', 'PromptIsHonest']
"llm_config": {
"LLMText3HHarmless": {
"key": "",
"api_url": ""
}
}
}
}
input_args = InputArgs(**input_data)
executor = Executor.exec_map["local"](input_args)
result = executor.execute()
print(result)


if __name__ == '__main__':
classify_3H()
13 changes: 6 additions & 7 deletions examples/classify/sdk_QR_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,19 @@ def classify_QR():
"column_content": "content",
"custom_config": {
"prompt_list": ["PromptClassifyQR"],
"llm_config":
{
"LLMClassifyQR":
{
"key": "",
"api_url": "",
}
"llm_config": {
"LLMClassifyQR": {
"key": "",
"api_url": "",
}
}
}
}
input_args = InputArgs(**input_data)
executor = Executor.exec_map["local"](input_args)
result = executor.execute()
print(result)


if __name__ == '__main__':
classify_QR()
13 changes: 6 additions & 7 deletions examples/classify/sdk_topic_classifcation.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,19 @@ def classify_topic():
"column_content": "question",
"custom_config": {
"prompt_list": ["PromptClassifyTopic"],
"llm_config":
{
"LLMClassifyTopic":
{
"key": "",
"api_url": "",
}
"llm_config": {
"LLMClassifyTopic": {
"key": "",
"api_url": "",
}
}
}
}
input_args = InputArgs(**input_data)
executor = Executor.exec_map["local"](input_args)
result = executor.execute()
print(result)


if __name__ == '__main__':
classify_topic()
12 changes: 5 additions & 7 deletions examples/compare/compare_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@
"custom_config":
{
"prompt_list": ["PromptHtmlAbstract"],
"llm_config":
{
"LLMHtmlAbstract":
{
"key": "",
"api_url": ""
}
"llm_config": {
"LLMHtmlAbstract": {
"key": "",
"api_url": ""
}
}
},
"log_level": "INFO"
}
Expand Down
2 changes: 2 additions & 0 deletions examples/continue/continue.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def exec_first():
result = executor.execute()
print(result)


def exec_second():
input_data = {
"eval_group": "sft",
Expand All @@ -38,6 +39,7 @@ def exec_second():
result = executor.execute()
print(result)


if __name__ == '__main__':
exec_first()
exec_second()
2 changes: 2 additions & 0 deletions examples/core/score.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def llm():
res = LLMTextQualityModelBase.eval(data)
print(res)


def rule():
data = Data(
data_id='123',
Expand All @@ -29,6 +30,7 @@ def rule():
res = RuleEnterAndSpace().eval(data)
print(res)


if __name__ == "__main__":
llm()
rule()
19 changes: 8 additions & 11 deletions examples/custom/sdk_custom_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,15 @@
"dataset": "local",
"data_format": "jsonl",
"column_content": "content",
"custom_config":
{
"prompt_list": ["PromptRepeat"],
"llm_config":
{
"LLMTextQualityPromptBase":
{
"key": "",
"api_url": "",
}
}
"custom_config": {
"prompt_list": ["PromptRepeat"],
"llm_config": {
"LLMTextQualityPromptBase": {
"key": "",
"api_url": "",
}
}
}
}
input_args = InputArgs(**input_data)
executor = Executor.exec_map["local"](input_args)
Expand Down
12 changes: 5 additions & 7 deletions examples/dataman/dataman.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@
"custom_config":
{
"prompt_list": ["PromptDataManAssessment"],
"llm_config":
{
"dataman_assessment":
{
"key": "enter your key, such as:EMPTY",
"api_url": "enter your local llm api url, such as:http://127.0.0.1:8080/v1",
}
"llm_config": {
"dataman_assessment": {
"key": "enter your key, such as:EMPTY",
"api_url": "enter your local llm api url, such as:http://127.0.0.1:8080/v1",
}
}
},
"log_level": "INFO"
}
Expand Down
4 changes: 4 additions & 0 deletions examples/dataset/sdk_huggingface.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def huggingface_plaintext():
result = executor.execute()
print(result)


def huggingface_json():
input_data = {
"eval_group": "sft",
Expand All @@ -29,6 +30,7 @@ def huggingface_json():
result = executor.execute()
print(result)


def huggingface_jsonl():
input_data = {
"eval_group": "sft",
Expand All @@ -42,6 +44,7 @@ def huggingface_jsonl():
result = executor.execute()
print(result)


def huggingface_listjson():
input_data = {
"eval_group": "sft",
Expand All @@ -56,6 +59,7 @@ def huggingface_listjson():
result = executor.execute()
print(result)


if __name__ == '__main__':
huggingface_plaintext()
huggingface_json()
Expand Down
6 changes: 5 additions & 1 deletion examples/dataset/sdk_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
def local_plaintext():
input_data = {
"eval_group": "sft",
"input_path": "../../test/data/test_local_plaintext.txt", # local filesystem dataset
"input_path": "../../test/data/test_local_plaintext.txt", # local filesystem dataset
"dataset": "local",
"data_format": "plaintext",
}
Expand All @@ -15,6 +15,7 @@ def local_plaintext():
result = executor.execute()
print(result)


def local_json():
input_data = {
"eval_group": "sft",
Expand All @@ -29,6 +30,7 @@ def local_json():
result = executor.execute()
print(result)


def local_jsonl():
input_data = {
"eval_group": "sft",
Expand All @@ -43,6 +45,7 @@ def local_jsonl():
result = executor.execute()
print(result)


def local_listjson():
input_data = {
"eval_group": "sft",
Expand All @@ -57,6 +60,7 @@ def local_listjson():
result = executor.execute()
print(result)


if __name__ == '__main__':
local_plaintext()
local_json()
Expand Down
13 changes: 6 additions & 7 deletions examples/image/sdk_image_relevant.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,19 @@ def image_relevant():
"column_content": "url_2",
"custom_config": {
"prompt_list": ["PromptImageRelevant"],
"llm_config":
{
"VLMImageRelevant":
{
"key": "",
"api_url": "",
}
"llm_config": {
"VLMImageRelevant": {
"key": "",
"api_url": "",
}
}
}
}
input_args = InputArgs(**input_data)
executor = Executor.exec_map["local"](input_args)
result = executor.execute()
print(result)


if __name__ == '__main__':
image_relevant()
1 change: 1 addition & 0 deletions examples/image/sdk_image_repeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ def image_repeat():
result = executor.execute()
print(result)


if __name__ == '__main__':
image_repeat()
1 change: 1 addition & 0 deletions examples/image/sdk_image_text_similar.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ def image_text_similar():
result = executor.execute()
print(result)


if __name__ == '__main__':
image_text_similar()
Loading