Instructions to use internlm/internlm2-chat-20b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use internlm/internlm2-chat-20b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="internlm/internlm2-chat-20b", 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-20b", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use internlm/internlm2-chat-20b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "internlm/internlm2-chat-20b" # 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-20b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/internlm/internlm2-chat-20b
- SGLang
How to use internlm/internlm2-chat-20b 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-20b" \ --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-20b", "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-20b" \ --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-20b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use internlm/internlm2-chat-20b with Docker Model Runner:
docker model run hf.co/internlm/internlm2-chat-20b
Commit History
-
replace get_max_length
x54-729d606d41
-
update modeling file to newest
x54-729c2477f1
-
update opencompass url
x54-729325a8d0
-
transforer version
x54-7290fbc298 -
update opencompass leaderboard url
x54-72979c0c5d
-
fix flash attention import
x54-7292d0920c
-
small update
x54-7292750ce8
-
update for new version
x54-72904830fb
-
fix eos & update README for tech report
x54-729e013aec
-
fix `eos_token` (#10)
Verified signature- fix `eos_token` (500d2763f3958042835b2715eed783a2f12bcec3) Co-authored-by: Chujie Zheng <chujiezheng@users.noreply.huggingface.co>d7e8e24
-
fix no white space when using stream_chat with fast tokenizer
x54-729477d474
-
update model weights
ZwwWayne2481a80
-
fix no white space when using stream_chat with fast tokenizer
x54-72919833d4
-
Add special tokens for chat
x54-729b286911
-
small
x54-7293f710f7 -
fast tokenizer and stream_chat fix (#7)
Verified signature- fast tokenizer and stream_chat fix (2d132f09477969de678a15d7f42339e899b17d9b) - keep internlm2 only (5031860d4625945f5429185af386643d87b4a3b1) - rename config to internlm2 (beab1bb63df37194cb020b1ac17c4246133838de) Co-authored-by: Shuhao Xing <x54-729@users.noreply.huggingface.co>d0438da
-
update rope_scaling
x54-729b666125 -
remove unnecessary attention_drop
x54-729180a5b8 -
Update special tokens (#3)
Verified signature- Update special tokens (4deffb0b0a29b37b72f6e9d1f58f209a033ef382) - add chatml template (bdd4b6c0d4e531762b9b6a0fa6f50c459edd23fa) - add bos in chat template (0da1df6f7a23940bc6bd400a3e0f6631b316526d) - update chat template in model (b2357579bad20cdebc86db80aebaea11844084f1)50ffaf2
-
Update license in README.md
Verified signature3ccaf3a
-
fix errir links
x54-729a02a926 -
Update README.md
Verified signature9aa01c1 -
update readme
x54-7298c23dac -
Update README.md
Verified signature4d7f585
-
fix import error
x54-7298c8a68a -
support flash attn 2
x54-7294e70767
-
Create README.md
Verified signature254d72c
-
fix: add eoa into eos_token_id in chat to accelerate chat interface
ZwwWayneb149c04
-
use bin instead of safetensors with max shard of 2GB
ZwwWaynee2955f1 -
fix(modeling): fix inference code
ZwwWaynea726bdd
-
initial commit internlm2-chat-20b model
ZwwWayne4d06ea7 -
update gitattributes
ZwwWayne396a3c6 -
initial commit
41f0314