Image-to-Video
Diffusers
Safetensors
MiniMax H3
Pika H3 Flex
video-generation
text-to-audio-video
reference-to-video
fastvideo
nvfp4
qad
Instructions to use FastVideo/Pika-H3-Flex-NVFP4-QAD with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use FastVideo/Pika-H3-Flex-NVFP4-QAD with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image, export_to_video # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("FastVideo/Pika-H3-Flex-NVFP4-QAD", dtype=torch.bfloat16, device_map="cuda") pipe.to("cuda") prompt = "A man with short gray hair plays a red electric guitar." image = load_image( "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/guitar-man.png" ) output = pipe(image=image, prompt=prompt).frames[0] export_to_video(output, "output.mp4") - Pika H3 Flex
How to use FastVideo/Pika-H3-Flex-NVFP4-QAD with Pika H3 Flex:
# pip install -r examples/requirements-diffusers.txt (see the examples/ folder of this repo) import torch from diffusers import ComponentsManager, ModularPipeline from diffusers.utils.export_utils import encode_video from PIL import Image workflow = "fl2va" # "fl2va" (first-frame to video+audio) or "ref2va" (reference images/video to video+audio) manager = ComponentsManager() manager.enable_auto_cpu_offload(device="cuda:0") pipe = ModularPipeline.from_pretrained("FastVideo/Pika-H3-Flex-NVFP4-QAD", workflow=workflow, components_manager=manager) pipe.load_components( pretrained_model_name_or_path="FastVideo/Pika-H3-Flex-NVFP4-QAD", dtype={"vae": torch.float32, "audio_vae": torch.float32, "default": torch.bfloat16}, ) # The bundled base components are not Pika-adapted weights: load the matching adapter. pipe.load_lora_weights("FastVideo/Pika-H3-Flex-NVFP4-QAD", weight_name=f"{workflow}/adapter.safetensors") result = pipe( prompt="A cat walks through a sunlit cafe and jumps onto the counter", image=Image.open("first_frame.png").convert("RGB"), height=480, width=832, num_frames=121, generator=torch.Generator("cuda:0").manual_seed(0), output=["videos", "audio", "sampling_rate"], ) encode_video( result["videos"][0], fps=24, output_path="output.mp4", audio=result["audio"][0].float().cpu(), audio_sample_rate=result["sampling_rate"], ) - Notebooks
- Google Colab
- Kaggle
Commit History
11 days ago
-
Add files using upload-large-folder tool
Verified signaturea1b5f28