if001 commited on
Commit
4ca27dd
·
1 Parent(s): 85e0d82
Files changed (1) hide show
  1. README.md +73 -0
README.md CHANGED
@@ -1,3 +1,76 @@
1
  ---
2
  license: cc-by-4.0
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: cc-by-4.0
3
+ language:
4
+ - ja
5
+ - en
6
+ pipeline_tag: text-generation
7
+ inference: false
8
+ tags:
9
+ - llama-2
10
  ---
11
+
12
+ 日本語でtrainingしたllama2
13
+
14
+ `model size: 130.78M`
15
+
16
+ trainingは以下のscript参照
17
+ https://github.com/Lightning-AI/lit-gpt/tree/main
18
+
19
+ ## use
20
+
21
+ ```python
22
+ from transformers import AutoTokenizer, AutoModelForCausalLM
23
+
24
+ tokenizer = AutoTokenizer.from_pretrained("if001/sentencepiece_ja", trust_remote_code=True)
25
+ model = AutoModelForCausalLM.from_pretrained("if001/llama2_ja_ss")
26
+
27
+ import torch
28
+ from transformers import GenerationConfig
29
+
30
+ prompt="あのイーハトーヴォのすきとおった風、"
31
+
32
+ inputs = tokenizer(prompt, return_tensors="pt")
33
+ input_ids = inputs["input_ids"]
34
+
35
+ generation_config = GenerationConfig(
36
+ temperature=0.8,
37
+ top_p=0.95,
38
+ top_k=50,
39
+ num_beams=1,
40
+ do_sample=True,
41
+ repetition_penalty=1.2,
42
+ pad_token_id= tokenizer.pad_token_id,
43
+ # pad_token_id=tokenizer.unk_token_id,
44
+ eos_token_id=tokenizer.eos_token_id
45
+ )
46
+ with torch.no_grad():
47
+ generation_output = model.generate(
48
+ input_ids=input_ids,
49
+ generation_config=generation_config,
50
+ return_dict_in_generate=True,
51
+ output_scores=True,
52
+ max_new_tokens=64,
53
+ )
54
+ s = generation_output.sequences[0]
55
+ output = tokenizer.decode(s)
56
+ print(output)
57
+
58
+ > あの イ ー ハ トー ヴォ の すき と おった 風 、 その な ま めかし い こと 。...... 彼は それを 見ると 、 ひどく て ら っている ことが わかった 。
59
+ ```
60
+
61
+ ## dataset
62
+ 英語と日本語のデータセットを使用
63
+
64
+ ```
65
+ total tokens: 2.27B
66
+
67
+ wikipedia_ja: 844.65M
68
+ aozorabunko: 92.97M
69
+ open-text-books: 60.17M
70
+ wikipedia_en: 1.28B
71
+ ```
72
+
73
+ https://huggingface.co/datasets/izumi-lab/wikipedia-ja-20230720
74
+ https://huggingface.co/datasets/izumi-lab/wikipedia-en-20230720
75
+ https://huggingface.co/datasets/izumi-lab/open-text-books
76
+ https://huggingface.co/datasets/if001/aozorabunko-clean-sin