ariG23498 HF Staff commited on
Commit
b6557b3
·
verified ·
1 Parent(s): da85327

Upload lightx2v_Wan2.2-Distill-Loras_0.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. lightx2v_Wan2.2-Distill-Loras_0.py +8 -2
lightx2v_Wan2.2-Distill-Loras_0.py CHANGED
@@ -4,8 +4,10 @@
4
  # "numpy",
5
  # "einops",
6
  # "pandas",
 
7
  # "protobuf",
8
  # "torch",
 
9
  # "torchvision",
10
  # "transformers",
11
  # "timm",
@@ -18,10 +20,12 @@
18
  # ///
19
 
20
  try:
 
21
  from diffusers import DiffusionPipeline
22
  from diffusers.utils import load_image, export_to_video
23
 
24
- pipe = DiffusionPipeline.from_pretrained("Wan-AI/Wan2.2-I2V-A14B")
 
25
  pipe.load_lora_weights("lightx2v/Wan2.2-Distill-Loras")
26
 
27
  prompt = "A man with short gray hair plays a red electric guitar."
@@ -43,10 +47,12 @@ except Exception as e:
43
  with open('lightx2v_Wan2.2-Distill-Loras_0.txt', 'a', encoding='utf-8') as f:
44
  import traceback
45
  f.write('''```CODE:
 
46
  from diffusers import DiffusionPipeline
47
  from diffusers.utils import load_image, export_to_video
48
 
49
- pipe = DiffusionPipeline.from_pretrained("Wan-AI/Wan2.2-I2V-A14B")
 
50
  pipe.load_lora_weights("lightx2v/Wan2.2-Distill-Loras")
51
 
52
  prompt = "A man with short gray hair plays a red electric guitar."
 
4
  # "numpy",
5
  # "einops",
6
  # "pandas",
7
+ # "matplotlib",
8
  # "protobuf",
9
  # "torch",
10
+ # "sentencepiece",
11
  # "torchvision",
12
  # "transformers",
13
  # "timm",
 
20
  # ///
21
 
22
  try:
23
+ import torch
24
  from diffusers import DiffusionPipeline
25
  from diffusers.utils import load_image, export_to_video
26
 
27
+ # switch to "mps" for apple devices
28
+ pipe = DiffusionPipeline.from_pretrained("Wan-AI/Wan2.2-I2V-A14B", dtype=torch.bfloat16, device_map="cuda")
29
  pipe.load_lora_weights("lightx2v/Wan2.2-Distill-Loras")
30
 
31
  prompt = "A man with short gray hair plays a red electric guitar."
 
47
  with open('lightx2v_Wan2.2-Distill-Loras_0.txt', 'a', encoding='utf-8') as f:
48
  import traceback
49
  f.write('''```CODE:
50
+ import torch
51
  from diffusers import DiffusionPipeline
52
  from diffusers.utils import load_image, export_to_video
53
 
54
+ # switch to "mps" for apple devices
55
+ pipe = DiffusionPipeline.from_pretrained("Wan-AI/Wan2.2-I2V-A14B", dtype=torch.bfloat16, device_map="cuda")
56
  pipe.load_lora_weights("lightx2v/Wan2.2-Distill-Loras")
57
 
58
  prompt = "A man with short gray hair plays a red electric guitar."