64 lines
2.5 KiB
Python
Executable File
64 lines
2.5 KiB
Python
Executable File
from aiDataParser import AsyncCore
|
|
from pydantic import BaseModel
|
|
from typing import List
|
|
import traceback, os
|
|
|
|
class Output(BaseModel):
|
|
law_definition: str
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main_path = '/home1/ava3/project/aiDataParser/task/match_plan/all_law_def/input/'
|
|
out_path_ = '/home1/ava3/project/aiDataParser/task/match_plan/all_law_def/output/'
|
|
proccess_list = ['بیمه']
|
|
number_1 = 1
|
|
for root, dirs, files in os.walk(main_path):
|
|
for file in files:
|
|
# بررسی پسوند فایل
|
|
if file.endswith('.json'):
|
|
print(f'---- {number_1}/{len(files)} ---')
|
|
number_1 +=1
|
|
try:
|
|
file_name = file.split('.')[0]
|
|
file_name = file_name.split('_')[-1]
|
|
if file_name in proccess_list:
|
|
continue
|
|
full_path = os.path.join(root, file)
|
|
out_path = os.path.join(out_path_, file_name)
|
|
|
|
ruuner = AsyncCore(
|
|
model_name='gpt-oss-120b',
|
|
data_path=full_path,
|
|
api_url="http://172.16.29.102:8001/v1/", #http://localhost:8010/v1/
|
|
output_path=out_path,
|
|
task_name=f'توضیح-قوانین-پلان- ساخته-شده-gpt-oss-120b-low-{file_name}',
|
|
output_schema=Output,
|
|
reasoning_effort='low',
|
|
ai_code_version='oss120_low',
|
|
request_timeout=30,
|
|
save_number=1,
|
|
max_token=512
|
|
)
|
|
ruuner.async_eval()
|
|
|
|
except:
|
|
print(f'Failed in load file {full_path}')
|
|
traceback.print_exc()
|
|
# continue
|
|
break
|
|
|
|
# ruuner = AsyncCore(
|
|
# model_name='Magistral-Small-2509',
|
|
# data_path='/home1/ava3/project/aiDataParser/task/match_plan/law_def_بیمه/_prompt.json',
|
|
# api_url="http://localhost:8001/v1/", #http://localhost:8010/v1/
|
|
# output_path='/home1/ava3/project/aiDataParser/task/match_plan/law_def_بیمه',
|
|
# task_name='توضیح-قوانین-پلان- ساخته-شده-mistral-test-med',
|
|
# output_schema=Output,
|
|
# reasoning_effort='high',
|
|
# ai_code_version='mag2509_high',
|
|
# request_timeout=30,
|
|
# save_number=1,
|
|
# max_token=512
|
|
# )
|
|
# ruuner.async_eval()
|