Skip to content

Commit f4d9beb

Browse files
committed
refactor: optimize script structure and improve path handling for better modularity
1 parent da80386 commit f4d9beb

3 files changed

Lines changed: 16 additions & 51 deletions

File tree

evaluate/base/evaluation.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import re
55
import time
66
import uuid
7+
from typing import Dict, Any, List
78

89
from bohrium import Bohrium
910
from dotenv import load_dotenv, find_dotenv
@@ -115,13 +116,6 @@ def multi_turn_evaluation_task(dataset_item):
115116
return result
116117

117118

118-
import asyncio
119-
import json
120-
import re
121-
import time
122-
from typing import Dict, Any, List
123-
124-
125119
async def _run_conversation(dataset_item: Dict[str, Any], max_turn_count: int, save_mode: str = 'w') -> Dict[str, Any]:
126120
"""
127121
执行一次对话测试,并返回结果

evaluate/experiments/threads/database_search/run.sh renamed to evaluate/experiments/threads/run.sh

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
11
#!/bin/bash
2-
PYTHON=.venv/bin/python # your .venv
2+
3+
SCRIPT_PATH=$(realpath "$BASH_SOURCE")
4+
MATMASTER_DIR=$(dirname $(dirname $(dirname $(dirname "$SCRIPT_PATH"))))
5+
THREADS_DIR=$MATMASTER_DIR/evaluate/experiments/threads
6+
7+
if [ x"$1" == x ];then
8+
echo "Please specify evaluation type...[$(ls -l $THREADS_DIR | grep '^d' | awk '{print $9}'| xargs)]"
9+
exit 1
10+
fi
11+
12+
PYTHON=$MATMASTER_DIR/.venv/bin/python # your .venv
313
set -a
4-
source .env # your .env
14+
source $MATMASTER_DIR/.env # your .env
515
set +a
616

7-
export PYTHONPATH=/your/matmaster/path/MatMaster:$PYTHONPATH
17+
export PYTHONPATH=$MATMASTER_DIR:$PYTHONPATH
818
export MAX_JOBS=3
919

1020
TOTAL=$($PYTHON -c "
1121
import os
1222
import json
13-
with open('database_search.json') as f:
23+
with open('$THREADS_DIR/$1/$1.json') as f:
1424
dataset_json = json.load(f)
1525
print(len(dataset_json))
1626
")
@@ -22,7 +32,7 @@ running_jobs=0
2232
for ((i=0; i<$TOTAL; i++)); do
2333
echo "🚀 提交任务: item $i"
2434
sleep 3
25-
$PYTHON database_search_bash.py \
35+
$PYTHON $THREADS_DIR/$1/$1_bash.py \
2636
--item_id $i > item_$i.log 2>&1 &
2737

2838
((running_jobs++))

evaluate/experiments/threads/structure_generate/run.sh

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)