• Stefy Lanza (nextime / spora )'s avatar
    Fix loading transformer-only fine-tuned models (like Muinez/ltxvideo-2b-nsfw) · 03b62189
    Stefy Lanza (nextime / spora ) authored
    Some models on HuggingFace are not full pipelines but just fine-tuned components
    (e.g., just the transformer weights). These have a config.json at root level with
    _class_name pointing to a component class like 'LTXVideoTransformer3DModel'.
    
    This fix adds:
    
    1. Detection of component-only models:
       - Check for config.json at root level
       - Read _class_name to determine component type
       - Detect if it's a transformer, VAE, or other component
    
    2. Proper loading strategy:
       - Load the base pipeline first (e.g., Lightricks/LTX-Video)
       - Then load the fine-tuned component from the model repo
       - Replace the base component with the fine-tuned one
    
    3. Supported component classes:
       - LTXVideoTransformer3DModel → Lightricks/LTX-Video
       - AutoencoderKLLTXVideo → Lightricks/LTX-Video
       - UNet2DConditionModel, UNet3DConditionModel, AutoencoderKL
    
    This allows loading models like Muinez/ltxvideo-2b-nsfw which are
    fine-tuned transformer weights without a full pipeline structure.
    03b62189
videogen 344 KB