Spaces:
Sleeping
Sleeping
Factor Studios
commited on
Update test_ai_integration.py
Browse files- test_ai_integration.py +6 -6
test_ai_integration.py
CHANGED
|
@@ -158,21 +158,21 @@ def test_ai_integration():
|
|
| 158 |
})
|
| 159 |
|
| 160 |
# Load BLIP-2 Large model directly to WebSocket storage
|
| 161 |
-
from transformers import
|
| 162 |
-
model_id = "
|
| 163 |
print(f"Loading model {model_id} directly to WebSocket storage...")
|
| 164 |
|
| 165 |
try:
|
| 166 |
# Load model and processor with proper error handling
|
| 167 |
-
model =
|
| 168 |
-
model_id,
|
| 169 |
trust_remote_code=True,
|
| 170 |
device_map="auto", # Allow automatic device mapping
|
| 171 |
torch_dtype="auto" # Use appropriate dtype
|
| 172 |
)
|
| 173 |
|
| 174 |
-
processor =
|
| 175 |
-
model_id,
|
| 176 |
trust_remote_code=True
|
| 177 |
)
|
| 178 |
|
|
|
|
| 158 |
})
|
| 159 |
|
| 160 |
# Load BLIP-2 Large model directly to WebSocket storage
|
| 161 |
+
from transformers import Blip2ForConditionalGeneration, Blip2Processor
|
| 162 |
+
model_id = "Salesforce/blip2-opt-2.7b"
|
| 163 |
print(f"Loading model {model_id} directly to WebSocket storage...")
|
| 164 |
|
| 165 |
try:
|
| 166 |
# Load model and processor with proper error handling
|
| 167 |
+
model = Blip2ForConditionalGeneration.from_pretrained(
|
| 168 |
+
model_id,
|
| 169 |
trust_remote_code=True,
|
| 170 |
device_map="auto", # Allow automatic device mapping
|
| 171 |
torch_dtype="auto" # Use appropriate dtype
|
| 172 |
)
|
| 173 |
|
| 174 |
+
processor = Blip2Processor.from_pretrained(
|
| 175 |
+
model_id,
|
| 176 |
trust_remote_code=True
|
| 177 |
)
|
| 178 |
|