Faisal commited on
Commit
04d4545
Β·
1 Parent(s): e55901c

Restore GPU version - remove CPU optimizations and restore GPU-compatible dependencies

Browse files
Files changed (2) hide show
  1. app.py +3 -5
  2. 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.float32 if device == "cpu" else torch.bfloat16,
19
- device_map="auto" if device == "cuda" else None,
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
- if device == "cpu":
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
- # gradio==5.42.0
2
- # transformers==4.36.0
3
- # --find-links https://download.pytorch.org/whl/torch_stable.html
4
- # torch==2.1.0+cpu
5
- # torchvision==0.16.0+cpu
6
- # torchaudio==2.1.0+cpu
7
- # requests>=2.31.0
8
- # Pillow>=10.0.0
9
- # accelerate>=0.20.0
10
- # safetensors>=0.3.0
11
- # tokenizers>=0.15.0
12
- # numpy<2.0.0
13
- # scipy>=1.10.0
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