Instructions to use internlm/internlm2-7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use internlm/internlm2-7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="internlm/internlm2-7b", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("internlm/internlm2-7b", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use internlm/internlm2-7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "internlm/internlm2-7b" # 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-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/internlm/internlm2-7b
- SGLang
How to use internlm/internlm2-7b 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-7b" \ --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-7b", "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-7b" \ --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-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use internlm/internlm2-7b with Docker Model Runner:
docker model run hf.co/internlm/internlm2-7b
Commit History
-
Adding `safetensors` variant of this model
Verified signatureThis is an automated PR created with https://huggingface.co/spaces/safetensors/convert This new file is equivalent to `pytorch_model.bin` but safe in the sense that no arbitrary code can be put into it. These files also happen to load much faster than their pytorch counterpart: https://colab.research.google.com/github/huggingface/notebooks/blob/main/safetensors_doc/en/speed.ipynb The widgets on your model page will run using this model even if this is not merged making sure the file actually works. If you find any issues: please report here: https://huggingface.co/spaces/safetensors/convert/discussions Feel free to ignore this PR.d69b49c
-
replace get_max_length
x54-7298fbef1b
-
update modeling file to newest
x54-7293909fd2
-
update opencompass url
x54-7297d92b93
-
transforer version
x54-7292f101c6 -
update opencompass leaderboard url
x54-72984f2f10
-
fix flash attention import
x54-729c9c773f
-
small update
x54-729f739ec7
-
update for new version
x54-729fa732f7
-
fix eos & update README for tech report
x54-729530fc70
-
upload new weights
Verified signatureea4312f
-
fix no white space when using stream_chat with fast tokenizer
x54-7293a7c99d
-
small
x54-729392eed6 -
fast tokenizer and stream_chat fix (#2)
Verified signature- fast tokenizer and stream_chat fix (8b09dc8be769b49cb783f48bac39b1a23c032645) - keep internlm2 only (848badbe78390ab5d409007fa2db8b5f375106c5) - rename config to internlm2 (554cf12598fea63bb435bed127df3a12a4655fde) Co-authored-by: Shuhao Xing <x54-729@users.noreply.huggingface.co>4acf7da
-
update rope_scaling
x54-729a60c8dc -
remove unnecessary attention_drop
x54-7296488caa -
update chat template
x54-729b799c4e
-
update readme info
x54-7297c4622c -
Update license in README.md
Verified signature9f82066
-
fix example prompt
x54-729b0d7599 -
update readme
x54-729885b2ec
-
fix import error
x54-7296b55bce -
support flash attn 2
x54-729dd09602
-
Create README.md
Verified signatureaac482e
-
update model weights
ZwwWayne1358c2f -
initial commit
Verified signaturec740dd1