Summary
Running LTX-2 image-to-video from the current main can fail after downloading model weights because LTXModel.from_pretrained() constructs LTXModelConfig directly from config.json.
Recent Hugging Face/Diffusers-style configs may include metadata keys such as _class_name and _diffusers_version. Those keys are not dataclass fields on LTXModelConfig, so loading aborts before generation starts.
Reproduction
Run LTX-2 with the default model repo after weights are available/downloaded:
mlx_video.ltx_2.generate \
--prompt "Animate the image" \
--pipeline distilled \
--height 512 \
--width 512 \
--num-frames 97 \
--image horse1.png \
--output-path output.mp4
Actual Result
After the model snapshot is fetched and the text encoder loads, model loading fails:
Text encoder loaded successfully
✓ Text encoder loaded
TypeError: LTXModelConfig.__init__() got an unexpected keyword argument '_class_name'
Expected Result
from_pretrained() should ignore metadata keys that are not part of LTXModelConfig, matching the existing BaseModelConfig.from_dict() behavior.
Proposed Fix
Change LTXModel.from_pretrained() to build config with:
config = LTXModelConfig.from_dict(config_dict)
instead of:
config = LTXModelConfig(**config_dict)
This preserves known fields and filters unknown metadata keys.
Summary
Running LTX-2 image-to-video from the current
maincan fail after downloading model weights becauseLTXModel.from_pretrained()constructsLTXModelConfigdirectly fromconfig.json.Recent Hugging Face/Diffusers-style configs may include metadata keys such as
_class_nameand_diffusers_version. Those keys are not dataclass fields onLTXModelConfig, so loading aborts before generation starts.Reproduction
Run LTX-2 with the default model repo after weights are available/downloaded:
mlx_video.ltx_2.generate \ --prompt "Animate the image" \ --pipeline distilled \ --height 512 \ --width 512 \ --num-frames 97 \ --image horse1.png \ --output-path output.mp4Actual Result
After the model snapshot is fetched and the text encoder loads, model loading fails:
Expected Result
from_pretrained()should ignore metadata keys that are not part ofLTXModelConfig, matching the existingBaseModelConfig.from_dict()behavior.Proposed Fix
Change
LTXModel.from_pretrained()to build config with:instead of:
This preserves known fields and filters unknown metadata keys.