Skip to content

Commit

Permalink
[Fix] Fix turbomind_tis (#992)
Browse files Browse the repository at this point in the history
  • Loading branch information
ispobock authored Mar 22, 2024
1 parent 054e9fa commit e415ddf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion configs/eval_internlm_chat_turbomind_tis.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from .datasets.mmlu.mmlu_gen_a484b3 import mmlu_datasets
from .datasets.ceval.ceval_gen_5f30c7 import ceval_datasets
from .datasets.SuperGLUE_WiC.SuperGLUE_WiC_gen_d06864 import WiC_datasets
from .datasets.SuperGLUE_WSC.SuperGLUE_WSC_gen_6dc406 import WSC_datasets
from .datasets.SuperGLUE_WSC.SuperGLUE_WSC_gen_7902a7 import WSC_datasets
from .datasets.triviaqa.triviaqa_gen_2121ce import triviaqa_datasets
from .datasets.gsm8k.gsm8k_gen_1d7fe4 import gsm8k_datasets
from .datasets.humaneval.humaneval_gen_8e312c import humaneval_datasets
Expand Down
6 changes: 6 additions & 0 deletions opencompass/models/turbomind_tis.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ def __init__(
super().__init__(path=path,
max_seq_len=max_seq_len,
meta_template=meta_template)
from lmdeploy.serve.turbomind.utils import Preprocessor
self.preprocess = Preprocessor(tis_addr)
self.logger = get_logger()
self.template_parser = LMTemplateParser(meta_template)
self.eos_token_id = None
Expand Down Expand Up @@ -83,6 +85,10 @@ def generate(
[temperature] * len(inputs)))
return results

def get_token_len(self, prompt: str) -> int:
input_ids, _ = self.preprocess(prompt)
return input_ids.shape[-1]

def wait(self):
"""Wait till the next query can be sent.
Expand Down

0 comments on commit e415ddf

Please sign in to comment.