penguintrainer commited on
Commit
bf3f2c6
·
verified ·
1 Parent(s): 4b23b96

Under Editing

Browse files
Files changed (1) hide show
  1. README.md +74 -1
README.md CHANGED
@@ -1,6 +1,17 @@
1
  ---
2
  library_name: transformers
3
- tags: []
 
 
 
 
 
 
 
 
 
 
 
4
  ---
5
 
6
  # Model Card for Model ID
@@ -11,6 +22,16 @@ tags: []
11
 
12
  ## Model Details
13
 
 
 
 
 
 
 
 
 
 
 
14
  ### Model Description
15
 
16
  <!-- Provide a longer summary of what this model is. -->
@@ -37,6 +58,58 @@ This is the model card of a 🤗 transformers model that has been pushed on the
37
 
38
  <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  ### Direct Use
41
 
42
  <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
 
1
  ---
2
  library_name: transformers
3
+ tags:
4
+ - llm-jp-3-13b
5
+ - llm
6
+ - jp
7
+ - 13b
8
+ language:
9
+ - ja
10
+ base_model:
11
+ - llm-jp/llm-jp-3-13b
12
+ pipeline_tag: question-answering
13
+ datasets: i
14
+ license: apache-2.0
15
  ---
16
 
17
  # Model Card for Model ID
 
22
 
23
  ## Model Details
24
 
25
+ Uploaded model
26
+ Developed by: penguintrainer
27
+ License: apache-2.0 cc-by-sa-4.0
28
+ Finetuned from model : llm-jp/llm-jp-3-13b
29
+
30
+ Used ichikara-instruction-003-001-1 for fineturning.
31
+
32
+ [ichikara-instruction: 日本語instructionモデル評価データセット](https://liat-aip.sakura.ne.jp/wp/llm%E3%81%AE%E3%81%9F%E3%82%81%E3%81%AE%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%A9%E3%82%AF%E3%82%B7%E3%83%A7%E3%83%B3%E3%83%87%E3%83%BC%E3%82%BF%E4%BD%9C%E6%88%90/llm%E3%81%AE%E3%81%9F%E3%82%81%E3%81%AE%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%A9%E3%82%AF%E3%82%B7%E3%83%A7%E3%83%B3%E3%83%87%E3%83%BC%E3%82%BF-%E5%85%AC%E9%96%8B/)
33
+ © 2023 Akira Sasaki and Masato Hirakawa and Shintaro Horie and Tomoaki Nakamura (CC BY-SA 4.0 )
34
+
35
  ### Model Description
36
 
37
  <!-- Provide a longer summary of what this model is. -->
 
58
 
59
  <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
60
 
61
+
62
+ ```python
63
+ from transformers import (
64
+ AutoModelForCausalLM,
65
+ AutoTokenizer,
66
+ BitsAndBytesConfig,
67
+ )
68
+ from peft import PeftModel
69
+ import torch
70
+ from tqdm import tqdm
71
+
72
+ model_id = "llm-jp/llm-jp-3-13b"
73
+ adapter_id = "penguintrainer/llm-jp-3-13b-finetune"
74
+
75
+ # QLoRA config
76
+ bnb_config = BitsAndBytesConfig(
77
+ load_in_4bit=True,
78
+ bnb_4bit_quant_type="nf4",
79
+ bnb_4bit_compute_dtype=torch.bfloat16,
80
+ )
81
+
82
+ # Load model
83
+ model = AutoModelForCausalLM.from_pretrained(
84
+ model_id,
85
+ quantization_config=bnb_config,
86
+ device_map="auto",
87
+ )
88
+
89
+ # Load tokenizer
90
+ tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
91
+
92
+ # combain LoRA。
93
+ model = PeftModel.from_pretrained(model, adapter_id)
94
+
95
+
96
+ text = "大規模言語モデルとは何ですか?"
97
+
98
+ tokenized_input = tokenizer.encode(text, add_special_tokens=False, return_tensors="pt").to(model.device)
99
+
100
+ with torch.no_grad():
101
+ output = model.generate(
102
+ tokenized_input,
103
+ max_new_tokens=100,
104
+ do_sample=True,
105
+ top_p=0.95,
106
+ temperature=0.7,
107
+ repetition_penalty=1.05,
108
+ )[0]
109
+ print(tokenizer.decode(output))
110
+
111
+ ```
112
+
113
  ### Direct Use
114
 
115
  <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->