Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,7 +18,7 @@ import tensorflow as tf # Or from keras.utils import load_img, img_to_array
|
|
| 18 |
import threading
|
| 19 |
import subprocess
|
| 20 |
from ultralytics.nn.tasks import DetectionModel
|
| 21 |
-
torch.serialization.add_safe_globals([DetectionModel])
|
| 22 |
|
| 23 |
from io import BytesIO
|
| 24 |
import glob
|
|
@@ -28,9 +28,11 @@ import gradio as gr
|
|
| 28 |
|
| 29 |
# IMPORTING MODELS
|
| 30 |
description_model = "llava-hf/bakLlava-v1-hf"
|
|
|
|
|
|
|
| 31 |
llava_model = LlavaForConditionalGeneration.from_pretrained(
|
| 32 |
description_model,
|
| 33 |
-
|
| 34 |
low_cpu_mem_usage=True,
|
| 35 |
load_in_4bit=True
|
| 36 |
)
|
|
|
|
| 18 |
import threading
|
| 19 |
import subprocess
|
| 20 |
from ultralytics.nn.tasks import DetectionModel
|
| 21 |
+
torch.serialization.add_safe_globals([DetectionModel, Sequential])
|
| 22 |
|
| 23 |
from io import BytesIO
|
| 24 |
import glob
|
|
|
|
| 28 |
|
| 29 |
# IMPORTING MODELS
|
| 30 |
description_model = "llava-hf/bakLlava-v1-hf"
|
| 31 |
+
print(f"Loading vision model: {description_model} (this should be much faster)...")
|
| 32 |
+
|
| 33 |
llava_model = LlavaForConditionalGeneration.from_pretrained(
|
| 34 |
description_model,
|
| 35 |
+
dtype=torch.float16,
|
| 36 |
low_cpu_mem_usage=True,
|
| 37 |
load_in_4bit=True
|
| 38 |
)
|