AlekseyCalvin commited on
Commit
6ff3b9f
·
verified ·
1 Parent(s): 3c0f6c1

Update app_fast.py

Browse files
Files changed (1) hide show
  1. app_fast.py +5 -3
app_fast.py CHANGED
@@ -2,7 +2,7 @@ import spaces
2
  import torch
3
  from diffusers import AutoencoderKLWan, WanPipeline, WanImageToVideoPipeline, UniPCMultistepScheduler
4
  from diffusers.utils import export_to_video
5
- from diffusers.hooks import apply_first_block_cache, FirstBlockCacheConfig
6
  import gradio as gr
7
  import tempfile
8
  from huggingface_hub import hf_hub_download
@@ -12,19 +12,21 @@ import random
12
 
13
  MODEL_ID = "FastVideo/FastWan2.2-TI2V-5B-FullAttn-Diffusers"
14
  vae = AutoencoderKLWan.from_pretrained(MODEL_ID, subfolder="vae", torch_dtype=torch.float32)
15
- #vae = AutoencoderKLWan.from_pretrained("Kijai/WanVideo_comfy", filename="Wan2_2_VAE_bf16.safetensors", torch_dtype=torch.bfloat16)
16
 
17
  # Initialize pipelines
18
  text_to_video_pipe = WanPipeline.from_pretrained(MODEL_ID, vae=vae, torch_dtype=torch.bfloat16)
19
  image_to_video_pipe = WanImageToVideoPipeline.from_pretrained(MODEL_ID, vae=vae, torch_dtype=torch.bfloat16)
20
 
21
- #apply_first_block_cache(pipe.transformer, FirstBlockCacheConfig(threshold=0.2))
22
 
23
  for pipe in [text_to_video_pipe, image_to_video_pipe]:
24
  pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config, flow_shift=5.0)
25
  pipe.to("cuda")
 
26
  ##Lora testing
 
27
  # LORA_REPO_ID = "JERRYNPC/WAN2.2-LORA-NSFW"
 
 
28
  # LORA_FILENAME= "jerry_HIGH-nsfw-V10E800.safetensors"
29
 
30
  # causvid_path = hf_hub_download(repo_id=LORA_REPO_ID, filename=LORA_FILENAME)
 
2
  import torch
3
  from diffusers import AutoencoderKLWan, WanPipeline, WanImageToVideoPipeline, UniPCMultistepScheduler
4
  from diffusers.utils import export_to_video
5
+ #from diffusers.hooks import apply_first_block_cache, FirstBlockCacheConfig
6
  import gradio as gr
7
  import tempfile
8
  from huggingface_hub import hf_hub_download
 
12
 
13
  MODEL_ID = "FastVideo/FastWan2.2-TI2V-5B-FullAttn-Diffusers"
14
  vae = AutoencoderKLWan.from_pretrained(MODEL_ID, subfolder="vae", torch_dtype=torch.float32)
 
15
 
16
  # Initialize pipelines
17
  text_to_video_pipe = WanPipeline.from_pretrained(MODEL_ID, vae=vae, torch_dtype=torch.bfloat16)
18
  image_to_video_pipe = WanImageToVideoPipeline.from_pretrained(MODEL_ID, vae=vae, torch_dtype=torch.bfloat16)
19
 
 
20
 
21
  for pipe in [text_to_video_pipe, image_to_video_pipe]:
22
  pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config, flow_shift=5.0)
23
  pipe.to("cuda")
24
+
25
  ##Lora testing
26
+ #vae = AutoencoderKLWan.from_pretrained("Kijai/WanVideo_comfy", filename="Wan2_2_VAE_bf16.safetensors", torch_dtype=torch.bfloat16)
27
  # LORA_REPO_ID = "JERRYNPC/WAN2.2-LORA-NSFW"
28
+ #apply_first_block_cache(pipe.transformer, FirstBlockCacheConfig(threshold=0.2))
29
+
30
  # LORA_FILENAME= "jerry_HIGH-nsfw-V10E800.safetensors"
31
 
32
  # causvid_path = hf_hub_download(repo_id=LORA_REPO_ID, filename=LORA_FILENAME)