sammysun0711 commited on
Commit
9ed2e3a
1 Parent(s): 6bd2726

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +31 -0
README.md ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - zh
4
+ pipeline_tag: text-generation
5
+ ---
6
+ FP32 Model converted from https://github.com/FlagAI-Open/FlagAI/tree/master/examples/Aquila
7
+ ```
8
+ import torch
9
+ from transformers import AutoTokenizer, AutoModelForCausalLM
10
+
11
+ tokenizer = AutoTokenizer.from_pretrained('sammysun0711/aquilachat-7b-hf')
12
+ model = AutoModelForCausalLM.from_pretrained('sammysun0711/aquilachat-7b-hf', trust_remote_code=True)
13
+ model = model.eval()
14
+
15
+ question = '北京为什么是中国的首都?'
16
+ prompt = (
17
+ '''A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human's questions.'''
18
+ f'''###Human: {question}###Assistant:'''
19
+ )
20
+ with torch.no_grad():
21
+ ret = model.generate(
22
+ **tokenizer(prompt, return_tensors='pt').to('cpu'),
23
+ do_sample=False,
24
+ max_new_tokens=200,
25
+ use_cache=True
26
+ )
27
+ print(tokenizer.decode(output_ids))
28
+ ```
29
+ > 北京之所以成为中国的首都,是因为它有着独特的地理位置和历史背景。北京位于华北平原中心,周围是山峦起伏的燕山山脉和太行山脉。它自古以来就是华北地区的政治、文化和经济中心,有着重要的战略地位。
30
+
31
+ AquilaChat-7B开源模型使用《智源Aquila系列模型许可协议》, 原始代码基于Apache Licence 2.0。