commit
Browse files
app.py
CHANGED
@@ -9,9 +9,13 @@ HUGGINGFACE_TOKEN = os.getenv("HUGGINGFACE_TOKEN")
|
|
9 |
if not HUGGINGFACE_TOKEN:
|
10 |
raise ValueError("HUGGINGFACE_TOKEN environment variable is not set")
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
|
|
|
|
|
|
15 |
|
16 |
# モデルとトークナイザーの初期化
|
17 |
MODEL_NAME = "google/gemma-7b-it"
|
|
|
9 |
if not HUGGINGFACE_TOKEN:
|
10 |
raise ValueError("HUGGINGFACE_TOKEN environment variable is not set")
|
11 |
|
12 |
+
def _load_model():
|
13 |
+
if not torch.cuda.is_available():
|
14 |
+
raise RuntimeError("GPU is not available but required.")
|
15 |
+
print("GPU is available and model will be loaded.")
|
16 |
+
return "GPU ready"
|
17 |
+
|
18 |
+
_load_model()
|
19 |
|
20 |
# モデルとトークナイザーの初期化
|
21 |
MODEL_NAME = "google/gemma-7b-it"
|