BestWishYsh commited on
Commit
b82463b
1 Parent(s): 4d65360

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -1
app.py CHANGED
@@ -125,7 +125,12 @@ class MagicTimeController:
125
  self.vae.load_state_dict(converted_vae_checkpoint)
126
 
127
  if self.unet is not None:
128
- del self.unet # 删除旧模型的引用
 
 
 
 
 
129
  torch.cuda.empty_cache()
130
  converted_unet_checkpoint = convert_ldm_unet_checkpoint(dreambooth_state_dict, self.unet_model.config)
131
  self.unet = copy.deepcopy(self.unet_model)
@@ -134,6 +139,11 @@ class MagicTimeController:
134
  if self.text_encoder is not None:
135
  del self.text_encoder
136
  torch.cuda.empty_cache()
 
 
 
 
 
137
  text_model = copy.deepcopy(self.text_model)
138
  self.text_encoder = convert_ldm_clip_text_model(text_model, dreambooth_state_dict)
139
 
 
125
  self.vae.load_state_dict(converted_vae_checkpoint)
126
 
127
  if self.unet is not None:
128
+ del self.unet
129
+ torch.cuda.empty_cache()
130
+ torch.cuda.empty_cache()
131
+ torch.cuda.empty_cache()
132
+ torch.cuda.empty_cache()
133
+ torch.cuda.empty_cache()
134
  torch.cuda.empty_cache()
135
  converted_unet_checkpoint = convert_ldm_unet_checkpoint(dreambooth_state_dict, self.unet_model.config)
136
  self.unet = copy.deepcopy(self.unet_model)
 
139
  if self.text_encoder is not None:
140
  del self.text_encoder
141
  torch.cuda.empty_cache()
142
+ torch.cuda.empty_cache()
143
+ torch.cuda.empty_cache()
144
+ torch.cuda.empty_cache()
145
+ torch.cuda.empty_cache()
146
+ torch.cuda.empty_cache()
147
  text_model = copy.deepcopy(self.text_model)
148
  self.text_encoder = convert_ldm_clip_text_model(text_model, dreambooth_state_dict)
149