tttoaster commited on
Commit
95e1d4d
1 Parent(s): ddca281

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -166,7 +166,7 @@ class LLMService:
166
 
167
  self.sd_adapter.init_pipe(vae=vae,
168
  scheduler=noise_scheduler,
169
- visual_encoder=self.visual_encoder.to("cpu"),
170
  image_transform=self.image_transform,
171
  discrete_model=None,
172
  dtype=self.dtype,
@@ -337,7 +337,7 @@ def generate(text_list, image_list, max_new_tokens, force_boi, force_bbox):
337
  if output['has_img_output']:
338
  print('loading visual encoder and llm to CPU, and sd to GPU')
339
  a = time.time()
340
- service.agent = service.agent.to("cpu")
341
  service.sd_adapter = service.sd_adapter.to(service.vit_sd_device, dtype=service.dtype)
342
  print("Loading finished: ", time.time() - a)
343
 
@@ -351,7 +351,7 @@ def generate(text_list, image_list, max_new_tokens, force_boi, force_bbox):
351
 
352
  print('loading visual encoder and llm to GPU, and sd to CPU')
353
  a = time.time()
354
- service.sd_adapter = service.sd_adapter.to("cpu")
355
  service.visual_encoder = service.visual_encoder.to(service.vit_sd_device, dtype=service.dtype)
356
  service.agent = service.agent.to(service.vit_sd_device, dtype=service.dtype)
357
  print("Loading finished: ", time.time() - a)
 
166
 
167
  self.sd_adapter.init_pipe(vae=vae,
168
  scheduler=noise_scheduler,
169
+ visual_encoder=self.visual_encoder.cpu(),
170
  image_transform=self.image_transform,
171
  discrete_model=None,
172
  dtype=self.dtype,
 
337
  if output['has_img_output']:
338
  print('loading visual encoder and llm to CPU, and sd to GPU')
339
  a = time.time()
340
+ service.agent = service.agent.cpu()
341
  service.sd_adapter = service.sd_adapter.to(service.vit_sd_device, dtype=service.dtype)
342
  print("Loading finished: ", time.time() - a)
343
 
 
351
 
352
  print('loading visual encoder and llm to GPU, and sd to CPU')
353
  a = time.time()
354
+ service.sd_adapter = service.sd_adapter.cpu()
355
  service.visual_encoder = service.visual_encoder.to(service.vit_sd_device, dtype=service.dtype)
356
  service.agent = service.agent.to(service.vit_sd_device, dtype=service.dtype)
357
  print("Loading finished: ", time.time() - a)