mirror of
https://github.com/open-compass/opencompass.git
synced 2025-05-30 16:03:24 +08:00
[Fix] python path bug (#1063)
* fix relative path bug * format --------- Co-authored-by: hmp <505030475@qq.com> Co-authored-by: Leymore <zfz-960727@163.com>
This commit is contained in:
parent
048d41a1c4
commit
701ecbb292
@ -2,13 +2,14 @@ import argparse
|
|||||||
import copy
|
import copy
|
||||||
import fnmatch
|
import fnmatch
|
||||||
import math
|
import math
|
||||||
|
import os
|
||||||
import os.path as osp
|
import os.path as osp
|
||||||
import re
|
import re
|
||||||
import statistics
|
import statistics
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
from inspect import signature
|
from inspect import signature
|
||||||
from shutil import which
|
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
import mmengine
|
import mmengine
|
||||||
@ -76,8 +77,9 @@ class OpenICLEvalTask(BaseTask):
|
|||||||
'task', {}).get('dump_details', False)
|
'task', {}).get('dump_details', False)
|
||||||
|
|
||||||
def get_command(self, cfg_path, template):
|
def get_command(self, cfg_path, template):
|
||||||
|
sys.path.append(os.getcwd())
|
||||||
script_path = __file__
|
script_path = __file__
|
||||||
python = 'python3' if which('python3') else 'python'
|
python = sys.executable
|
||||||
command = f'{python} {script_path} {cfg_path}'
|
command = f'{python} {script_path} {cfg_path}'
|
||||||
return template.format(task_cmd=command)
|
return template.format(task_cmd=command)
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import argparse
|
import argparse
|
||||||
|
import os
|
||||||
import os.path as osp
|
import os.path as osp
|
||||||
import random
|
import random
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
from shutil import which
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from mmengine.config import Config, ConfigDict
|
from mmengine.config import Config, ConfigDict
|
||||||
@ -42,6 +43,7 @@ class OpenICLInferTask(BaseTask):
|
|||||||
template (str): The template which have '{task_cmd}' to format
|
template (str): The template which have '{task_cmd}' to format
|
||||||
the command.
|
the command.
|
||||||
"""
|
"""
|
||||||
|
sys.path.append(os.getcwd())
|
||||||
script_path = __file__
|
script_path = __file__
|
||||||
backend_keys = ['VLLM', 'Lmdeploy']
|
backend_keys = ['VLLM', 'Lmdeploy']
|
||||||
use_backend = any(
|
use_backend = any(
|
||||||
@ -54,7 +56,7 @@ class OpenICLInferTask(BaseTask):
|
|||||||
f'--nproc_per_node {self.num_procs} '
|
f'--nproc_per_node {self.num_procs} '
|
||||||
f'{script_path} {cfg_path}')
|
f'{script_path} {cfg_path}')
|
||||||
else:
|
else:
|
||||||
python = 'python3' if which('python3') else 'python'
|
python = sys.executable
|
||||||
command = f'{python} {script_path} {cfg_path}'
|
command = f'{python} {script_path} {cfg_path}'
|
||||||
|
|
||||||
return template.format(task_cmd=command)
|
return template.format(task_cmd=command)
|
||||||
|
Loading…
Reference in New Issue
Block a user