fffiloni commited on
Commit
1034c70
·
verified ·
1 Parent(s): 9e2834e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -150,9 +150,15 @@ models_rbm.generator.eval().requires_grad_(False)
150
 
151
  def infer(style_description, ref_style_file, caption):
152
  try:
153
- # Ensure all models are moved back to the correct device
154
- models_rbm.to(device)
155
- models_b.to(device)
 
 
 
 
 
 
156
 
157
  clear_gpu_cache() # Clear cache before inference
158
 
 
150
 
151
  def infer(style_description, ref_style_file, caption):
152
  try:
153
+ # Instead of trying to move the entire models_rbm object, move individual components
154
+ models_rbm.effnet.to(device)
155
+ models_rbm.previewer.to(device)
156
+ models_rbm.generator.to(device)
157
+ models_rbm.text_model.to(device)
158
+
159
+ # For models_b, we need to move its components as well
160
+ models_b.generator.to(device)
161
+ models_b.stage_a.to(device)
162
 
163
  clear_gpu_cache() # Clear cache before inference
164