Instructions to use internlm/internlm2-20b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use internlm/internlm2-20b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="internlm/internlm2-20b", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("internlm/internlm2-20b", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use internlm/internlm2-20b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "internlm/internlm2-20b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "internlm/internlm2-20b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/internlm/internlm2-20b
- SGLang
How to use internlm/internlm2-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-20b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "internlm/internlm2-20b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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-20b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "internlm/internlm2-20b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use internlm/internlm2-20b with Docker Model Runner:
docker model run hf.co/internlm/internlm2-20b
Commit History
-
replace get_max_length
x54-729af48d6d
-
update modeling file to newest
x54-729b43f37b
-
update opencompass url
x54-729dc01308
-
transforer version
x54-7292f4c250 -
update opencompass leaderboard url
x54-729b3bd19d
-
fix flash attention import
x54-729095ad5d
-
small update
x54-729fa45716
-
update for new version
x54-729d431f9e
-
fix eos & update README for tech report
x54-729f363ea8
-
upload new weights
Verified signature1b707ab
-
fix no white space when using stream_chat with fast tokenizer
x54-729f689c06
-
small
x54-729e907218 -
fast tokenizer and stream_chat fix (#2)
Verified signature- fast tokenizer and stream_chat fix (912eeb0f7210d9775bb159d7d27a347194778a6a) - keep internlm2 only (f17f278fbe876f3177ce57e48f82680f94b8dead) - rename config to internlm2 (801d5cdb44490dd11ece359f422db7f549ffde8f) Co-authored-by: Shuhao Xing <x54-729@users.noreply.huggingface.co>3996794
-
update rope_scaling
x54-72987f5ff7 -
remove unnecessary attention_drop
x54-72922818a9 -
update chat template
x54-729002d9b0
-
update readme info
x54-729fa19cf2 -
Update License in README.md
Verified signaturecc58a90
-
fix example prompt
x54-729a81187a -
update readme
x54-729695532d
-
fix import error
x54-729fe1d049 -
support flash attn 2
x54-7295d2de41
-
Create README.md
Verified signatureec0e348
-
update model weights
ZwwWayne9de1f26 -
initial commit
Verified signature46a24d8