Hzfinfdu commited on
Commit
a777863
1 Parent(s): 119ded1

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +20 -0
README.md ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Import from Transformers
2
+ To load the Moss 7B model using Transformers, use the following code:
3
+ ```python
4
+ >>> from transformers import AutoTokenizer, AutoModelForCausalLM
5
+ >>> tokenizer = AutoTokenizer.from_pretrained("fnlp/moss-base-7b", trust_remote_code=True)
6
+ >>> model = AutoModelForCausalLM.from_pretrained("fnlp/moss-base-7b", trust_remote_code=True).cuda()
7
+ >>> model = model.eval()
8
+ >>> inputs = tokenizer(["流浪地球的导演是"], return_tensors="pt")
9
+ >>> for k,v in inputs.items():
10
+ inputs[k] = v.cuda()
11
+ >>> outputs = model.generate(**inputs, do_sample=True, temperature=0.8, top_p=0.8, repetition_penalty=1.1, max_new_tokens=256)
12
+ >>> response = tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
13
+ >>> print(response)
14
+ 郭帆
15
+ 主演分别是吴京和屈楚萧 还有李光洁刘德华等等
16
+ 这电影可以说是目前国内科幻片的天花板了
17
+ 票房也是突破50亿大关啦
18
+ 小编真的非常期待这部电影呀
19
+ 所以呢今天就给大家整理了关于影片中的很多细节图哦~
20
+ 不知道大家有没有注意到呢