Skip to content

Commit 883c66c

Browse files
load model via transformers (InternLM#23)
* load model via transformers * update demo internlm model
1 parent a0559d4 commit 883c66c

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

mindsearch/agent/models.py

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import os
22

3-
from lagent.llms import GPTAPI, INTERNLM2_META, LMDeployClient, LMDeployServer
3+
from lagent.llms import (GPTAPI, INTERNLM2_META, HFTransformerCasualLM,
4+
LMDeployClient, LMDeployServer)
45

56
internlm_server = dict(type=LMDeployServer,
6-
path='internlm/internlm2_5-7b',
7+
path='internlm/internlm2_5-7b-chat',
78
model_name='internlm2',
89
meta_template=INTERNLM2_META,
910
top_p=0.8,
@@ -14,7 +15,7 @@
1415
stop_words=['<|im_end|>'])
1516

1617
internlm_client = dict(type=LMDeployClient,
17-
model_name='internlm2_5-7b',
18+
model_name='internlm2_5-7b-chat',
1819
url='http://127.0.0.1:23333',
1920
meta_template=INTERNLM2_META,
2021
top_p=0.8,
@@ -24,6 +25,16 @@
2425
repetition_penalty=1.02,
2526
stop_words=['<|im_end|>'])
2627

28+
internlm_hf = dict(type=HFTransformerCasualLM,
29+
path='internlm/internlm2_5-7b-chat',
30+
meta_template=INTERNLM2_META,
31+
top_p=0.8,
32+
top_k=None,
33+
temperature=1e-6,
34+
max_new_tokens=8192,
35+
repetition_penalty=1.02,
36+
stop_words=['<|im_end|>'])
37+
2738
gpt4 = dict(type=GPTAPI,
2839
model_type='gpt-4-turbo',
2940
key=os.environ.get('OPENAI_API_KEY', 'YOUR OPENAI API KEY'))

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
duckduckgo_search==5.3.1b1
2+
einops
23
fastapi
34
git+https://github.com/InternLM/lagent.git
45
gradio

0 commit comments

Comments
 (0)