afnotes commited on
Commit
23342bb
·
1 Parent(s): e93f31c

Added spaces.GPU (correction)

Browse files
Files changed (1) hide show
  1. app.py +1 -12
app.py CHANGED
@@ -10,20 +10,9 @@ import os
10
  BASE_MODEL_ID = "Qwen/Qwen3-4B"
11
  ADAPTER_MODEL_ID = "afnotes/Qwen3-4B-YeI-LoRA"
12
 
13
- @spaces.GPU
14
- # Add this GPU check here at the module level
15
- if not torch.cuda.is_available():
16
- print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
17
- print("WARNING: CUDA (GPU) is NOT available on this Space instance.")
18
- print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
19
- # We will attempt to load on CPU if GPU is not available for now.
20
- device_to_load = "cpu"
21
- else:
22
- print(f"CUDA is available! PyTorch detected GPU: {torch.cuda.get_device_name(0)}")
23
- device_to_load = "cuda"
24
-
25
  # --- Model Loading (Optimized for Space) ---
26
  # This function will be called once when the app starts
 
27
  def load_model():
28
  print(f"Loading tokenizer from: {ADAPTER_MODEL_ID}")
29
  tokenizer = AutoTokenizer.from_pretrained(ADAPTER_MODEL_ID)
 
10
  BASE_MODEL_ID = "Qwen/Qwen3-4B"
11
  ADAPTER_MODEL_ID = "afnotes/Qwen3-4B-YeI-LoRA"
12
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  # --- Model Loading (Optimized for Space) ---
14
  # This function will be called once when the app starts
15
+ @spaces.GPU
16
  def load_model():
17
  print(f"Loading tokenizer from: {ADAPTER_MODEL_ID}")
18
  tokenizer = AutoTokenizer.from_pretrained(ADAPTER_MODEL_ID)