LPX55 commited on
Commit
d944e21
·
verified ·
1 Parent(s): d836b5b

Update mini.py

Browse files
Files changed (1) hide show
  1. mini.py +8 -7
mini.py CHANGED
@@ -133,10 +133,7 @@ pipeline = FluxPipeline(
133
  text_encoder=text_encoder,
134
  tokenizer=tokenizer,
135
  )
136
- # Move Qwen2VL models to GPU
137
- logger.info("Moving Qwen2VL models to GPU...")
138
- qwen2vl.to(DEVICE)
139
- connector.to(DEVICE)
140
 
141
  # # Move Transformer and VAE to GPU
142
  # logger.info("Moving Transformer and VAE to GPU...")
@@ -150,7 +147,11 @@ connector.to(DEVICE)
150
  def process_image(image):
151
  """Process image with Qwen2VL model"""
152
  try:
153
-
 
 
 
 
154
  message = [
155
  {
156
  "role": "user",
@@ -181,8 +182,8 @@ def process_image(image):
181
  result = (image_hidden_state.cpu(), image_grid_thw)
182
 
183
  # Move models back to CPU
184
- # qwen2vl.cpu()
185
- # connector.cpu()
186
  torch.cuda.empty_cache()
187
 
188
  return result
 
133
  text_encoder=text_encoder,
134
  tokenizer=tokenizer,
135
  )
136
+
 
 
 
137
 
138
  # # Move Transformer and VAE to GPU
139
  # logger.info("Moving Transformer and VAE to GPU...")
 
147
  def process_image(image):
148
  """Process image with Qwen2VL model"""
149
  try:
150
+ # Move Qwen2VL models to GPU
151
+ logger.info("Moving Qwen2VL models to GPU...")
152
+ qwen2vl.to(DEVICE)
153
+ connector.to(DEVICE)
154
+
155
  message = [
156
  {
157
  "role": "user",
 
182
  result = (image_hidden_state.cpu(), image_grid_thw)
183
 
184
  # Move models back to CPU
185
+ qwen2vl.cpu()
186
+ connector.cpu()
187
  torch.cuda.empty_cache()
188
 
189
  return result