dahara1 commited on
Commit
bfef67e
·
verified ·
1 Parent(s): 38eea11

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +8 -2
README.md CHANGED
@@ -96,7 +96,13 @@ from peft import PeftModel
96
  model_id = "unsloth/gemma-2-9b-it-bnb-4bit"
97
  peft_model_id = "webbigdata/C3TR-Adapter"
98
 
99
- model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto")
 
 
 
 
 
 
100
  model = PeftModel.from_pretrained(model = model, model_id = peft_model_id)
101
  tokenizer = AutoTokenizer.from_pretrained(model_id)
102
  tokenizer.pad_token = tokenizer.unk_token
@@ -136,7 +142,7 @@ The prompt format is original.
136
  Version1とVersion2(システムプロンプト追加)とVersion3(特殊トークン追加)ではプロンプトフォーマットも変わっています。
137
  The prompt format has changed between Version 1, Version2(add sustem prompts) and Version 3(add special tokens).
138
 
139
- プロンプトテンプレート内に余分な空白や改行、特殊トークンの漏れはモデルが誤動作(出力が途切れたり繰り返す、余分な文章が付加される等)に繋がるのでテンプレートにミスがないようにしてください
140
  Extra spaces, line breaks, and omission of special tokens in the prompt template will cause the model to malfunction (output will be truncated or repeated, extra sentences will be added, etc.), so please make sure there are no errors in the template.
141
 
142
  Instructionsは"Translate Japanese to English."(日英翻訳)と"Translate English to Japanese."(英日翻訳)の2種類です。
 
96
  model_id = "unsloth/gemma-2-9b-it-bnb-4bit"
97
  peft_model_id = "webbigdata/C3TR-Adapter"
98
 
99
+ # デバイスがbfloat16をサポートしているかどうかを確認
100
+ if torch.cuda.is_available() and torch.cuda.get_device_capability(0)[0] >= 8:
101
+ dtype = torch.bfloat16
102
+ else:
103
+ dtype = torch.float16
104
+
105
+ model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=dtype, device_map="auto")
106
  model = PeftModel.from_pretrained(model = model, model_id = peft_model_id)
107
  tokenizer = AutoTokenizer.from_pretrained(model_id)
108
  tokenizer.pad_token = tokenizer.unk_token
 
142
  Version1とVersion2(システムプロンプト追加)とVersion3(特殊トークン追加)ではプロンプトフォーマットも変わっています。
143
  The prompt format has changed between Version 1, Version2(add sustem prompts) and Version 3(add special tokens).
144
 
145
+ プロンプトテンプレート内に余分な空白や改行、特殊トークンの漏れはモデルの誤動作(出力が途切れたり繰り返す、余分な文章が付加される等)に繋がるのでテンプレートにミスがないようにしてください
146
  Extra spaces, line breaks, and omission of special tokens in the prompt template will cause the model to malfunction (output will be truncated or repeated, extra sentences will be added, etc.), so please make sure there are no errors in the template.
147
 
148
  Instructionsは"Translate Japanese to English."(日英翻訳)と"Translate English to Japanese."(英日翻訳)の2種類です。