rahul7star commited on
Commit
2ad4e90
·
verified ·
1 Parent(s): b38166b

Working version of wan2.1 diffuser - use this as benchmark

Browse files
Files changed (1) hide show
  1. app.py +11 -9
app.py CHANGED
@@ -9,7 +9,6 @@ from diffusers.schedulers.scheduling_unipc_multistep import UniPCMultistepSchedu
9
  from diffusers.schedulers.scheduling_flow_match_euler_discrete import FlowMatchEulerDiscreteScheduler
10
  from huggingface_hub import hf_hub_download
11
  from lycoris import create_lycoris_from_weights
12
- from transformers import AutoConfig
13
 
14
  # Define model options
15
  MODEL_OPTIONS = {
@@ -70,12 +69,9 @@ def generate_video(
70
  seed = int(seed)
71
 
72
  torch.manual_seed(seed)
73
-
74
- # Load config from the model
75
- config = AutoConfig.from_pretrained(model_id)
76
 
77
- vae = AutoencoderKLWan.from_pretrained(model_id, subfolder="vae", config=config, torch_dtype=torch.float32)
78
- pipe = WanPipeline.from_pretrained(model_id, vae=vae, config=config, torch_dtype=torch.float16)
79
 
80
  if scheduler_type == "UniPCMultistepScheduler":
81
  pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config, flow_shift=flow_shift)
@@ -226,7 +222,7 @@ with gr.Blocks() as demo:
226
 
227
  generate_btn.click(
228
  fn=generate_video,
229
- inputs=[
230
  model_choice,
231
  prompt,
232
  negative_prompt,
@@ -246,6 +242,12 @@ with gr.Blocks() as demo:
246
  outputs=[output_video, used_seed]
247
  )
248
 
249
- gr.Markdown(""" ## Tips for best results: - Smaller videos: Flow shift 2.0–5.0 - Larger videos: Flow shift 7.0–12.0 - Use frame count in 4k+1 form (e.g., 33, 65) - Limit frame count and resolution to avoid timeout """)
 
 
 
 
 
 
250
 
251
- demo.launch()
 
9
  from diffusers.schedulers.scheduling_flow_match_euler_discrete import FlowMatchEulerDiscreteScheduler
10
  from huggingface_hub import hf_hub_download
11
  from lycoris import create_lycoris_from_weights
 
12
 
13
  # Define model options
14
  MODEL_OPTIONS = {
 
69
  seed = int(seed)
70
 
71
  torch.manual_seed(seed)
 
 
 
72
 
73
+ vae = AutoencoderKLWan.from_pretrained(model_id, subfolder="vae", torch_dtype=torch.float32)
74
+ pipe = WanPipeline.from_pretrained(model_id, vae=vae, torch_dtype=torch.float16)
75
 
76
  if scheduler_type == "UniPCMultistepScheduler":
77
  pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config, flow_shift=flow_shift)
 
222
 
223
  generate_btn.click(
224
  fn=generate_video,
225
+ inputs=[
226
  model_choice,
227
  prompt,
228
  negative_prompt,
 
242
  outputs=[output_video, used_seed]
243
  )
244
 
245
+ gr.Markdown("""
246
+ ## Tips for best results:
247
+ - Smaller videos: Flow shift 2.0–5.0
248
+ - Larger videos: Flow shift 7.0–12.0
249
+ - Use frame count in 4k+1 form (e.g., 33, 65)
250
+ - Limit frame count and resolution to avoid timeout
251
+ """)
252
 
253
+ demo.launch()