oshizo commited on
Commit
6dac7cb
1 Parent(s): 480e6c9

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +47 -0
README.md CHANGED
@@ -1,3 +1,50 @@
1
  ---
2
  license: mit
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: mit
3
+ language:
4
+ - ja
5
  ---
6
+
7
+
8
+ # Overview
9
+
10
+ This model generates text like viewer comments in live streaming, such as Youtube Live.
11
+
12
+ This model was trained on [rinna/japanese-gpt-neox-3.6b-instruction-ppo](https://huggingface.co/rinna/japanese-gpt-neox-3.6b-instruction-ppo) using Lora.
13
+
14
+ # How to use the model
15
+
16
+ ~~~~python
17
+ import torch
18
+ from transformers import AutoTokenizer, AutoModelForCausalLM
19
+
20
+ tokenizer = AutoTokenizer.from_pretrained("rinna/japanese-gpt-neox-3.6b-instruction-ppo", use_fast=False)
21
+ model = AutoModelForCausalLM.from_pretrained("rinna/japanese-gpt-neox-3.6b-instruction-ppo", torch_dtype=torch.float16, device_map="auto")
22
+
23
+ from peft import PeftModel
24
+ peft_model = PeftModel.from_pretrained(model, "oshizo/comment-generation-japanese-3.6b-lora", device_map="auto")
25
+
26
+
27
+ prompt = f"ユーザー: 今朝うちの小さな畑でトマトがね、いい感じに赤くなってたんだよね。そのまま通学路を歩いてたんだけどさ、一つちぎって弁当に入れておけば良かっな~と思って。トマト可愛くて好き。<NL>システム: "
28
+ token_ids = tokenizer.encode(prompt, add_special_tokens=False, return_tensors="pt")
29
+
30
+ with torch.no_grad():
31
+ output_ids = model.generate(
32
+ token_ids.to(model.device),
33
+ do_sample=True,
34
+ max_new_tokens=32,
35
+ num_return_sequences=4,
36
+ pad_token_id=tokenizer.pad_token_id,
37
+ bos_token_id=tokenizer.bos_token_id,
38
+ eos_token_id=tokenizer.eos_token_id
39
+ )
40
+ for output in output_ids.tolist():
41
+ print(tokenizer.decode(output[token_ids.size(1):], skip_special_tokens=True))
42
+
43
+ # これから剥くの面倒くさいよ<NL>
44
+ # なんやその可愛い好きは<NL>
45
+ # 冷やしておくと美味しいよな<NL>
46
+ # 食レポ具体的に<NL>
47
+ ~~~~
48
+
49
+
50
+