Instructions to use herb786/MiniMaxH3-acheze-int8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use herb786/MiniMaxH3-acheze-int8 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("herb786/MiniMaxH3-acheze-int8", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Esta es la versi贸n cuantizada del transformer y el text encoder para MiniMax-H3.
- La cuantizaci贸n fue hecha en una GPU A100 con torchao v0.18.0.
Un momentillo listillo pero c贸mo se usa este mamotreto.
Primero actualiza torchao
pip install --upgrade torchao
Desde luego el acelerador de descarga tambi茅n que solo tenemos parte del modelo y falta otras componentes para realizar las inferencias.
pip install -q hf-transfer
Ahora viene un ejemplo para generar videos y comenzamos cargando lo necesario para crear el ducto de generaci贸n
import torch
from diffusers import ComponentsManager, ModularPipeline
from diffusers.modular_pipelines.minimax_h3 import (
MiniMaxH3AudioReference,
MiniMaxH3ImageReference,
MiniMaxH3VideoReference,
)
from diffusers import MiniMaxH3Transformer3DModel
from transformers import Qwen3VLForConditionalGeneration
Despu茅s creamos el ducto
manager = ComponentsManager()
pipe = ModularPipeline.from_pretrained("MiniMaxAI/MiniMax-H3", components_manager=manager)
Luego cargamos el transformer, la primera carga tomar谩 unos 6 minutos a m谩s en una GPU A100
minimax_quant = "herb786/MinimaxH3-achece-int8"
transformer = MiniMaxH3Transformer3DModel.from_pretrained(minimax_quant, subfolder='transformer', dtype=torch.bfloat16, use_safetensors=False)
Luego cargamos el text_encoder, la primera carga tomar谩 tambi茅n 6 minutos a m谩s en una GPU A100
minimax_quant = "herb786/MinimaxH3-achece-int8"
text_encoder = Qwen3VLForConditionalGeneration.from_pretrained(minimax_quant, subfolder='text_encoder', dtype=torch.bfloat16)
Ahora transferimos est谩s componentes al ducto MinimaxH3. En este caso usare el modo fl2va porque usar茅 una imagen como referencia.
pipe.update_components(transformer=transformer,text_encoder=text_encoder)
pipe.load_components(workflow="fl2va", dtype=torch.bfloat16)
manager.enable_auto_cpu_offload(device="cuda", memory_reserve_margin="12GB")
Pueder usar LoRA para acelerar la inferencia como por ejemplo Minimax-h3-Turbo
lora_path = "/path_to/loras_minimax/"
turbo = "minimax_h3_fl2v_turbo_8step_v1.0_768p_bf16.safetensors"
pipe.load_lora_weights(lora_path,weight_name=turbo,adapter_name="turbo")
pipe.set_adapters("turbo", 1.0)
Ahora cargamos la imagen, y en este caso la visualizamos en jupyter
from diffusers.utils import make_image_grid
from diffusers.utils import load_image
ref_image = load_image("wasteland_paradise.png")
display(make_image_grid([ref_image],rows=1,cols=1,resize=300))
Para generar el video realizamos la inferencia que tomar谩 algo de 9 minutos a m谩s en una GPU A100
seed = torch.seed()
generator = torch.Generator().manual_seed(seed)
results = pipe(
prompt="A lone man mounted on his weary donkey and his faithful hound wander in a pretty wasteland paradise. Atonal music plays in the background.",
image=ref_image,
#num_frames=124, #5 segundos
num_frames=345, #15 segundos
num_inference_steps=8, # con el lora de aceleraci贸n
generator=generator,
output=["videos", "audio", "sampling_rate"]
)
Ahora codificaremos los tensores en un formato general de video como mp4
from diffusers.utils.export_utils import encode_video
encode_video(
results["videos"][0],
fps=24,
output_path="mi-video-favorito.mp4",
audio=results["audio"][0],
audio_sample_rate=results["sampling_rate"],
)
Si eres un entusiasta del cine mudo
encode_video(
results["videos"][0],
fps=24,
output_path="mi-video-favorito.mp4"
)
- Downloads last month
- -
Model tree for herb786/MiniMaxH3-acheze-int8
Base model
MiniMaxAI/MiniMax-H3