zamal commited on
Commit
a1d5791
·
verified ·
1 Parent(s): 477e306

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -47,18 +47,17 @@ ocr_model = ocr_predictor(
47
 
48
 
49
  if torch.cuda.is_available():
50
- # Load the processor and model
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