Instructions to use internlm/internlm2-base-20b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use internlm/internlm2-base-20b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="internlm/internlm2-base-20b", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("internlm/internlm2-base-20b", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use internlm/internlm2-base-20b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "internlm/internlm2-base-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-base-20b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/internlm/internlm2-base-20b
- SGLang
How to use internlm/internlm2-base-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-base-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-base-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-base-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-base-20b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use internlm/internlm2-base-20b with Docker Model Runner:
docker model run hf.co/internlm/internlm2-base-20b
Commit History
-
update modeling file to newest
x54-729e873130
-
update opencompass url
x54-72988d8bc4
-
transforer version
x54-7296f7849f -
update opencompass leaderboard url
x54-729b77090b
-
fix flash attention import
x54-729f213bf5
-
small update
x54-729b4e6b30
-
update for new version
x54-7296097ed8
-
fix eos & update README for tech report
x54-7297e419e8
-
upload new weights
Verified signature24e1e91
-
fix no white space when using stream_chat with fast tokenizer
x54-729edf2879
-
small
x54-7291857a15 -
fast tokenizer and stream_chat fix (#3)
Verified signature- fast tokenizer and stream_chat fix (ed9d6f6c651ecb1550298acc809966946570c9e2) - keep internlm2 only (55aea95c0feb5bf827cb17d7235bb52ca2612b81) - rename config to internlm2 (05bceed7414824894ba597b964e52bf9cb62b228) Co-authored-by: Shuhao Xing <x54-729@users.noreply.huggingface.co>ca3f2c7
-
update rope_scaling
x54-7299305163 -
remove unnecessary attention_drop
x54-7298586def -
update chat template
x54-729d1913f2
-
update readme info
x54-729f7374de -
Update license in README.md
Verified signaturea40ae5d
-
fix example prompt
x54-72970d038d -
update readme
x54-729a9418b3
-
fix import error
x54-7299c9e595 -
support flash attn 2
x54-7295966e12
-
Create README.md
Verified signature1611f45
-
update model weights
ZwwWaynec790826 -
initial commit
Verified signature5587603