[Docs] update chat readme

pull/752/head
lvchengqi 2024-07-02 09:39:27 +00:00
parent f431fd0e07
commit c93c1f837d
4 changed files with 10 additions and 10 deletions

View File

@ -2,13 +2,13 @@
English | [简体中文](./README_zh-CN.md)
This document briefly shows how to use [Transformers](#import-from-transformers), [ModelScope](#import-from-modelscope), and [Web demos](#dialogue) to conduct inference with InternLM2-Chat.
This document briefly shows how to use [Transformers](#import-from-transformers), [ModelScope](#import-from-modelscope), and [Web demos](#dialogue) to conduct inference with InternLM2.5-Chat.
You can also know more about the [chatml format](./chat_format.md) and how to use [LMDeploy for inference and model serving](./lmdeploy.md).
## Import from Transformers
To load the InternLM2 7B Chat model using Transformers, use the following code:
To load the InternLM2.5 7B Chat model using Transformers, use the following code:
```python
>>> from transformers import AutoTokenizer, AutoModelForCausalLM
@ -31,7 +31,7 @@ Remember, good time management skills take practice and patience. Start with sma
## Import from ModelScope
To load the InternLM model using ModelScope, use the following code:
To load the InternLM2.5 Chat model using ModelScope, use the following code:
```python
from modelscope import snapshot_download, AutoTokenizer, AutoModelForCausalLM
@ -48,7 +48,7 @@ print(response)
## Dialogue
You can interact with the InternLM Chat 7B model through a frontend interface by running the following code:
You can interact with the InternLM2.5 Chat model through a frontend interface by running the following code:
```bash
pip install streamlit

View File

@ -3,9 +3,9 @@
[English](./README.md) | 简体中文
本文介绍采用 [Transformers](#import-from-transformers)、[ModelScope](#import-from-modelscope)、[Web demos](#dialogue)
对 InternLM2-Chat 进行推理。
对 InternLM2.5-Chat 进行推理。
你还可以进一步了解 InternLM2-Chat 采用的[对话格式](./chat_format_zh-CN.md),以及如何[用 LMDeploy 进行推理或部署服务](./lmdeploy_zh-CN.md),或者尝试用 [OpenAOE](./openaoe.md) 与多个模型对话。
你还可以进一步了解 InternLM2.5-Chat 采用的[对话格式](./chat_format_zh-CN.md),以及如何[用 LMDeploy 进行推理或部署服务](./lmdeploy_zh-CN.md),或者尝试用 [OpenAOE](./openaoe.md) 与多个模型对话。
## 通过 Transformers 加载
@ -25,7 +25,7 @@
### 通过 ModelScope 加载
通过以下的代码从 ModelScope 加载 InternLM2-Chat 模型 (可修改模型名称替换不同的模型)
通过以下的代码从 ModelScope 加载 InternLM2.5-Chat 模型 (可修改模型名称替换不同的模型)
```python
from modelscope import snapshot_download, AutoTokenizer, AutoModelForCausalLM
@ -42,7 +42,7 @@ print(response)
## 通过前端网页对话
可以通过以下代码启动一个前端的界面来与 InternLM2 Chat 7B 模型进行交互
可以通过以下代码启动一个前端的界面来与 InternLM2.5 Chat 7B 模型进行交互
```bash
pip install streamlit

View File

@ -17,7 +17,7 @@ Hello<|im_end|>
Hello, I am InternLM2-Chat, how can I assist you?<|im_end|>
```
Here, `<|im_start|>` acts as the start token for each turn of dialogue, and `<|im_end|>` as the end token. Each turn of dialogue typically starts with `<|im_start|>role` and ends with the model's output `<|im_end|>`, where role represents `system`, `user`, `assistant`, and `environment`. You may refer to the [code in huggingface](https://huggingface.co/internlm/internlm2_5-7b-chat/blob/main/modeling_internlm2.py#L1138) to see how the chat history is organized.
Here, `<|im_start|>` acts as the start token for each turn of dialogue, and `<|im_end|>` as the end token. Each turn of dialogue typically starts with `<|im_start|>role` and ends with the model's output `<|im_end|>`, where role represents `system`, `user`, `assistant`, and `environment`. You may refer to the [code in huggingface](https://huggingface.co/internlm/internlm2_5-7b-chat/blob/main/modeling_internlm2.py#L1357) to see how the chat history is organized.
Currently, the InternLM2-Chat model's vocabulary maintains the following mappings to support full functionalities:

View File

@ -17,7 +17,7 @@ InternLM2-Chat 采用了全新的对话格式,以灵活地支持工具调用
你好,我是书生浦语,请问有什么可以帮助你的吗<|im_end|>
```
其中 `<|im_start|>` 充当了每轮对话开始符,`<|im_end|>` 充当了当前轮对话结束符。每轮对话一般以 `<|im_start|>role` 开头,以模型输出的 `<|im_end|>` 结尾role 代表 `system``user``assistant` 和 `environment` 角色。你可以参考[huggingface 上的代码](https://huggingface.co/internlm/internlm2_5-7b-chat/blob/main/modeling_internlm2.py#L1138)来了解对话历史的拼接。
其中 `<|im_start|>` 充当了每轮对话开始符,`<|im_end|>` 充当了当前轮对话结束符。每轮对话一般以 `<|im_start|>role` 开头,以模型输出的 `<|im_end|>` 结尾role 代表 `system``user``assistant` 和 `environment` 角色。你可以参考[huggingface 上的代码](https://huggingface.co/internlm/internlm2_5-7b-chat/blob/main/modeling_internlm2.py#L1357)来了解对话历史的拼接。
目前InternLM2-Chat 模型的词表中还维护了如下映射