Update app.py
Browse files
app.py
CHANGED
@@ -9,13 +9,13 @@ import gradio as gr
|
|
9 |
import random
|
10 |
import numpy as np
|
11 |
|
12 |
-
device = torch.device("
|
13 |
|
14 |
def set_seed(seed_value=42):
|
15 |
random.seed(seed_value)
|
16 |
np.random.seed(seed_value)
|
17 |
torch.manual_seed(seed_value)
|
18 |
-
torch.cuda.manual_seed_all(seed_value)
|
19 |
|
20 |
torch.backends.cudnn.deterministic = True
|
21 |
torch.backends.cudnn.benchmark = False
|
@@ -28,7 +28,7 @@ model, tokenizer = FastVisionModel.from_pretrained(
|
|
28 |
use_gradient_checkpointing = "unsloth",
|
29 |
)
|
30 |
|
31 |
-
FastVisionModel.for_inference(model)
|
32 |
|
33 |
instruction = "You are an expert radiographer. Describe accurately what you see in this image."
|
34 |
|
@@ -46,7 +46,7 @@ def predict_radiology_description(image, temperature, use_top_p, top_p_value, us
|
|
46 |
input_text,
|
47 |
add_special_tokens=False,
|
48 |
return_tensors="pt",
|
49 |
-
).to(
|
50 |
|
51 |
text_streamer = TextStreamer(tokenizer, skip_prompt=True)
|
52 |
|
|
|
9 |
import random
|
10 |
import numpy as np
|
11 |
|
12 |
+
device = torch.device("cpu")
|
13 |
|
14 |
def set_seed(seed_value=42):
|
15 |
random.seed(seed_value)
|
16 |
np.random.seed(seed_value)
|
17 |
torch.manual_seed(seed_value)
|
18 |
+
#torch.cuda.manual_seed_all(seed_value)
|
19 |
|
20 |
torch.backends.cudnn.deterministic = True
|
21 |
torch.backends.cudnn.benchmark = False
|
|
|
28 |
use_gradient_checkpointing = "unsloth",
|
29 |
)
|
30 |
|
31 |
+
#FastVisionModel.for_inference(model)
|
32 |
|
33 |
instruction = "You are an expert radiographer. Describe accurately what you see in this image."
|
34 |
|
|
|
46 |
input_text,
|
47 |
add_special_tokens=False,
|
48 |
return_tensors="pt",
|
49 |
+
).to(device)
|
50 |
|
51 |
text_streamer = TextStreamer(tokenizer, skip_prompt=True)
|
52 |
|