Hugging Face's logo Hugging Face
  • Models
  • Datasets
  • Spaces
  • Buckets
  • Docs
  • Enterprise
  • Pricing
    • Website
      • Tasks
      • HuggingChat
      • Collections
      • Languages
      • Organizations
    • Community
      • Blog
      • Posts
      • Daily Papers
      • Hardware
      • Learn
      • Discord
      • Forum
      • GitHub
    • Solutions
      • Team & Enterprise
      • Hugging Face PRO
      • Enterprise Support
      • Inference Providers
      • Inference Endpoints
      • Storage Buckets

  • Log In
  • Sign Up

Duplicated from  Pika-Labs/Pika-H3-Flex

Infinix-io
/
Pika-H3-Flex

Image-to-Video
Pika H3 Flex
Diffusers
Safetensors
video-generation
audio-video-generation
lora
Model card Files Files and versions
xet
Community

Instructions to use Infinix-io/Pika-H3-Flex with libraries, inference providers, notebooks, and local apps. Follow these links to get started.

  • Libraries
  • Pika H3 Flex

    How to use Infinix-io/Pika-H3-Flex 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("Infinix-io/Pika-H3-Flex", workflow=workflow, components_manager=manager)
    pipe.load_components(
        pretrained_model_name_or_path="Infinix-io/Pika-H3-Flex",
        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("Infinix-io/Pika-H3-Flex", 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"],
    )
  • Diffusers

    How to use Infinix-io/Pika-H3-Flex 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("MiniMaxAI/MiniMax-H3", dtype=torch.bfloat16, device_map="cuda")
    pipe.load_lora_weights("Infinix-io/Pika-H3-Flex")
    
    prompt = "Image 1 is the exact two players, outfits, frog mask, table-tennis table and drained pool: keep them exactly as in Image 1.\nA fast table-tennis rally, shot with exactly these camera moves:\n00:00–00:03 — top-down from directly overhead, as in Image 1, as the rally begins and the ball flicks back and forth.\n00:03–00:06 — a smooth crane straight down from overhead to table height, ending right beside the net as the ball zips across.\n00:06–00:09 — fast whip pans left and right following the ball across the net, from one player to the other.\n00:09–00:12 — a 180-degree orbit around the frog-masked player as she leaps and smashes the ball.\n00:12–00:15 — a low-angle dolly backward along the pool floor as the woman in the red tracksuit dives and misses; the frog raises both arms and does a little victory dance; the camera settles and holds.\nThe players, table and pool stay consistent and in the same place throughout. Photoreal 35mm film look, true colour, light natural grain, matching Image 1. SPEED IS CRITICAL: everything moves at normal real-time speed, like 24fps footage played back at 24fps - natural motion, NO slow motion.\nSound: the quick tock-tock of the ball, sneakers squeaking on concrete, the smash, a thud as she dives, echo in the empty pool, the frog's muffled cheer. Music: a funky, upbeat drum-and-bass groove."
    input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/guitar-man.png")
    
    output = pipe(image=input_image, prompt=prompt).frames[0]
    export_to_video(output, "output.mp4")
  • Inference
  • Notebooks
  • Google Colab
  • Kaggle
Pika-H3-Flex / vae
10.4 GB
Ctrl+K
Ctrl+K
  • 2 contributors
History: 1 commit
Infinix-io's picture
Infinix-io
cade-li's picture
cade-li
Duplicate from Pika-Labs/Pika-H3-Flex
6d25e66 11 days ago
  • config.json
    2.25 kB
    Duplicate from Pika-Labs/Pika-H3-Flex 11 days ago
  • diffusion_pytorch_model-00001-of-00002.safetensors
    9.92 GB
    xet
    Duplicate from Pika-Labs/Pika-H3-Flex 11 days ago
  • diffusion_pytorch_model-00002-of-00002.safetensors
    495 MB
    xet
    Duplicate from Pika-Labs/Pika-H3-Flex 11 days ago
  • diffusion_pytorch_model.safetensors.index.json
    74.4 kB
    Duplicate from Pika-Labs/Pika-H3-Flex 11 days ago