fb700 commited on
Commit
dffa9c0
1 Parent(s): 80074c3

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +50 -3
README.md CHANGED
@@ -1,10 +1,57 @@
1
- ---
2
  license: apache-2.0
3
- ---
4
  ChatGLM-6B 是开源中英双语对话模型 本次训练基于ChatGLM-6B 的第一代版本,在保留了初代模型对话流畅、部署门槛较低等众多优秀特性的基础之上,本次训练使用了30万条fitness数据,40万条gpt4数据,以及30万条人类反馈数据的微调。
5
  训练后在健康咨询,文档总结 上强于glm2,fp16运行时速度上比原模型提升20%.可以代替原有官方模型,大家可以fp16、int4、int8使用。
6
  协议
7
  本仓库的代码依照 Apache-2.0 协议开源,ChatGLM2-6B 模型的权重的使用则需要遵循 Model License。
8
  授权方式,与原项目一致,未经过chatglm原开发方允许,不得用于商业用途。
9
  在原项目上的训练由智能AI用户[帛凡]于2023年基于ChatGLM独立训练的人工智能助手(严禁售卖或者商业项目,任何通过此项目产生的知识仅用于参考,作者不承担任何责任)。
10
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  license: apache-2.0
 
2
  ChatGLM-6B 是开源中英双语对话模型 本次训练基于ChatGLM-6B 的第一代版本,在保留了初代模型对话流畅、部署门槛较低等众多优秀特性的基础之上,本次训练使用了30万条fitness数据,40万条gpt4数据,以及30万条人类反馈数据的微调。
3
  训练后在健康咨询,文档总结 上强于glm2,fp16运行时速度上比原模型提升20%.可以代替原有官方模型,大家可以fp16、int4、int8使用。
4
  协议
5
  本仓库的代码依照 Apache-2.0 协议开源,ChatGLM2-6B 模型的权重的使用则需要遵循 Model License。
6
  授权方式,与原项目一致,未经过chatglm原开发方允许,不得用于商业用途。
7
  在原项目上的训练由智能AI用户[帛凡]于2023年基于ChatGLM独立训练的人工智能助手(严禁售卖或者商业项目,任何通过此项目产生的知识仅用于参考,作者不承担任何责任)。
8
+ 16G及以上显存用下载压缩包即lora文件使用,可支持ChatGLM原生模型和LoRA微调后的模型
9
+ Usage (HuggingFace Transformers)
10
+ Without textgen, you can use the model like this:
11
+ First, you pass your input through the transformer model, then you get the generated sentence.
12
+ Install package:
13
+ pip install transformers peft
14
+
15
+ import sys
16
+ from peft import PeftModel
17
+ from transformers import AutoModel, AutoTokenizer
18
+ sys.path.append('..')
19
+ model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True, device_map='auto')
20
+ model = PeftModel.from_pretrained(model, "model/chatglm_fitness_lora")
21
+ model = model.half().cuda() # fp16
22
+ tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True)
23
+ sents = ['新冠肺炎怎么预防。\n答:']
24
+ for s in sents:
25
+ response = model.chat(tokenizer, s, max_length=128, eos_token_id=tokenizer.eos_token_id)
26
+ print(response)
27
+
28
+ output:
29
+
30
+ 模型文件组成:
31
+ chatglm_fitness_lora
32
+ ├── adapter_config.json
33
+ └── adapter_model.bin
34
+
35
+ --------------------------------------------------------------------------------
36
+ 16G及以下显存用户下载整个模型,可支持支持fp16、int8、int4
37
+ Usage (HuggingFace Transformers)
38
+ Without textgen, you can use the model like this:
39
+ First, you pass your input through the transformer model, then you get the generated sentence.
40
+ Install package:
41
+ pip install transformers peft
42
+
43
+ import sys
44
+ from transformers import AutoModel, AutoTokenizer
45
+ sys.path.append('..')
46
+ model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True, device_map='auto')
47
+ #model = model.half().quantize(4).cuda() # int4
48
+ #model = model.half().quantize(8).cuda() # int8
49
+ #model = model.half().cuda() # fp16
50
+ tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True)
51
+ sents = ['新冠肺炎怎么预防。\n答:']
52
+ for s in sents:
53
+ response = model.chat(tokenizer, s, max_length=128, eos_token_id=tokenizer.eos_token_id)
54
+ print(response)
55
+
56
+ output:
57
+