Instructions to use internlm/internlm-20b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use internlm/internlm-20b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="internlm/internlm-20b", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("internlm/internlm-20b", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use internlm/internlm-20b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "internlm/internlm-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/internlm-20b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/internlm/internlm-20b
- SGLang
How to use internlm/internlm-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/internlm-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/internlm-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/internlm-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/internlm-20b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use internlm/internlm-20b with Docker Model Runner:
docker model run hf.co/internlm/internlm-20b
Commit History
-
update copyright (#6)
Verified signature- update copyright (9cdfecbd94a7948bbfbfd08813f30c3412f7b3f7) Co-authored-by: Shuhao Xing <x54-729@users.noreply.huggingface.co>80729bc
-
remove unnecessary attention_drop
x54-7297b2c6fe
-
fix import error
x54-7291249bed -
update config
x54-729e6e6069 -
support flash attn 2
x54-72938f564d
-
Update modeling_internlm.py
eb85986 -
Update modeling_internlm.py
c95809d
-
Update config.json
2d83118 -
Add torch_dtype to README example
509b748 -
Support dynamic ntk rope
53d4840 -
Support dynamic ntk rope
c8f2f99 -
Support dynamic ntk rope
bb78fe6
-
fix pad token id
c56a729
-
Fix InternLMTokenizer
632df84
-
Small change to chat prompt
5d2ec53
-
Add github link
f0433b0 -
Update README.md
486ab72
-
Create README.md
74d6d2f
-
update max_position_embedding
6f404c1
-
Upload internlm-20b
b8825fe -
initial commit
720c265