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)# 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 d606d41
x54-729 commited on
update modeling file to newest c2477f1
x54-729 commited on
update opencompass url 325a8d0
x54-729 commited on
transforer version 0fbc298
x54-729 commited on
update opencompass leaderboard url 79c0c5d
x54-729 commited on
fix flash attention import 2d0920c
x54-729 commited on
small update 2750ce8
x54-729 commited on
update for new version 04830fb
x54-729 commited on
fix eos & update README for tech report e013aec
x54-729 commited on
fix `eos_token` (#10) d7e8e24 verified
fix no white space when using stream_chat with fast tokenizer 477d474
x54-729 commited on
update model weights 2481a80
ZwwWayne commited on
fix no white space when using stream_chat with fast tokenizer 19833d4
x54-729 commited on
Add special tokens for chat b286911
x54-729 commited on
small 3f710f7
x54-729 commited on
update rope_scaling b666125
x54-729 commited on
remove unnecessary attention_drop 180a5b8
x54-729 commited on
Update license in README.md 3ccaf3a verified
fix errir links a02a926
x54-729 commited on
Update README.md 9aa01c1 verified
update readme 8c23dac
x54-729 commited on
Update README.md 4d7f585 verified
fix import error 8c8a68a
x54-729 commited on
support flash attn 2 4e70767
x54-729 commited on
Create README.md 254d72c verified
fix: add eoa into eos_token_id in chat to accelerate chat interface b149c04
ZwwWayne commited on
use bin instead of safetensors with max shard of 2GB e2955f1
ZwwWayne commited on
fix(modeling): fix inference code a726bdd
ZwwWayne commited on
initial commit internlm2-chat-20b model 4d06ea7
ZwwWayne commited on
update gitattributes 396a3c6
ZwwWayne commited on