mirror of https://github.com/InternLM/InternLM
[doc] Add the requirement for the transformers library version in usage section (#658)
parent
c1ecc0d3d5
commit
1cb9870cb3
|
@ -128,7 +128,10 @@ The release of InternLM2 series contains two model sizes: 7B and 20B. 7B models
|
||||||
|
|
||||||
We briefly show the usages with [Transformers](#import-from-transformers), [ModelScope](#import-from-modelscope), and [Web demos](#dialogue).
|
We briefly show the usages with [Transformers](#import-from-transformers), [ModelScope](#import-from-modelscope), and [Web demos](#dialogue).
|
||||||
The chat models adopt [chatml format](./chat/chat_format.md) to support both chat and agent applications.
|
The chat models adopt [chatml format](./chat/chat_format.md) to support both chat and agent applications.
|
||||||
|
To ensure a better usage effect, please make sure that the installed transformers library version meets the following requirements before performing inference with [Transformers](#import-from-transformers) or [ModelScope](#import-from-modelscope):
|
||||||
|
```
|
||||||
|
transformers >= 4.34
|
||||||
|
```
|
||||||
### Import from Transformers
|
### Import from Transformers
|
||||||
|
|
||||||
To load the InternLM2-7B-Chat model using Transformers, use the following code:
|
To load the InternLM2-7B-Chat model using Transformers, use the following code:
|
||||||
|
@ -181,7 +184,7 @@ You can interact with the InternLM Chat 7B model through a frontend interface by
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install streamlit==1.24.0
|
pip install streamlit==1.24.0
|
||||||
pip install transformers==4.30.2
|
pip install transformers>=4.34
|
||||||
streamlit run ./chat/web_demo.py
|
streamlit run ./chat/web_demo.py
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,10 @@ InternLM2 系列模型在本仓库正式发布,具有如下特性:
|
||||||
|
|
||||||
接下来我们展示使用 [Transformers](#import-from-transformers),[ModelScope](#import-from-modelscope) 和 [Web demo](#dialogue) 进行推理。
|
接下来我们展示使用 [Transformers](#import-from-transformers),[ModelScope](#import-from-modelscope) 和 [Web demo](#dialogue) 进行推理。
|
||||||
对话模型采用了 [chatml 格式](./chat/chat_format.md) 来支持通用对话和智能体应用。
|
对话模型采用了 [chatml 格式](./chat/chat_format.md) 来支持通用对话和智能体应用。
|
||||||
|
为了保障更好的使用效果,在用 [Transformers](#import-from-transformers) 或 [ModelScope](#import-from-modelscope) 进行推理前,请确保安装的 transformers 库版本满足以下要求:
|
||||||
|
```
|
||||||
|
transformers >= 4.34
|
||||||
|
```
|
||||||
### 通过 Transformers 加载
|
### 通过 Transformers 加载
|
||||||
|
|
||||||
通过以下的代码从 Transformers 加载 InternLM2-7B-Chat 模型 (可修改模型名称替换不同的模型)
|
通过以下的代码从 Transformers 加载 InternLM2-7B-Chat 模型 (可修改模型名称替换不同的模型)
|
||||||
|
@ -178,7 +181,7 @@ print(response)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install streamlit==1.24.0
|
pip install streamlit==1.24.0
|
||||||
pip install transformers==4.30.2
|
pip install transformers>=4.34
|
||||||
streamlit run ./chat/web_demo.py
|
streamlit run ./chat/web_demo.py
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
transformers<4.30.0
|
transformers>=4.34
|
||||||
sentencepiece
|
sentencepiece
|
||||||
|
|
Loading…
Reference in New Issue