John Ho commited on
Commit
a83f12f
·
1 Parent(s): a7fd61f

trying to load model and processors outside space decorator

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -98,6 +98,10 @@ def load_processor(model_name="Qwen/Qwen2.5-VL-7B-Instruct"):
98
  )
99
 
100
 
 
 
 
 
101
  @spaces.GPU(duration=120)
102
  def inference(
103
  video_path: str,
@@ -106,10 +110,11 @@ def inference(
106
  apply_quantization: bool = True,
107
  ):
108
  # default processor
109
- processor = load_processor()
110
- model = load_model(
111
- use_flash_attention=use_flash_attention, apply_quantization=apply_quantization
112
- )
 
113
 
114
  # The model is trained on 8.0 FPS which we recommend for optimal inference
115
  fps = get_fps_ffmpeg(video_path)
 
98
  )
99
 
100
 
101
+ MODEL = load_model(use_flash_attention=False, apply_quantization=False)
102
+ PROCESSOR = load_processor()
103
+
104
+
105
  @spaces.GPU(duration=120)
106
  def inference(
107
  video_path: str,
 
110
  apply_quantization: bool = True,
111
  ):
112
  # default processor
113
+ processor, model = PROCESSOR, MODEL
114
+ # processor = load_processor()
115
+ # model = load_model(
116
+ # use_flash_attention=use_flash_attention, apply_quantization=apply_quantization
117
+ # )
118
 
119
  # The model is trained on 8.0 FPS which we recommend for optimal inference
120
  fps = get_fps_ffmpeg(video_path)