wangfuyun commited on
Commit
f531c2f
·
verified ·
1 Parent(s): 619e2e5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -112,6 +112,7 @@ class AnimateController:
112
  motion_module_dropdown, map_location="cpu")
113
  missing, unexpected = self.unet.load_state_dict(
114
  motion_module_state_dict, strict=False)
 
115
  assert len(unexpected) == 0
116
  return gr.Dropdown.update()
117
 
@@ -134,6 +135,9 @@ class AnimateController:
134
  converted_unet_checkpoint = convert_ldm_unet_checkpoint(
135
  base_model_state_dict, self.unet.config)
136
  self.unet.load_state_dict(converted_unet_checkpoint, strict=False)
 
 
 
137
 
138
  # self.text_encoder = convert_ldm_clip_checkpoint(base_model_state_dict)
139
  return gr.Dropdown.update()
@@ -174,7 +178,7 @@ class AnimateController:
174
  **OmegaConf.to_container(self.inference_config.noise_scheduler_kwargs))
175
  ).to("cuda")
176
 
177
- original_state_dict = {k: v.cpu().clone() for k, v in pipeline.unet.state_dict().items()}
178
  pipeline.unet = convert_lcm_lora(pipeline.unet, self.lcm_lora_path, spatial_lora_slider)
179
 
180
  pipeline.to("cuda")
@@ -196,7 +200,7 @@ class AnimateController:
196
  video_length=length_slider,
197
  ).videos
198
 
199
- pipeline.unet.load_state_dict(original_state_dict)
200
  del original_state_dict
201
 
202
  save_sample_path = os.path.join(
 
112
  motion_module_dropdown, map_location="cpu")
113
  missing, unexpected = self.unet.load_state_dict(
114
  motion_module_state_dict, strict=False)
115
+ del motion_module_state_dict
116
  assert len(unexpected) == 0
117
  return gr.Dropdown.update()
118
 
 
135
  converted_unet_checkpoint = convert_ldm_unet_checkpoint(
136
  base_model_state_dict, self.unet.config)
137
  self.unet.load_state_dict(converted_unet_checkpoint, strict=False)
138
+ del converted_unet_checkpoint
139
+ del converted_vae_checkpoint
140
+ del base_model_state_dict
141
 
142
  # self.text_encoder = convert_ldm_clip_checkpoint(base_model_state_dict)
143
  return gr.Dropdown.update()
 
178
  **OmegaConf.to_container(self.inference_config.noise_scheduler_kwargs))
179
  ).to("cuda")
180
 
181
+ original_state_dict = {k: v.cpu().clone() for k, v in pipeline.unet.state_dict().items() if "motion_modules." not in k}
182
  pipeline.unet = convert_lcm_lora(pipeline.unet, self.lcm_lora_path, spatial_lora_slider)
183
 
184
  pipeline.to("cuda")
 
200
  video_length=length_slider,
201
  ).videos
202
 
203
+ pipeline.unet.load_state_dict(original_state_dict,strict=False)
204
  del original_state_dict
205
 
206
  save_sample_path = os.path.join(