to-164
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
from aiDataParser import AsyncCore
|
||||
from pydantic import BaseModel
|
||||
from typing import List, Literal, Optional, Dict
|
||||
import time
|
||||
import os
|
||||
import json
|
||||
import orjson
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
class PropositionData(BaseModel):
|
||||
proposition: str
|
||||
text: str
|
||||
proposition_type: Literal[
|
||||
"fact",
|
||||
"description",
|
||||
"command",
|
||||
"prohibition",
|
||||
"permission",
|
||||
"recommendation",
|
||||
"obligation",
|
||||
"conditional",
|
||||
"causal",
|
||||
"consequence",
|
||||
"attribution",
|
||||
"comparison",
|
||||
"negation",
|
||||
"question",
|
||||
"ambiguous",
|
||||
]
|
||||
note: Optional[str] = None
|
||||
context_of_utterance: Dict = {}
|
||||
|
||||
|
||||
class RuleData(BaseModel):
|
||||
propositions: List[PropositionData]
|
||||
|
||||
|
||||
def load_orjson(path: str | Path):
|
||||
path = Path(path)
|
||||
with path.open("rb") as f: # باید باینری باز بشه برای orjson
|
||||
return orjson.loads(f.read())
|
||||
|
||||
|
||||
def save_orjson(path, data):
|
||||
with open(path, "wb") as f:
|
||||
f.write(
|
||||
orjson.dumps(data, option=orjson.OPT_INDENT_2 | orjson.OPT_NON_STR_KEYS)
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# start = time.time()
|
||||
ruuner = AsyncCore(
|
||||
output_schema=RuleData,
|
||||
model_name="gemma-4-31B-it", # "gemma-3-27b" , # "gpt-oss-120b"
|
||||
data_path="/home1/ava3/project/aiDataParser/task/0_hadis/input_phase2.json",
|
||||
output_path="/home1/ava3/project/aiDataParser/task/0_hadis/output_phase2",
|
||||
api_url="http://localhost:8001/v1/", # "http://172.16.29.102:8001/v1/"
|
||||
task_name="haids", # "gemma-27",
|
||||
reasoning_effort="medium",
|
||||
ai_code_version="gemma4-31b-med",
|
||||
request_timeout=600,
|
||||
save_number=1,
|
||||
semaphore_number=1,
|
||||
priority=1,
|
||||
max_token=None,
|
||||
)
|
||||
ruuner.sync_eval()
|
||||
|
||||
# python3 -m aiDataParser.task.0_hadis.run
|
||||
Reference in New Issue
Block a user