EndlessSora commited on
Commit
b0fc42f
·
1 Parent(s): bfc302b

add model cpu offload

Browse files
Files changed (2) hide show
  1. app.py +1 -1
  2. pipelines/pipeline_infu_flux.py +2 -1
app.py CHANGED
@@ -105,7 +105,7 @@ def prepare_pipeline(model_version, enable_realism, enable_anti_blur):
105
  return pipeline
106
 
107
 
108
- # @spaces.GPU
109
  def generate_image(
110
  input_image,
111
  control_image,
 
105
  return pipeline
106
 
107
 
108
+ @spaces.GPU
109
  def generate_image(
110
  input_image,
111
  control_image,
pipelines/pipeline_infu_flux.py CHANGED
@@ -167,7 +167,8 @@ class InfUFluxPipeline:
167
  'After that, run the code again. If you have downloaded it, please use `base_model_path` to specify the correct path.')
168
  print('\nIf you are using other models, please download them to a local directory and use `base_model_path` to specify the correct path.')
169
  exit()
170
- pipe.to('cuda', torch.bfloat16)
 
171
  self.pipe = pipe
172
 
173
  # Load image proj model
 
167
  'After that, run the code again. If you have downloaded it, please use `base_model_path` to specify the correct path.')
168
  print('\nIf you are using other models, please download them to a local directory and use `base_model_path` to specify the correct path.')
169
  exit()
170
+ # pipe.to('cuda', torch.bfloat16)
171
+ pipe.enable_model_cpu_offload()
172
  self.pipe = pipe
173
 
174
  # Load image proj model