[Feature] Several enhancements (#142)

This commit is contained in:
Tong Gao 2023-08-01 18:19:49 +08:00 committed by GitHub
parent c00179d46b
commit 8b163bd8e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 90 additions and 4 deletions

View 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

View File

@ -2,7 +2,6 @@
import itertools
import os
from functools import partial
from typing import List, Optional
import torch.nn.functional as F
@ -127,9 +126,6 @@ class CLPInferencer(BaseInferencer):
# in case tokenizer returns list for single token
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
# prepare in context for each example and control the length

View File

@ -1,3 +1,4 @@
import argparse
import json
from typing import Dict, List, Optional, Union
@ -37,3 +38,21 @@ class LarkReporter:
}
}
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)

View File

@ -1,3 +1,4 @@
absl-py
accelerate>=0.19.0
boto3
colossalai
@ -14,6 +15,7 @@ openai
pandas<2.0.0
rank_bm25==0.2.2
requests==2.28.1
rouge_score
scikit_learn==1.2.1
sentence_transformers==2.2.2
tabulate