asaoka commited on
Commit
bf77b45
1 Parent(s): 1301820

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +6 -1
README.md CHANGED
@@ -12,6 +12,7 @@ library_name: peft
12
  import torch
13
  from peft import PeftModel
14
  from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
 
15
  # モデルの読み込み
16
  model = AutoModelForCausalLM.from_pretrained(
17
  "meta-llama/Llama-2-7b-hf",
@@ -23,10 +24,12 @@ model = AutoModelForCausalLM.from_pretrained(
23
  ),
24
  device_map={"":0}
25
  )
 
26
  # トークナイザーの読み込み
27
  tokenizer = AutoTokenizer.from_pretrained(
28
- "asaoka/Llama-2-7b-hf-qlora-dolly15k-japanese"
29
  )
 
30
  # LoRAの読み込み
31
  model = PeftModel.from_pretrained(
32
  model,
@@ -34,8 +37,10 @@ model = PeftModel.from_pretrained(
34
  device_map={"":0}
35
  )
36
  model.eval()
 
37
  # プロンプトの準備
38
  prompt = "### Instruction: 富士山とは?\n\n### Response: "
 
39
  # 推論の実行
40
  inputs = tokenizer(prompt, return_tensors="pt").to("cuda:0")
41
  with torch.no_grad():
 
12
  import torch
13
  from peft import PeftModel
14
  from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
15
+
16
  # モデルの読み込み
17
  model = AutoModelForCausalLM.from_pretrained(
18
  "meta-llama/Llama-2-7b-hf",
 
24
  ),
25
  device_map={"":0}
26
  )
27
+
28
  # トークナイザーの読み込み
29
  tokenizer = AutoTokenizer.from_pretrained(
30
+ "meta-llama/Llama-2-7b-hf"
31
  )
32
+
33
  # LoRAの読み込み
34
  model = PeftModel.from_pretrained(
35
  model,
 
37
  device_map={"":0}
38
  )
39
  model.eval()
40
+
41
  # プロンプトの準備
42
  prompt = "### Instruction: 富士山とは?\n\n### Response: "
43
+
44
  # 推論の実行
45
  inputs = tokenizer(prompt, return_tensors="pt").to("cuda:0")
46
  with torch.no_grad():