Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -6,11 +6,11 @@ import os
|
|
6 |
IS_SPACES_ZERO = os.environ.get("SPACES_ZERO_GPU", "0") == "1"
|
7 |
IS_SPACE = os.environ.get("SPACE_ID", None) is not None
|
8 |
|
9 |
-
|
10 |
#device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
11 |
#dtype = torch.float16
|
12 |
LOW_MEMORY = os.getenv("LOW_MEMORY", "0") == "1"
|
13 |
-
|
14 |
#print(f"Using dtype: {dtype}")
|
15 |
print(f"low memory: {LOW_MEMORY}")
|
16 |
|
@@ -18,7 +18,7 @@ device = "cuda"
|
|
18 |
model_name = "ruslanmv/Medical-Llama3-8B"
|
19 |
# Move model and tokenizer to the CUDA device
|
20 |
model = AutoModelForCausalLM.from_pretrained(model_name).to(device)
|
21 |
-
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
|
22 |
tokenizer.pad_token = tokenizer.eos_token
|
23 |
|
24 |
@spaces.GPU
|
|
|
6 |
IS_SPACES_ZERO = os.environ.get("SPACES_ZERO_GPU", "0") == "1"
|
7 |
IS_SPACE = os.environ.get("SPACE_ID", None) is not None
|
8 |
|
9 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
10 |
#device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
11 |
#dtype = torch.float16
|
12 |
LOW_MEMORY = os.getenv("LOW_MEMORY", "0") == "1"
|
13 |
+
print(f"Using device: {device}")
|
14 |
#print(f"Using dtype: {dtype}")
|
15 |
print(f"low memory: {LOW_MEMORY}")
|
16 |
|
|
|
18 |
model_name = "ruslanmv/Medical-Llama3-8B"
|
19 |
# Move model and tokenizer to the CUDA device
|
20 |
model = AutoModelForCausalLM.from_pretrained(model_name).to(device)
|
21 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
|
22 |
tokenizer.pad_token = tokenizer.eos_token
|
23 |
|
24 |
@spaces.GPU
|