Update README.md
Browse files
README.md
CHANGED
|
@@ -35,3 +35,50 @@ We're excited to introduce the **CausalWan2.2 I2V A14B series**—a new line of
|
|
| 35 |
|
| 36 |
- 8-step inference is supported.
|
| 37 |
- Try it out on **FastVideo** — we support a wide range of GPUs from **H100** to **4090**, and also support **Mac** users!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
- 8-step inference is supported.
|
| 37 |
- Try it out on **FastVideo** — we support a wide range of GPUs from **H100** to **4090**, and also support **Mac** users!
|
| 38 |
+
|
| 39 |
+
## Inference code
|
| 40 |
+
|
| 41 |
+
```python
|
| 42 |
+
from fastvideo import VideoGenerator, SamplingParam
|
| 43 |
+
import json
|
| 44 |
+
# from fastvideo.configs.sample import SamplingParam
|
| 45 |
+
|
| 46 |
+
OUTPUT_PATH = "video_samples_self_forcing_causal_wan2_2_14B_i2v"
|
| 47 |
+
def main():
|
| 48 |
+
# FastVideo will automatically use the optimal default arguments for the
|
| 49 |
+
# model.
|
| 50 |
+
# If a local path is provided, FastVideo will make a best effort
|
| 51 |
+
# attempt to identify the optimal arguments.
|
| 52 |
+
generator = VideoGenerator.from_pretrained(
|
| 53 |
+
"FastVideo/SFWan2.2-I2V-A14B-Preview-Diffusers",
|
| 54 |
+
# FastVideo will automatically handle distributed setup
|
| 55 |
+
num_gpus=1,
|
| 56 |
+
use_fsdp_inference=True,
|
| 57 |
+
dit_cpu_offload=True, # DiT need to be offloaded for MoE
|
| 58 |
+
dit_precision="fp32",
|
| 59 |
+
vae_cpu_offload=False,
|
| 60 |
+
text_encoder_cpu_offload=True,
|
| 61 |
+
dmd_denoising_steps=[1000, 850, 700, 550, 350, 275, 200, 125],
|
| 62 |
+
# Set pin_cpu_memory to false if CPU RAM is limited and there're no frequent CPU-GPU transfer
|
| 63 |
+
pin_cpu_memory=True,
|
| 64 |
+
# image_encoder_cpu_offload=False,
|
| 65 |
+
)
|
| 66 |
+
|
| 67 |
+
sampling_param = SamplingParam.from_pretrained("FastVideo/SFWan2.2-I2V-A14B-Preview-Diffusers")
|
| 68 |
+
sampling_param.num_frames = 73
|
| 69 |
+
sampling_param.width = 832
|
| 70 |
+
sampling_param.height = 480
|
| 71 |
+
sampling_param.seed = 1000
|
| 72 |
+
|
| 73 |
+
with open("prompts/mixkit_i2v.jsonl", "r") as f:
|
| 74 |
+
prompt_image_pairs = json.load(f)
|
| 75 |
+
|
| 76 |
+
for prompt_image_pair in prompt_image_pairs:
|
| 77 |
+
prompt = prompt_image_pair["prompt"]
|
| 78 |
+
image_path = prompt_image_pair["image_path"]
|
| 79 |
+
_ = generator.generate_video(prompt, image_path=image_path, output_path=OUTPUT_PATH, save_video=True, sampling_param=sampling_param)
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
if __name__ == "__main__":
|
| 83 |
+
main()
|
| 84 |
+
```
|