Instructions to use internlm/internlm2-chat-7b-sft with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use internlm/internlm2-chat-7b-sft with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="internlm/internlm2-chat-7b-sft", 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-sft", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use internlm/internlm2-chat-7b-sft 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-sft" # 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-sft", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/internlm/internlm2-chat-7b-sft
- SGLang
How to use internlm/internlm2-chat-7b-sft 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-sft" \ --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-sft", "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-sft" \ --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-sft", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use internlm/internlm2-chat-7b-sft with Docker Model Runner:
docker model run hf.co/internlm/internlm2-chat-7b-sft
Commit History
-
update modeling file to newest
x54-729b37a841
-
update opencompass url
x54-729907bec6
-
transforer version
x54-72957c8a37 -
update opencompass leaderboard url
x54-7291c00c30
-
fix flash attention import
x54-729e196b5a
-
small update
x54-72990f12d4
-
update for new version
x54-729028ef6f
-
fix eos & update README for tech report
x54-7298b32993
-
fix `eos_token` (#3)
Verified signature- fix `eos_token` (5f2e4c950adf309bc09a6e995ca6576a7937e572) Co-authored-by: Chujie Zheng <chujiezheng@users.noreply.huggingface.co>ace525c
-
fix no white space when using stream_chat with fast tokenizer
x54-729bddf529
-
update model weights
ZwwWayneaa8ab69
-
fix no white space when using stream_chat with fast tokenizer
x54-7291103ce7
-
Add special tokens for chat
x54-72941408e7
-
small
x54-729e338c92 -
fast tokenizer and stream_chat fix (#2)
Verified signature- fast tokenizer and stream_chat fix (0447da55aa447853ca5c933463fba8bfb4c187a8) - keep internlm2 only (8c7e64e3d73e3511b7c90037dd94ad5583b3a8ec) - rename config to internlm2 (5e7556a5a4451925f5b3220243db08721e20674d) Co-authored-by: Shuhao Xing <x54-729@users.noreply.huggingface.co>0e5ca87
-
update rope_scaling
x54-72912d9a89 -
remove unnecessary attention_drop
x54-7296e85777 -
Update special tokens (#1)
Verified signature- Update special tokens (0c024edc46e0388be04f1a94633aff9e99367b55) - add chatml template (2f2a02e6c885c28027f356e96cd44cd73c89dee5) - add bos in chat template (a68e7787aec2ce2e5e48196958e31db45a6c4276) - update chat template in model (fd2aa27b2dbe5a224abe62b97f3df3659c72a8b5)0ce7fbf
-
Update license in Readme.md
Verified signature3123e75
-
fix errir links
x54-729daaacf9 -
Update README.md
Verified signature6f82b6f -
Update README.md
Verified signature313afc0
-
fix import error
x54-72925f6a3e -
support flash attn 2
x54-7295651285
-
Create README.md
Verified signatured15595f
-
fix: add eoa into eos_token_id in chat to accelerate chat interface
ZwwWayne792f68a
-
initial commit internlm2-chat-7b-sft model
ZwwWayneca4e235 -
update .gitattributes
ZwwWayne48449d6 -
initial commit
Verified signature7eb1122