Views
No views yet
A vibrant green Mustang GT parked in an empty parking lot. The camera slowly pans around the car, showing its sleek design, black hood and black rims in a clean promotional video.1.00.04AnyFlowValidationScheduler (FlowMatchEulerDiscreteScheduler)0832x480no_change1import torch
2from diffusers import DiffusionPipeline
3
4model_id = 'Wan-AI/Wan2.1-T2V-1.3B-Diffusers'
5adapter_id = 'bghira/wan2.1-1.3b-anyflow-wip'
6pipeline = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16) # loading directly in bf16
7pipeline.load_lora_weights(adapter_id)
8
9prompt = "A vibrant green Mustang GT parked in an empty parking lot. The camera slowly pans around the car, showing its sleek design, black hood and black rims in a clean promotional video."
10negative_prompt = '色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走'
11
12## Optional: quantise the model to save on vram.
13## Note: The model was not quantised during training, so it is not necessary to quantise it during inference time.
14#from optimum.quanto import quantize, freeze, qint8
15#quantize(pipeline.transformer, weights=qint8)
16#freeze(pipeline.transformer)
17
18pipeline.to('cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu') # the pipeline is already in its target precision level
19model_output = pipeline(
20 prompt=prompt,
21 negative_prompt=negative_prompt,
22 num_inference_steps=4,
23 generator=torch.Generator(device='cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu').manual_seed(1),
24 width=832,
25 height=480,
26 guidance_scale=1.0,
27).images[0]
28
29from diffusers.utils.export_utils import export_to_gif
30export_to_gif(model_output, "output.gif", fps=16)
31