yijin928 commited on
Commit
277dff6
·
verified ·
1 Parent(s): 8972c51

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +65 -65
app.py CHANGED
@@ -142,45 +142,45 @@ def import_custom_nodes() -> None:
142
  from nodes import NODE_CLASS_MAPPINGS
143
 
144
  #TO be added to "model_loaders" as it loads a model
145
- downloadandloadcogvideomodel = NODE_CLASS_MAPPINGS[
146
- "DownloadAndLoadCogVideoModel"
147
- ]()
148
- downloadandloadcogvideomodel_1 = downloadandloadcogvideomodel.loadmodel(
149
- model="THUDM/CogVideoX-5b",
150
- precision="bf16",
151
- quantization="disabled",
152
- enable_sequential_cpu_offload=True,
153
- attention_mode="sdpa",
154
- load_device="main_device",
155
- )
156
- loadimage = NODE_CLASS_MAPPINGS["LoadImage"]()
157
- cliploader = NODE_CLASS_MAPPINGS["CLIPLoader"]()
158
- cliploader_20 = cliploader.load_clip(
159
- clip_name="t5/google_t5-v1_1-xxl_encoderonly-fp8_e4m3fn.safetensors",
160
- type="sd3",
161
- device="default",
162
- )
163
- emptylatentimage = NODE_CLASS_MAPPINGS["EmptyLatentImage"]()
164
-
165
- cogvideotextencode = NODE_CLASS_MAPPINGS["CogVideoTextEncode"]()
166
- cogvideosampler = NODE_CLASS_MAPPINGS["CogVideoSampler"]()
167
- cogvideodecode = NODE_CLASS_MAPPINGS["CogVideoDecode"]()
168
- reactorfaceswap = NODE_CLASS_MAPPINGS["ReActorFaceSwap"]()
169
- cr_upscale_image = NODE_CLASS_MAPPINGS["CR Upscale Image"]()
170
- vhs_videocombine = NODE_CLASS_MAPPINGS["VHS_VideoCombine"]()
171
-
172
- #Add all the models that load a safetensors file
173
- model_loaders = [downloadandloadcogvideomodel_1, cliploader_20]
174
-
175
- # Check which models are valid and how to best load them
176
- valid_models = [
177
- getattr(loader[0], 'patcher', loader[0])
178
- for loader in model_loaders
179
- if not isinstance(loader[0], dict) and not isinstance(getattr(loader[0], 'patcher', None), dict)
180
- ]
181
-
182
- #Finally loads the models
183
- model_management.load_models_gpu(valid_models)
184
 
185
  #Run ComfyUI Workflow
186
  @spaces.GPU(duration=60)
@@ -192,39 +192,39 @@ def generate_video(positive_prompt, num_frames, input_image):
192
 
193
  import_custom_nodes()
194
  with torch.inference_mode():
195
- # downloadandloadcogvideomodel = NODE_CLASS_MAPPINGS[
196
- # "DownloadAndLoadCogVideoModel"
197
- # ]()
198
- # downloadandloadcogvideomodel_1 = downloadandloadcogvideomodel.loadmodel(
199
- # model="THUDM/CogVideoX-5b",
200
- # precision="bf16",
201
- # quantization="disabled",
202
- # enable_sequential_cpu_offload=True,
203
- # attention_mode="sdpa",
204
- # load_device="main_device",
205
- # )
206
-
207
- # loadimage = NODE_CLASS_MAPPINGS["LoadImage"]()
208
  loadimage_8 = loadimage.load_image(image=input_image)
209
 
210
- # cliploader = NODE_CLASS_MAPPINGS["CLIPLoader"]()
211
- # cliploader_20 = cliploader.load_clip(
212
- # clip_name="t5/google_t5-v1_1-xxl_encoderonly-fp8_e4m3fn.safetensors",
213
- # type="sd3",
214
- # device="default",
215
- # )
216
 
217
- # emptylatentimage = NODE_CLASS_MAPPINGS["EmptyLatentImage"]()
218
  emptylatentimage_161 = emptylatentimage.generate(
219
  width=720, height=480, batch_size=1
220
  )
221
 
222
- # cogvideotextencode = NODE_CLASS_MAPPINGS["CogVideoTextEncode"]()
223
- # cogvideosampler = NODE_CLASS_MAPPINGS["CogVideoSampler"]()
224
- # cogvideodecode = NODE_CLASS_MAPPINGS["CogVideoDecode"]()
225
- # reactorfaceswap = NODE_CLASS_MAPPINGS["ReActorFaceSwap"]()
226
- # cr_upscale_image = NODE_CLASS_MAPPINGS["CR Upscale Image"]()
227
- # vhs_videocombine = NODE_CLASS_MAPPINGS["VHS_VideoCombine"]()
228
 
229
  for q in range(1):
230
  cogvideotextencode_30 = cogvideotextencode.process(
 
142
  from nodes import NODE_CLASS_MAPPINGS
143
 
144
  #TO be added to "model_loaders" as it loads a model
145
+ # downloadandloadcogvideomodel = NODE_CLASS_MAPPINGS[
146
+ # "DownloadAndLoadCogVideoModel"
147
+ # ]()
148
+ # downloadandloadcogvideomodel_1 = downloadandloadcogvideomodel.loadmodel(
149
+ # model="THUDM/CogVideoX-5b",
150
+ # precision="bf16",
151
+ # quantization="disabled",
152
+ # enable_sequential_cpu_offload=True,
153
+ # attention_mode="sdpa",
154
+ # load_device="main_device",
155
+ # )
156
+ # loadimage = NODE_CLASS_MAPPINGS["LoadImage"]()
157
+ # cliploader = NODE_CLASS_MAPPINGS["CLIPLoader"]()
158
+ # cliploader_20 = cliploader.load_clip(
159
+ # clip_name="t5/google_t5-v1_1-xxl_encoderonly-fp8_e4m3fn.safetensors",
160
+ # type="sd3",
161
+ # device="default",
162
+ # )
163
+ # emptylatentimage = NODE_CLASS_MAPPINGS["EmptyLatentImage"]()
164
+
165
+ # cogvideotextencode = NODE_CLASS_MAPPINGS["CogVideoTextEncode"]()
166
+ # cogvideosampler = NODE_CLASS_MAPPINGS["CogVideoSampler"]()
167
+ # cogvideodecode = NODE_CLASS_MAPPINGS["CogVideoDecode"]()
168
+ # reactorfaceswap = NODE_CLASS_MAPPINGS["ReActorFaceSwap"]()
169
+ # cr_upscale_image = NODE_CLASS_MAPPINGS["CR Upscale Image"]()
170
+ # vhs_videocombine = NODE_CLASS_MAPPINGS["VHS_VideoCombine"]()
171
+
172
+ # #Add all the models that load a safetensors file
173
+ # model_loaders = [downloadandloadcogvideomodel_1, cliploader_20]
174
+
175
+ # # Check which models are valid and how to best load them
176
+ # valid_models = [
177
+ # getattr(loader[0], 'patcher', loader[0])
178
+ # for loader in model_loaders
179
+ # if not isinstance(loader[0], dict) and not isinstance(getattr(loader[0], 'patcher', None), dict)
180
+ # ]
181
+
182
+ # #Finally loads the models
183
+ # model_management.load_models_gpu(valid_models)
184
 
185
  #Run ComfyUI Workflow
186
  @spaces.GPU(duration=60)
 
192
 
193
  import_custom_nodes()
194
  with torch.inference_mode():
195
+ downloadandloadcogvideomodel = NODE_CLASS_MAPPINGS[
196
+ "DownloadAndLoadCogVideoModel"
197
+ ]()
198
+ downloadandloadcogvideomodel_1 = downloadandloadcogvideomodel.loadmodel(
199
+ model="THUDM/CogVideoX-5b",
200
+ precision="bf16",
201
+ quantization="disabled",
202
+ enable_sequential_cpu_offload="disabled",
203
+ attention_mode="sdpa",
204
+ load_device="main_device",
205
+ )
206
+
207
+ loadimage = NODE_CLASS_MAPPINGS["LoadImage"]()
208
  loadimage_8 = loadimage.load_image(image=input_image)
209
 
210
+ cliploader = NODE_CLASS_MAPPINGS["CLIPLoader"]()
211
+ cliploader_20 = cliploader.load_clip(
212
+ clip_name="t5/google_t5-v1_1-xxl_encoderonly-fp8_e4m3fn.safetensors",
213
+ type="sd3",
214
+ device="default",
215
+ )
216
 
217
+ emptylatentimage = NODE_CLASS_MAPPINGS["EmptyLatentImage"]()
218
  emptylatentimage_161 = emptylatentimage.generate(
219
  width=720, height=480, batch_size=1
220
  )
221
 
222
+ cogvideotextencode = NODE_CLASS_MAPPINGS["CogVideoTextEncode"]()
223
+ cogvideosampler = NODE_CLASS_MAPPINGS["CogVideoSampler"]()
224
+ cogvideodecode = NODE_CLASS_MAPPINGS["CogVideoDecode"]()
225
+ reactorfaceswap = NODE_CLASS_MAPPINGS["ReActorFaceSwap"]()
226
+ cr_upscale_image = NODE_CLASS_MAPPINGS["CR Upscale Image"]()
227
+ vhs_videocombine = NODE_CLASS_MAPPINGS["VHS_VideoCombine"]()
228
 
229
  for q in range(1):
230
  cogvideotextencode_30 = cogvideotextencode.process(