Instructions to use internlm/internlm2-20b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use internlm/internlm2-20b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="internlm/internlm2-20b")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("internlm/internlm2-20b", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use internlm/internlm2-20b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "internlm/internlm2-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-20b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/internlm/internlm2-20b
- SGLang
How to use internlm/internlm2-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-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-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-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-20b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use internlm/internlm2-20b with Docker Model Runner:
docker model run hf.co/internlm/internlm2-20b
x54-729 commited on
Commit ·
fa19cf2
1
Parent(s): cc58a90
update readme info
Browse files
README.md
CHANGED
|
@@ -29,9 +29,9 @@ license: other
|
|
| 29 |
The second generation of the InternLM model, InternLM2, includes models at two scales: 7B and 20B. For the convenience of users and researchers, we have open-sourced four versions of each scale of the model, which are:
|
| 30 |
|
| 31 |
- internlm2-base: A high-quality and highly adaptable model base, serving as an excellent starting point for deep domain adaptation.
|
| 32 |
-
- internlm2 (**recommended**): Built upon the internlm2-base, this version has
|
| 33 |
-
- internlm2-sft: Based on the Base model, it undergoes supervised human alignment training.
|
| 34 |
-
- internlm2-chat (**recommended**): Optimized for conversational interaction on top of the internlm2-sft through RLHF, it excels in instruction adherence, empathetic chatting, and tool invocation.
|
| 35 |
|
| 36 |
The base model of InternLM2 has the following technical features:
|
| 37 |
|
|
@@ -90,9 +90,9 @@ The code is licensed under Apache-2.0, while model weights are fully open for ac
|
|
| 90 |
第二代浦语模型, InternLM2 包含 7B 和 20B 两个量级的模型。为了方便用户使用和研究,每个量级的模型我们总共开源了四个版本的模型,他们分别是
|
| 91 |
|
| 92 |
- internlm2-base: 高质量和具有很强可塑性的模型基座,是模型进行深度领域适配的高质量起点;
|
| 93 |
-
- internlm2(**推荐**): 在internlm2-base基础上,在
|
| 94 |
-
- internlm2-sft:在Base基础上,进行有监督的人类对齐训练;
|
| 95 |
-
- internlm2-chat(**推荐**):在internlm2-sft基础上,经过RLHF,面向对话交互进行了优化,具有很好的指令遵循、共情聊天和调用工具等的能力。
|
| 96 |
|
| 97 |
InternLM2 的基础模型具备以下的技术特点
|
| 98 |
|
|
|
|
| 29 |
The second generation of the InternLM model, InternLM2, includes models at two scales: 7B and 20B. For the convenience of users and researchers, we have open-sourced four versions of each scale of the model, which are:
|
| 30 |
|
| 31 |
- internlm2-base: A high-quality and highly adaptable model base, serving as an excellent starting point for deep domain adaptation.
|
| 32 |
+
- internlm2 (**recommended**): Built upon the internlm2-base, this version has further pretrained on domain-specific corpus. It shows outstanding performance in evaluations while maintaining robust general language abilities, making it our recommended choice for most applications.
|
| 33 |
+
- internlm2-chat-sft: Based on the Base model, it undergoes supervised human alignment training.
|
| 34 |
+
- internlm2-chat (**recommended**): Optimized for conversational interaction on top of the internlm2-chat-sft through RLHF, it excels in instruction adherence, empathetic chatting, and tool invocation.
|
| 35 |
|
| 36 |
The base model of InternLM2 has the following technical features:
|
| 37 |
|
|
|
|
| 90 |
第二代浦语模型, InternLM2 包含 7B 和 20B 两个量级的模型。为了方便用户使用和研究,每个量级的模型我们总共开源了四个版本的模型,他们分别是
|
| 91 |
|
| 92 |
- internlm2-base: 高质量和具有很强可塑性的模型基座,是模型进行深度领域适配的高质量起点;
|
| 93 |
+
- internlm2(**推荐**): 在internlm2-base基础上,进一步在特定领域的语料上进行预训练,在评测中成绩优异,同时保持了很好的通用语言能力,是我们推荐的在大部分应用中考虑选用的优秀基座;
|
| 94 |
+
- internlm2-chat-sft:在Base基础上,进行有监督的人类对齐训练;
|
| 95 |
+
- internlm2-chat(**推荐**):在internlm2-chat-sft基础上,经过RLHF,面向对话交互进行了优化,具有很好的指令遵循、共情聊天和调用工具等的能力。
|
| 96 |
|
| 97 |
InternLM2 的基础模型具备以下的技术特点
|
| 98 |
|