Instructions to use internlm/internlm2-chat-7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use internlm/internlm2-chat-7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="internlm/internlm2-chat-7b", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("internlm/internlm2-chat-7b", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use internlm/internlm2-chat-7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "internlm/internlm2-chat-7b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "internlm/internlm2-chat-7b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/internlm/internlm2-chat-7b
- SGLang
How to use internlm/internlm2-chat-7b with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "internlm/internlm2-chat-7b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "internlm/internlm2-chat-7b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "internlm/internlm2-chat-7b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "internlm/internlm2-chat-7b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use internlm/internlm2-chat-7b with Docker Model Runner:
docker model run hf.co/internlm/internlm2-chat-7b
Commit History
-
replace get_max_length
x54-729c2ba644
-
update modeling file to newest
x54-729e7c2e16
-
update opencompass url
x54-72970e6cdc
-
transforer version
x54-729164f273 -
update opencompass leaderboard url
x54-72939d4590
-
fix flash attention import
x54-7296edb557
-
small update
x54-7299d2060a
-
update for new version
x54-729f7ec5db
-
fix eos & update README for tech report
x54-7293e6b81c -
Update generation_config.json and fix eos token id (#14)
Verified signature- Update generation_config.json and fix eos token id (5486307e394730c9fca8b4f2ea6ee3d8c08fc32d) - update tokenizer and readme (f47004506c78b5107b33b4ed3005a30965531049) - update readme (292bc88c12a57d7096c5519c4a046b19a3b811c0) - update readme (dadcf02defc87934f18f5dcf6f107c0620bb7176) Co-authored-by: RangiLyu <RangiLyu@users.noreply.huggingface.co>d5fadd8
-
fix `eos_token` (#12)
Verified signature- fix `eos_token` (993732e680b81127118090ed39be92b33ef69d35) Co-authored-by: Chujie Zheng <chujiezheng@users.noreply.huggingface.co>a928a63
-
fix no white space when using stream_chat with fast tokenizer
x54-7294275caa
-
update model weights
ZwwWayneaa1fc6c
-
Fix no white space when using stream_chat with fast tokenizer (#9)
Verified signature- Fix no white space when using stream_chat with fast tokenizer (065ad5414c08dd04c70abaf3f8f58968cdf84dcb) Co-authored-by: Shuhao Xing <x54-729@users.noreply.huggingface.co>5b50661
-
update additional_special_tokens (#8)
Verified signature- update additional_special_tokens (25c9ed42ae8210cb141143667adfae5c9a52a886) - add additional_special_tokens in tokenizer cfg (2234bca0e798d28dffe3eec70b8d6f11c6c62419) Co-authored-by: RangiLyu <RangiLyu@users.noreply.huggingface.co>baba19a
-
small
x54-729f7dc281 -
fast tokenizer and stream_chat fix (#5)
Verified signature- fast tokenizer and stream_chat fix (2335a07e76b814b60618eb65f7010f2603d057a7) - keep internlm2 only (7b2becefb0b4001364bbc77e33efa7a47716a4dd) - rename config to internlm2 (dfa1f4d7f2709d3d228f61e4651eef5940fd8863) Co-authored-by: Shuhao Xing <x54-729@users.noreply.huggingface.co>1334f62
-
update rope_scaling
x54-7292292b86 -
remove unnecessary attention_drop
x54-729008c536 -
Update special tokens (#3)
Verified signature- Update special tokens (c0b35944e954f1ed479ea873777750806206f50d) - add chatml template (3abc5fdccb02a8c6393323cbf4a6377a2d012903) - add bos in chat template (ef825b6d8297f101a2ce6c72696c39909a1a32f7) - update chat template in model (15c45a41978248a656f117206f8eb78d10b14eb8)30482dd
-
Update README.md
Verified signature5797f79
-
fix errir links
x54-729d1aff3c -
Update README.md
Verified signatureff6c216 -
Update README.md
Verified signaturef6e24af -
Update README.md
Verified signature78c1630
-
fix import error
x54-7290143463 -
support flash attn 2
x54-729d762e4c
-
Create README.md
Verified signatured619b7f
-
fix: add eoa into eos_token_id in chat to accelerate chat interface
ZwwWayne0e5f375
-
use bin instead of safetensors with max shard of 2GB
ZwwWayne03da3f2 -
fix(modeling): fix inference code
ZwwWayne405ebfe
-
initial commit internlm2-chat-7b model
ZwwWayned64cff5 -
update gitattributes
ZwwWayne5714f3f -
initial commit
5809a98