Instructions to use internlm/internlm2-1_8b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use internlm/internlm2-1_8b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="internlm/internlm2-1_8b", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("internlm/internlm2-1_8b", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use internlm/internlm2-1_8b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "internlm/internlm2-1_8b" # 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-1_8b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/internlm/internlm2-1_8b
- SGLang
How to use internlm/internlm2-1_8b 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-1_8b" \ --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-1_8b", "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-1_8b" \ --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-1_8b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use internlm/internlm2-1_8b with Docker Model Runner:
docker model run hf.co/internlm/internlm2-1_8b
Commit History
-
replace get_max_length
x54-729d753f1d
-
update modeling file to newest
x54-729e96c608
-
update opencompass url
x54-7299195687
-
transforer version
x54-729e4aeae1 -
update opencompass leaderboard url
x54-729886d334
-
fix flash attention import
x54-7297224f26
-
small update
x54-729f9853c0
-
update for new version
x54-729a8ad04e
-
fix eos & update README for tech report
x54-729c24f301
-
upload new weights
Verified signature9979f04 -
upload new weights
Verified signature6f306b8
-
fix no white space when using stream_chat with fast tokenizer
x54-72935f91cd
-
Update README.md
Verified signature454e418 -
README
x54-729e63eb76 -
update README
x54-729ae3bb61
-
README
x54-7298eec32b -
README
x54-729d2e49f2 -
upload internlm2 1.8B
x54-729460f38b -
initial commit
Verified signature4845cda