mirror of
https://github.com/open-compass/opencompass.git
synced 2025-05-30 16:03:24 +08:00
[Feature] Several enhancements (#142)
This commit is contained in:
parent
c00179d46b
commit
8b163bd8e9
69
.pre-commit-config-zh-cn.yaml
Normal file
69
.pre-commit-config-zh-cn.yaml
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
exclude: |
|
||||||
|
(?x)^(
|
||||||
|
tests/data/|
|
||||||
|
opencompass/models/internal/|
|
||||||
|
opencompass/utils/internal/|
|
||||||
|
configs/
|
||||||
|
)
|
||||||
|
repos:
|
||||||
|
- repo: https://gitee.com/openmmlab/mirrors-flake8
|
||||||
|
rev: 5.0.4
|
||||||
|
hooks:
|
||||||
|
- id: flake8
|
||||||
|
- repo: https://gitee.com/openmmlab/mirrors-isort
|
||||||
|
rev: 5.11.5
|
||||||
|
hooks:
|
||||||
|
- id: isort
|
||||||
|
- repo: https://gitee.com/openmmlab/mirrors-yapf
|
||||||
|
rev: v0.32.0
|
||||||
|
hooks:
|
||||||
|
- id: yapf
|
||||||
|
- repo: https://gitee.com/openmmlab/mirrors-codespell
|
||||||
|
rev: v2.2.1
|
||||||
|
hooks:
|
||||||
|
- id: codespell
|
||||||
|
- repo: https://gitee.com/openmmlab/mirrors-pre-commit-hooks
|
||||||
|
rev: v4.3.0
|
||||||
|
hooks:
|
||||||
|
- id: trailing-whitespace
|
||||||
|
exclude: |
|
||||||
|
(?x)^(
|
||||||
|
dicts/|
|
||||||
|
projects/.*?/dicts/
|
||||||
|
)
|
||||||
|
- id: check-yaml
|
||||||
|
- id: end-of-file-fixer
|
||||||
|
exclude: |
|
||||||
|
(?x)^(
|
||||||
|
dicts/|
|
||||||
|
projects/.*?/dicts/
|
||||||
|
)
|
||||||
|
- id: requirements-txt-fixer
|
||||||
|
- id: double-quote-string-fixer
|
||||||
|
- id: check-merge-conflict
|
||||||
|
- id: fix-encoding-pragma
|
||||||
|
args: ["--remove"]
|
||||||
|
- id: mixed-line-ending
|
||||||
|
args: ["--fix=lf"]
|
||||||
|
- id: mixed-line-ending
|
||||||
|
args: ["--fix=lf"]
|
||||||
|
- repo: https://gitee.com/openmmlab/mirrors-mdformat
|
||||||
|
rev: 0.7.9
|
||||||
|
hooks:
|
||||||
|
- id: mdformat
|
||||||
|
args: ["--number", "--table-width", "200"]
|
||||||
|
additional_dependencies:
|
||||||
|
- mdformat-openmmlab
|
||||||
|
- mdformat_frontmatter
|
||||||
|
- linkify-it-py
|
||||||
|
- repo: https://gitee.com/openmmlab/mirrors-docformatter
|
||||||
|
rev: v1.3.1
|
||||||
|
hooks:
|
||||||
|
- id: docformatter
|
||||||
|
args: ["--in-place", "--wrap-descriptions", "79"]
|
||||||
|
# - repo: https://github.com/open-mmlab/pre-commit-hooks
|
||||||
|
# rev: v0.2.0 # Use the ref you want to point at
|
||||||
|
# hooks:
|
||||||
|
# - id: check-algo-readme
|
||||||
|
# - id: check-copyright
|
||||||
|
# args: ["mmocr", "tests", "tools"] # these directories will be checked
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
import itertools
|
import itertools
|
||||||
import os
|
import os
|
||||||
from functools import partial
|
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
import torch.nn.functional as F
|
import torch.nn.functional as F
|
||||||
@ -127,9 +126,6 @@ class CLPInferencer(BaseInferencer):
|
|||||||
# in case tokenizer returns list for single token
|
# in case tokenizer returns list for single token
|
||||||
choice_ids = list(itertools.chain(*choice_ids))
|
choice_ids = list(itertools.chain(*choice_ids))
|
||||||
|
|
||||||
get_token_len = partial(
|
|
||||||
self.model.get_token_len, # COPYBARA_INTERNAL # noqa
|
|
||||||
eos=False) # COPYBARA_INTERNAL # noqa
|
|
||||||
get_token_len = self.model.get_token_len
|
get_token_len = self.model.get_token_len
|
||||||
|
|
||||||
# prepare in context for each example and control the length
|
# prepare in context for each example and control the length
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import argparse
|
||||||
import json
|
import json
|
||||||
from typing import Dict, List, Optional, Union
|
from typing import Dict, List, Optional, Union
|
||||||
|
|
||||||
@ -37,3 +38,21 @@ class LarkReporter:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
requests.post(self.url, data=json.dumps(msg))
|
requests.post(self.url, data=json.dumps(msg))
|
||||||
|
|
||||||
|
|
||||||
|
def parse_args():
|
||||||
|
parser = argparse.ArgumentParser(description='Lark bot reporter')
|
||||||
|
parser.add_argument('url', help='Lark bot url')
|
||||||
|
parser.add_argument('content', type=str, help='Content')
|
||||||
|
parser.add_argument('--title', type=str, help='Title', default=None)
|
||||||
|
args = parser.parse_args()
|
||||||
|
return args
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
args = parse_args()
|
||||||
|
lark = LarkReporter(args.url)
|
||||||
|
if args.title:
|
||||||
|
lark.post(args.content, args.title)
|
||||||
|
else:
|
||||||
|
lark.post(args.content)
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
absl-py
|
||||||
accelerate>=0.19.0
|
accelerate>=0.19.0
|
||||||
boto3
|
boto3
|
||||||
colossalai
|
colossalai
|
||||||
@ -14,6 +15,7 @@ openai
|
|||||||
pandas<2.0.0
|
pandas<2.0.0
|
||||||
rank_bm25==0.2.2
|
rank_bm25==0.2.2
|
||||||
requests==2.28.1
|
requests==2.28.1
|
||||||
|
rouge_score
|
||||||
scikit_learn==1.2.1
|
scikit_learn==1.2.1
|
||||||
sentence_transformers==2.2.2
|
sentence_transformers==2.2.2
|
||||||
tabulate
|
tabulate
|
||||||
|
Loading…
Reference in New Issue
Block a user