x54-729 commited on
Commit
6f15759
1 Parent(s): 55facc7

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +24 -0
README.md CHANGED
@@ -72,6 +72,18 @@ The table below compares the performance of mainstream open-source models on som
72
 
73
  Overall, InternLM-20B comprehensively outperforms open-source models in the 13B parameter range in terms of overall capabilities, and on inference evaluation sets, it approaches or even surpasses the performance of Llama-65B.
74
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  **Limitations:** Although we have made efforts to ensure the safety of the model during the training process and to encourage the model to generate text that complies with ethical and legal requirements, the model may still produce unexpected outputs due to its size and probabilistic generation paradigm. For example, the generated responses may contain biases, discrimination, or other harmful content. Please do not propagate such content. We are not responsible for any consequences resulting from the dissemination of harmful information.
76
 
77
 
@@ -125,6 +137,18 @@ InternLM 20B 在模型结构上选择了深结构,层数设定为60层,超
125
 
126
  总体而言,InternLM-20B 在综合能力上全面领先于13B量级的开源模型,同时在推理评测集上能够接近甚至超越Llama-65B的性能。
127
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  **局限性:** 尽管在训练过程中我们非常注重模型的安全性,尽力促使模型输出符合伦理和法律要求的文本,但受限于模型大小以及概率生成范式,模型可能会产生各种不符合预期的输出,例如回复内容包含偏见、歧视等有害内容,请勿传播这些内容。由于传播不良信息导致的任何后果,本项目不承担责任。
129
 
130
  ## 开源许可证
 
72
 
73
  Overall, InternLM-20B comprehensively outperforms open-source models in the 13B parameter range in terms of overall capabilities, and on inference evaluation sets, it approaches or even surpasses the performance of Llama-65B.
74
 
75
+ ## Import from Transformers
76
+ To load the InternLM 20B model using Transformers, use the following code:
77
+ ```python
78
+ >>> from transformers import AutoTokenizer, AutoModelForCausalLM
79
+ >>> tokenizer = AutoTokenizer.from_pretrained("internlm/internlm-chat-20b", trust_remote_code=True)
80
+ >>> model = AutoModelForCausalLM.from_pretrained("internlm/internlm-chat-20b", trust_remote_code=True).cuda()
81
+ >>> model = model.eval()
82
+ >>> output, history = model.chat(tokenizer, "Hello! Today is sunny, it is time to go out")
83
+ >>> print(output)
84
+ Hello! Today is sunny, and it sounds like a great day to go out an enjoy the weather. What would you like to do?
85
+ ```
86
+
87
  **Limitations:** Although we have made efforts to ensure the safety of the model during the training process and to encourage the model to generate text that complies with ethical and legal requirements, the model may still produce unexpected outputs due to its size and probabilistic generation paradigm. For example, the generated responses may contain biases, discrimination, or other harmful content. Please do not propagate such content. We are not responsible for any consequences resulting from the dissemination of harmful information.
88
 
89
 
 
137
 
138
  总体而言,InternLM-20B 在综合能力上全面领先于13B量级的开源模型,同时在推理评测集上能够接近甚至超越Llama-65B的性能。
139
 
140
+ ## 通过 Transformers 加载
141
+ 通过以下的代码加载 InternLM 20B 模型
142
+ ```python
143
+ >>> from transformers import AutoTokenizer, AutoModelForCausalLM
144
+ >>> tokenizer = AutoTokenizer.from_pretrained("internlm/internlm-chat-20b", trust_remote_code=True)
145
+ >>> model = AutoModelForCausalLM.from_pretrained("internlm/internlm-chat-20b", trust_remote_code=True).cuda()
146
+ >>> model = model.eval()
147
+ >>> output, history = model.chat(tokenizer, "你好呀!今天天气真好")
148
+ >>> print(output)
149
+ 你好!是的,今天的天气非常晴朗,非常适合户外活动。
150
+ ```
151
+
152
  **局限性:** 尽管在训练过程中我们非常注重模型的安全性,尽力促使模型输出符合伦理和法律要求的文本,但受限于模型大小以及概率生成范式,模型可能会产生各种不符合预期的输出,例如回复内容包含偏见、歧视等有害内容,请勿传播这些内容。由于传播不良信息导致的任何后果,本项目不承担责任。
153
 
154
  ## 开源许可证