Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -47,18 +47,17 @@ ocr_model = ocr_predictor(
|
|
47 |
|
48 |
|
49 |
if torch.cuda.is_available():
|
50 |
-
# Load the processor
|
51 |
processor = LlavaNextProcessor.from_pretrained("llava-hf/llava-v1.6-mistral-7b-hf")
|
|
|
|
|
52 |
vision_model = LlavaNextForConditionalGeneration.from_pretrained(
|
53 |
"llava-hf/llava-v1.6-mistral-7b-hf",
|
54 |
torch_dtype=torch.float16,
|
55 |
low_cpu_mem_usage=True,
|
56 |
load_in_4bit=True,
|
57 |
-
)
|
58 |
|
59 |
-
# Move the processor and model to the GPU
|
60 |
-
processor = processor.to("cuda")
|
61 |
-
vision_model = vision_model.to("cuda")
|
62 |
|
63 |
|
64 |
|
|
|
47 |
|
48 |
|
49 |
if torch.cuda.is_available():
|
50 |
+
# Load the processor (no need to move to GPU)
|
51 |
processor = LlavaNextProcessor.from_pretrained("llava-hf/llava-v1.6-mistral-7b-hf")
|
52 |
+
|
53 |
+
# Load the model and move it to GPU
|
54 |
vision_model = LlavaNextForConditionalGeneration.from_pretrained(
|
55 |
"llava-hf/llava-v1.6-mistral-7b-hf",
|
56 |
torch_dtype=torch.float16,
|
57 |
low_cpu_mem_usage=True,
|
58 |
load_in_4bit=True,
|
59 |
+
).to("cuda") # Move the model to GPU
|
60 |
|
|
|
|
|
|
|
61 |
|
62 |
|
63 |
|