Skip to content

Commit

Permalink
load model via transformers (InternLM#23)
Browse files Browse the repository at this point in the history
* load model via transformers

* update demo internlm model
  • Loading branch information
liujiangning30 authored Jul 31, 2024
1 parent a0559d4 commit 883c66c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
17 changes: 14 additions & 3 deletions mindsearch/agent/models.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import os

from lagent.llms import GPTAPI, INTERNLM2_META, LMDeployClient, LMDeployServer
from lagent.llms import (GPTAPI, INTERNLM2_META, HFTransformerCasualLM,
LMDeployClient, LMDeployServer)

internlm_server = dict(type=LMDeployServer,
path='internlm/internlm2_5-7b',
path='internlm/internlm2_5-7b-chat',
model_name='internlm2',
meta_template=INTERNLM2_META,
top_p=0.8,
Expand All @@ -14,7 +15,7 @@
stop_words=['<|im_end|>'])

internlm_client = dict(type=LMDeployClient,
model_name='internlm2_5-7b',
model_name='internlm2_5-7b-chat',
url='http://127.0.0.1:23333',
meta_template=INTERNLM2_META,
top_p=0.8,
Expand All @@ -24,6 +25,16 @@
repetition_penalty=1.02,
stop_words=['<|im_end|>'])

internlm_hf = dict(type=HFTransformerCasualLM,
path='internlm/internlm2_5-7b-chat',
meta_template=INTERNLM2_META,
top_p=0.8,
top_k=None,
temperature=1e-6,
max_new_tokens=8192,
repetition_penalty=1.02,
stop_words=['<|im_end|>'])

gpt4 = dict(type=GPTAPI,
model_type='gpt-4-turbo',
key=os.environ.get('OPENAI_API_KEY', 'YOUR OPENAI API KEY'))
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
duckduckgo_search==5.3.1b1
einops
fastapi
git+https://github.com/InternLM/lagent.git
gradio
Expand Down

0 comments on commit 883c66c

Please sign in to comment.