omitakahiro
commited on
Commit
•
f111a7f
1
Parent(s):
7841296
Update README.md
Browse files
README.md
CHANGED
@@ -16,10 +16,18 @@ Stockmark-100b-instruct-v0.1 is an instruction tuned version of [stockmark-100b]
|
|
16 |
import torch
|
17 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
tokenizer = AutoTokenizer.from_pretrained("stockmark/stockmark-100b")
|
20 |
model = AutoModelForCausalLM.from_pretrained("stockmark/stockmark-100b", device_map="auto", torch_dtype=torch.bfloat16)
|
21 |
|
22 |
-
|
|
|
|
|
23 |
with torch.inference_mode():
|
24 |
tokens = model.generate(
|
25 |
input_ids,
|
|
|
16 |
import torch
|
17 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
18 |
|
19 |
+
prompt_template = """### 指示:
|
20 |
+
{instruction}
|
21 |
+
|
22 |
+
### 応答:
|
23 |
+
"""
|
24 |
+
|
25 |
tokenizer = AutoTokenizer.from_pretrained("stockmark/stockmark-100b")
|
26 |
model = AutoModelForCausalLM.from_pretrained("stockmark/stockmark-100b", device_map="auto", torch_dtype=torch.bfloat16)
|
27 |
|
28 |
+
instruction = "生成AIとは?"
|
29 |
+
prompt = prompt_template.format(instruction=instruction)
|
30 |
+
input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to(model.device)
|
31 |
with torch.inference_mode():
|
32 |
tokens = model.generate(
|
33 |
input_ids,
|