From 1cb9870cb3b482f83761ee4b100639f14352a4e1 Mon Sep 17 00:00:00 2001 From: del-zhenwu Date: Thu, 25 Jan 2024 20:03:56 +0800 Subject: [PATCH] [doc] Add the requirement for the transformers library version in usage section (#658) --- README.md | 7 +++++-- README_zh-CN.md | 7 +++++-- requirements.txt | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5b002e0..da3ed09 100644 --- a/README.md +++ b/README.md @@ -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). 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 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 pip install streamlit==1.24.0 -pip install transformers==4.30.2 +pip install transformers>=4.34 streamlit run ./chat/web_demo.py ``` diff --git a/README_zh-CN.md b/README_zh-CN.md index 2892a1a..0eb6942 100644 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -126,7 +126,10 @@ InternLM2 系列模型在本仓库正式发布,具有如下特性: 接下来我们展示使用 [Transformers](#import-from-transformers),[ModelScope](#import-from-modelscope) 和 [Web demo](#dialogue) 进行推理。 对话模型采用了 [chatml 格式](./chat/chat_format.md) 来支持通用对话和智能体应用。 - +为了保障更好的使用效果,在用 [Transformers](#import-from-transformers) 或 [ModelScope](#import-from-modelscope) 进行推理前,请确保安装的 transformers 库版本满足以下要求: +``` +transformers >= 4.34 +``` ### 通过 Transformers 加载 通过以下的代码从 Transformers 加载 InternLM2-7B-Chat 模型 (可修改模型名称替换不同的模型) @@ -178,7 +181,7 @@ print(response) ```bash pip install streamlit==1.24.0 -pip install transformers==4.30.2 +pip install transformers>=4.34 streamlit run ./chat/web_demo.py ``` diff --git a/requirements.txt b/requirements.txt index dce94b4..4f88e70 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -transformers<4.30.0 +transformers>=4.34 sentencepiece