diff --git a/configs/eval_demo.py b/configs/eval_demo.py new file mode 100644 index 00000000..ddd1e567 --- /dev/null +++ b/configs/eval_demo.py @@ -0,0 +1,28 @@ +from opencompass.models import HuggingFaceCausalLM + +with read_base(): + from .datasets.piqa.piqa_ppl import piqa_datasets + +datasets = piqa_datasets + +models = [ + # OPT-1.3b + dict( + type=HuggingFaceCausalLM, + path='facebook/opt-1.3b', + tokenizer_path='facebook/opt-1.3b', + tokenizer_kwargs=dict( + padding_side='left', + truncation_side='left', + proxies=None, + trust_remote_code=True, + ), + max_out_len=100, + max_seq_len=2048, + batch_size=16, + model_kwargs=dict(device_map='auto'), + run_cfg=dict(num_gpus=1, num_procs=1), + ) +] + + diff --git a/docs/en/_static/css/readthedocs.css b/docs/en/_static/css/readthedocs.css index 1891c912..89a80476 100644 --- a/docs/en/_static/css/readthedocs.css +++ b/docs/en/_static/css/readthedocs.css @@ -1,8 +1,8 @@ .header-logo { - background-image: url("../image/logo.png"); - background-size: 183px 50px; - height: 50px; - width: 183px; + background-image: url("../image/logo.svg"); + background-size: 275px 80px; + height: 80px; + width: 275px; } @media screen and (min-width: 1100px) { diff --git a/docs/en/_static/image/logo.png b/docs/en/_static/image/logo.png deleted file mode 100644 index 8b5efee6..00000000 Binary files a/docs/en/_static/image/logo.png and /dev/null differ diff --git a/docs/en/_static/image/logo.svg b/docs/en/_static/image/logo.svg new file mode 100644 index 00000000..80648e23 --- /dev/null +++ b/docs/en/_static/image/logo.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/en/get_started.md b/docs/en/get_started.md index 834caf3d..0ba8af2d 100644 --- a/docs/en/get_started.md +++ b/docs/en/get_started.md @@ -17,7 +17,6 @@ conda install pytorch torchvision -c pytorch ```bash git clone https://github.com/opencompass/opencompass cd opencompass -pip install -r requirments/runtime.txt pip install -e . ``` diff --git a/docs/zh_cn/_static/css/readthedocs.css b/docs/zh_cn/_static/css/readthedocs.css index 1891c912..89a80476 100644 --- a/docs/zh_cn/_static/css/readthedocs.css +++ b/docs/zh_cn/_static/css/readthedocs.css @@ -1,8 +1,8 @@ .header-logo { - background-image: url("../image/logo.png"); - background-size: 183px 50px; - height: 50px; - width: 183px; + background-image: url("../image/logo.svg"); + background-size: 275px 80px; + height: 80px; + width: 275px; } @media screen and (min-width: 1100px) { diff --git a/docs/zh_cn/_static/image/logo.png b/docs/zh_cn/_static/image/logo.png deleted file mode 100644 index 8b5efee6..00000000 Binary files a/docs/zh_cn/_static/image/logo.png and /dev/null differ diff --git a/docs/zh_cn/_static/image/logo.svg b/docs/zh_cn/_static/image/logo.svg new file mode 100644 index 00000000..80648e23 --- /dev/null +++ b/docs/zh_cn/_static/image/logo.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/zh_cn/get_started.md b/docs/zh_cn/get_started.md index 292d4c41..5a8bcb3f 100644 --- a/docs/zh_cn/get_started.md +++ b/docs/zh_cn/get_started.md @@ -17,7 +17,6 @@ conda install pytorch torchvision -c pytorch ```bash git clone https://github.com/opencompass/opencompass cd opencompass -pip install -r requirments/runtime.txt pip install -e . ``` diff --git a/opencompass/__init__.py b/opencompass/__init__.py index e69de29b..b794fd40 100644 --- a/opencompass/__init__.py +++ b/opencompass/__init__.py @@ -0,0 +1 @@ +__version__ = '0.1.0' diff --git a/run.py b/run.py index 57db2803..5f5999e0 100644 --- a/run.py +++ b/run.py @@ -214,7 +214,7 @@ def exec_infer_runner(tasks, args, cfg): else: runner = LocalRunner( task=dict(type='OpenICLInferTask'), - # max_num_workers = args.max_num_workers, + max_num_workers = args.max_num_workers, debug=args.debug, lark_bot_url=cfg['lark_bot_url']) runner(tasks) @@ -240,7 +240,7 @@ def exec_eval_runner(tasks, args, cfg): else: runner = LocalRunner( task=dict(type='OpenICLEvalTask'), - # max_num_workers = args.max_num_workers, + max_num_workers = args.max_num_workers, debug=args.debug, lark_bot_url=cfg['lark_bot_url']) runner(tasks) diff --git a/setup.py b/setup.py index 9c44bfb9..f9e05d84 100644 --- a/setup.py +++ b/setup.py @@ -10,14 +10,97 @@ class DownloadNLTK(install): nltk.download('punkt') -with open('README.md') as f: +with open('README_zh-CN.md') as f: readme = f.read() +def parse_requirements(fname='requirements.txt', with_version=True): + """Parse the package dependencies listed in a requirements file but strips + specific versioning information. + + Args: + fname (str): path to requirements file + with_version (bool, default=False): if True include version specs + + Returns: + List[str]: list of requirements items + + CommandLine: + python -c "import setup; print(setup.parse_requirements())" + """ + import re + import sys + from os.path import exists + require_fpath = fname + + def parse_line(line): + """Parse information from a line in a requirements text file.""" + if line.startswith('-r '): + # Allow specifying requirements in other files + target = line.split(' ')[1] + for info in parse_require_file(target): + yield info + else: + info = {'line': line} + if line.startswith('-e '): + info['package'] = line.split('#egg=')[1] + else: + # Remove versioning from the package + pat = '(' + '|'.join(['>=', '==', '>']) + ')' + parts = re.split(pat, line, maxsplit=1) + parts = [p.strip() for p in parts] + + info['package'] = parts[0] + if len(parts) > 1: + op, rest = parts[1:] + if ';' in rest: + # Handle platform specific dependencies + # http://setuptools.readthedocs.io/en/latest/setuptools.html#declaring-platform-specific-dependencies + version, platform_deps = map(str.strip, + rest.split(';')) + info['platform_deps'] = platform_deps + else: + version = rest # NOQA + if '--' in version: + # the `extras_require` doesn't accept options. + version = version.split('--')[0].strip() + info['version'] = (op, version) + yield info + + def parse_require_file(fpath): + with open(fpath, 'r') as f: + for line in f.readlines(): + line = line.strip() + if line and not line.startswith('#'): + for info in parse_line(line): + yield info + + def gen_packages_items(): + if exists(require_fpath): + for info in parse_require_file(require_fpath): + parts = [info['package']] + if with_version and 'version' in info: + parts.extend(info['version']) + if not sys.version.startswith('3.4'): + # apparently package_deps are broken in 3.4 + platform_deps = info.get('platform_deps') + if platform_deps is not None: + parts.append(';' + platform_deps) + item = ''.join(parts) + yield item + + packages = list(gen_packages_items()) + return packages + +def get_version(): + version_file = 'opencompass/__init__.py' + with open(version_file, 'r', encoding='utf-8') as f: + exec(compile(f.read(), version_file, 'exec')) + return locals()['__version__'] def do_setup(): setup( name='opencompass', - version='0.5.0', + version=get_version(), description='A comprehensive toolkit for large model evaluation', # url="", # author="", @@ -26,6 +109,7 @@ def do_setup(): cmdclass={'download_nltk': DownloadNLTK}, setup_requires=['nltk==3.8'], python_requires='>=3.8.0', + install_requires=parse_requirements('requirements/runtime.txt'), packages=find_packages(exclude=[ 'test*', 'paper_test*',