Instructions to use internlm/internlm2-chat-7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use internlm/internlm2-chat-7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="internlm/internlm2-chat-7b", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("internlm/internlm2-chat-7b", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use internlm/internlm2-chat-7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "internlm/internlm2-chat-7b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "internlm/internlm2-chat-7b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/internlm/internlm2-chat-7b
- SGLang
How to use internlm/internlm2-chat-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-chat-7b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "internlm/internlm2-chat-7b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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-chat-7b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "internlm/internlm2-chat-7b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use internlm/internlm2-chat-7b with Docker Model Runner:
docker model run hf.co/internlm/internlm2-chat-7b
update readme
Browse files
README.md
CHANGED
|
@@ -20,8 +20,7 @@ license: other
|
|
| 20 |
|
| 21 |
[](https://github.com/internLM/OpenCompass/)
|
| 22 |
|
| 23 |
-
[💻Github Repo](https://github.com/InternLM/InternLM) • [🤔Reporting Issues](https://github.com/InternLM/InternLM/issues/new) •
|
| 24 |
-
[📜Technical Report](https://arxiv.org/abs/2403.17297)
|
| 25 |
|
| 26 |
</div>
|
| 27 |
|
|
@@ -284,8 +283,8 @@ curl http://localhost:23333/v1/chat/completions \
|
|
| 284 |
-d '{
|
| 285 |
"model": "internlm2-chat-7b",
|
| 286 |
"messages": [
|
| 287 |
-
{"role": "system", "content": "
|
| 288 |
-
{"role": "user", "content": "
|
| 289 |
]
|
| 290 |
}'
|
| 291 |
```
|
|
@@ -312,8 +311,8 @@ curl http://localhost:8000/v1/chat/completions \
|
|
| 312 |
-d '{
|
| 313 |
"model": "internlm2-chat-7b",
|
| 314 |
"messages": [
|
| 315 |
-
{"role": "system", "content": "
|
| 316 |
-
{"role": "user", "content": "
|
| 317 |
]
|
| 318 |
}'
|
| 319 |
```
|
|
|
|
| 20 |
|
| 21 |
[](https://github.com/internLM/OpenCompass/)
|
| 22 |
|
| 23 |
+
[💻Github Repo](https://github.com/InternLM/InternLM) • [🤔Reporting Issues](https://github.com/InternLM/InternLM/issues/new) • [📜Technical Report](https://arxiv.org/abs/2403.17297)
|
|
|
|
| 24 |
|
| 25 |
</div>
|
| 26 |
|
|
|
|
| 283 |
-d '{
|
| 284 |
"model": "internlm2-chat-7b",
|
| 285 |
"messages": [
|
| 286 |
+
{"role": "system", "content": "你是个友善的AI助手。"},
|
| 287 |
+
{"role": "user", "content": "介绍一下深度学习。"}
|
| 288 |
]
|
| 289 |
}'
|
| 290 |
```
|
|
|
|
| 311 |
-d '{
|
| 312 |
"model": "internlm2-chat-7b",
|
| 313 |
"messages": [
|
| 314 |
+
{"role": "system", "content": "你是个友善的AI助手。"},
|
| 315 |
+
{"role": "user", "content": "介绍一下深度学习。"}
|
| 316 |
]
|
| 317 |
}'
|
| 318 |
```
|