Spaces:
Runtime error
Runtime error
Faisal
commited on
Commit
Β·
04d4545
1
Parent(s):
e55901c
Restore GPU version - remove CPU optimizations and restore GPU-compatible dependencies
Browse files- app.py +3 -5
- requirements.txt +13 -28
app.py
CHANGED
|
@@ -15,15 +15,13 @@ print(f"Using device: {device}")
|
|
| 15 |
|
| 16 |
model = Qwen2VLForConditionalGeneration.from_pretrained(
|
| 17 |
MODEL_PATH,
|
| 18 |
-
torch_dtype=torch.
|
| 19 |
-
device_map="auto"
|
| 20 |
-
low_cpu_mem_usage=True if device == "cpu" else False,
|
| 21 |
)
|
| 22 |
processor = AutoProcessor.from_pretrained(MODEL_PATH)
|
| 23 |
|
| 24 |
# Move model to device
|
| 25 |
-
|
| 26 |
-
model = model.to(device)
|
| 27 |
|
| 28 |
temp_generation_config = GenerationConfig(
|
| 29 |
max_new_tokens=1024,
|
|
|
|
| 15 |
|
| 16 |
model = Qwen2VLForConditionalGeneration.from_pretrained(
|
| 17 |
MODEL_PATH,
|
| 18 |
+
torch_dtype=torch.bfloat16,
|
| 19 |
+
device_map="auto",
|
|
|
|
| 20 |
)
|
| 21 |
processor = AutoProcessor.from_pretrained(MODEL_PATH)
|
| 22 |
|
| 23 |
# Move model to device
|
| 24 |
+
model = model.to(device)
|
|
|
|
| 25 |
|
| 26 |
temp_generation_config = GenerationConfig(
|
| 27 |
max_new_tokens=1024,
|
requirements.txt
CHANGED
|
@@ -1,28 +1,13 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
# qwen-vl-utils
|
| 15 |
-
# ipython>=8.0.0
|
| 16 |
-
# Core dependencies
|
| 17 |
-
torch>=2.1.0
|
| 18 |
-
transformers>=4.41.0
|
| 19 |
-
accelerate>=0.31.0
|
| 20 |
-
gradio>=4.29.0
|
| 21 |
-
requests
|
| 22 |
-
|
| 23 |
-
# Qwen VL utilities
|
| 24 |
-
git+https://github.com/QwenLM/Qwen-VL.git
|
| 25 |
-
|
| 26 |
-
# Optional but recommended for HF Spaces stability
|
| 27 |
-
sentencepiece
|
| 28 |
-
protobuf
|
|
|
|
| 1 |
+
gradio==5.42.0
|
| 2 |
+
transformers>=4.40.0
|
| 3 |
+
torch>=2.0.0
|
| 4 |
+
torchvision>=0.15.0
|
| 5 |
+
requests>=2.31.0
|
| 6 |
+
Pillow>=10.0.0
|
| 7 |
+
accelerate>=0.20.0
|
| 8 |
+
safetensors>=0.3.0
|
| 9 |
+
tokenizers>=0.15.0
|
| 10 |
+
numpy>=1.24.0
|
| 11 |
+
scipy>=1.10.0
|
| 12 |
+
qwen-vl-utils
|
| 13 |
+
ipython>=8.0.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|