Skip to content

FaceAlignmentCropper #377

Description

@Wtyysq

Issue / Note: PyTorch 2.6+ Security Blocks Weights Loading in FaceAlignmentCropper
Problem Description:
When running a workflow with the LivePortrait Load FaceAlignmentCropper node, it fails to initialize and turns red on the canvas (entering an UNKNOWN state or throwing an initialization error). The ComfyUI console outputs a critical PyTorch serialization error.

Error Log:

Plaintext
torch.serialization.WeightsOnlyLoadFailed: Weights only load failed. Re-running torch.load with weights_only=False to show an exception that happened instead has failed.
AttributeError: Can't get attribute 'reduce_graph_module' on <module 'face_alignment...'>

Root Cause:
Starting with PyTorch 2.6+, the default model loading mechanism strictly enforces security restrictions (weights_only=True). This blocks the execution of any hidden or non-standard code embedded within model weight files. The checkpoint used by the FaceAlignment backend was saved using an outdated method and contains a reference to an internal structure called reduce_graph_module. The updated PyTorch environment flags this structure as unsafe and completely blocks its import.

Solution / Workaround:
Switch to the LivePortrait Load InsightFaceCropper node. It utilizes modern models in the .onnx format, which run via a separate ONNX Runtime engine. This completely bypasses PyTorch's pickle-based security checks, prevents initialization errors, and provides significantly more precise facial tracking utilizing GPU acceleration (CUDA) RTX 4080.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions