masanorihirano
commited on
Commit
•
16ea29f
1
Parent(s):
91f4032
Update README.md
Browse files
README.md
CHANGED
@@ -46,7 +46,20 @@ import torch
|
|
46 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
47 |
|
48 |
tokenizer = AutoTokenizer.from_pretrained("pfnet/nekomata-14b-pfn-qfin", trust_remote_code=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
model = AutoModelForCausalLM.from_pretrained("pfnet/nekomata-14b-pfn-qfin", device_map="auto", trust_remote_code=True)
|
|
|
50 |
text = "日本銀行は"
|
51 |
input_ids = tokenizer(text, return_tensors="pt").input_ids
|
52 |
with torch.no_grad():
|
|
|
46 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
47 |
|
48 |
tokenizer = AutoTokenizer.from_pretrained("pfnet/nekomata-14b-pfn-qfin", trust_remote_code=True)
|
49 |
+
|
50 |
+
|
51 |
+
# Use GPU with bf16 (recommended for supported devices)
|
52 |
+
# model = AutoModelForCausalLM.from_pretrained("pfnet/nekomata-14b-pfn-qfin", device_map="auto", trust_remote_code=True, bf16=True)
|
53 |
+
|
54 |
+
# Use GPU with fp16
|
55 |
+
# model = AutoModelForCausalLM.from_pretrained("pfnet/nekomata-14b-pfn-qfin", device_map="auto", trust_remote_code=True, fp16=True)
|
56 |
+
|
57 |
+
# Use CPU
|
58 |
+
# model = AutoModelForCausalLM.from_pretrained("pfnet/nekomata-14b-pfn-qfin", device_map="cpu", trust_remote_code=True)
|
59 |
+
|
60 |
+
# Automatically select device and precision
|
61 |
model = AutoModelForCausalLM.from_pretrained("pfnet/nekomata-14b-pfn-qfin", device_map="auto", trust_remote_code=True)
|
62 |
+
|
63 |
text = "日本銀行は"
|
64 |
input_ids = tokenizer(text, return_tensors="pt").input_ids
|
65 |
with torch.no_grad():
|