Skip to content

[MiniMax-H3, Pika H3 Flex] ref2va fails on a reference soundtrack that is not at 32 kHz without torchaudio #15245

Open

Description

@christopher5106

Describe the bug

The ref2va setup steps of MiniMax-H3 (MiniMaxH3Ref2VASetupStep) and Pika H3 Flex (PikaH3FlexRef2VASetupStep) resample a reference soundtrack onto the audio VAE's sample rate (32 kHz) with torchaudio.transforms.Resample. torchaudio is not a diffusers dependency, so a reference soundtrack at any other rate, such as the 44.1 or 48 kHz audio track of most videos, fails with an ImportError.

Installing torchaudio is not a fix everywhere: it has no release for recent torch versions (the last on PyPI is 2.11.1).

I intend to fix this in #15199, with a plain-PyTorch port of torchaudio's default band-limited resampler.

Reproduction

In an environment without torchaudio:

import torch
from diffusers.modular_pipelines.minimax_h3.before_encoder import MiniMaxH3Ref2VASetupStep

waveform = torch.randn(1, 48000 * 3)  # 3 s of mono audio at 48 kHz
MiniMaxH3Ref2VASetupStep._normalize_audio_condition(
    waveform, sample_rate=48000, target_sample_rate=32000, max_duration=2.0
)

The same applies to PikaH3FlexRef2VASetupStep._normalize_audio_condition in diffusers.modular_pipelines.pika_h3_flex.before_encoder.

Logs

ImportError: Resampling a MiniMax-H3 reference soundtrack from 48000 Hz to 32000 Hz needs `torchaudio`. Pass a waveform already at the audio VAE's sample rate to do without it.

System Info

  • diffusers: main
  • torch: a version with no matching torchaudio release (> 2.11)
  • torchaudio: not installed

Who can help?

@DN6 @yiyixuxu

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions