Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,7 @@ Hugging Face Transformersライブラリを使用してローカルでモデル
|
|
12 |
# モデルとトークナイザーの初期化
|
13 |
MODEL_NAME = "sbintuitions/sarashina2.2-3b-instruct-v0.1"
|
14 |
|
15 |
-
print("
|
16 |
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME, trust_remote_code=True)
|
17 |
model = AutoModelForCausalLM.from_pretrained(
|
18 |
MODEL_NAME,
|
@@ -20,7 +20,12 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
20 |
device_map="auto" if torch.cuda.is_available() else None,
|
21 |
trust_remote_code=True
|
22 |
)
|
23 |
-
print("
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
def respond(
|
26 |
message,
|
|
|
12 |
# モデルとトークナイザーの初期化
|
13 |
MODEL_NAME = "sbintuitions/sarashina2.2-3b-instruct-v0.1"
|
14 |
|
15 |
+
print("モデルを読み込み中〜...")
|
16 |
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME, trust_remote_code=True)
|
17 |
model = AutoModelForCausalLM.from_pretrained(
|
18 |
MODEL_NAME,
|
|
|
20 |
device_map="auto" if torch.cuda.is_available() else None,
|
21 |
trust_remote_code=True
|
22 |
)
|
23 |
+
print("モデルの読み込みが完了しました〜。")
|
24 |
+
|
25 |
+
print(f"Is CUDA available: {torch.cuda.is_available()}")
|
26 |
+
# True
|
27 |
+
print(f"CUDA device: {torch.cuda.get_device_name(torch.cuda.current_device())}")
|
28 |
+
# Tesla T4
|
29 |
|
30 |
def respond(
|
31 |
message,
|