Nodes/ComfyUI-PyTorch210Patcher/PyTorch 2.10 Compatibility Patcher
ComfyUI Node

PyTorch 2.10 Compatibility Patcher

PyTorch 2.10 broke your Wan loader? This node patches it back together

By huyl3-cpu·Created 7 months ago·Updated 7 months ago· 0
PyTorch 2.10 Compatibility Patcher
    • status
    force_patchtrue
    fix_string_to_seedtrue
    verbosetrue

    You upgraded PyTorch - or grabbed the ROCm 7 / 2.10 build everyone was posting performance numbers about - and suddenly WanVideoWrapper dies before it even loads a model, throwing an AttributeError about diffusion_model. That's the exact bug this pack exists for. The PyTorch 2.10 Compatibility Patcher is a monkey-patch node that fixes WanVideoModel so your Wan 2.1/2.2 workflows run on both PyTorch 2.9 and 2.10+. Built, per the README, for Google Colab A100 setups where torch version churn bites hardest.

    What's actually breaking

    Per the pack's own docs, PyTorch 2.10.0 tightened attribute checking in nn.Module.__getattr__. WanVideoWrapper's WanVideoModel(BaseModel) calls super().__init__(), and that parent init tries to touch self.diffusion_model (via archive_model_dtypes) before the attribute exists. On 2.9 that's a shrug; on 2.10 it's a hard crash.

    How the patch works

    The node finds the already-loaded nodes_model_loading module, grabs the WanVideoModel class, stashes the original __init__, and swaps in a wrapper that sets a dummy self.diffusion_model = nn.Identity() before calling the original. The placeholder satisfies 2.10's stricter check; the real diffusion model overwrites it later when the loader does its thing. It's a one-time class-level change, so there's zero per-generation overhead - patch once at the start of the graph and forget it.

    It also does a second, cosmetic job: repoints WanVideoWrapper's string_to_seed import from the deprecated comfy.model_patcher location to comfy.utils, silencing a deprecation warning. Nice to have, not essential.

    The inputs that matter

    Only three, all optional, all booleans:

    • force_patch (default True) - apply the patch even on PyTorch < 2.10. Harmless to leave on; the README's compat table says the patched init works fine on 2.9.
    • fix_string_to_seed (default True) - the cosmetic deprecation fix above. Flip it off if you'd rather leave the wrapper untouched.
    • verbose (default True) - print exactly what the node did to the console.

    The output is a single status string - a human-readable report like "✅ WanVideoModel patched for PyTorch 2.10 compatibility." It's for your eyes, not a data pipe. Don't try to wire it into anything meaningful.

    The gotcha nobody mentions

    This node has no inputs and no data connections. The README's diagram showing it "before the WanVideo Model Loader" is about execution order, not wiring. It patches the class in place, so it just has to run before the loader instantiates the model - drop it anywhere upstream in the queue. If your graph executes it after the loader, the patch arrives too late and you're back to the AttributeError. Placement is the whole game.

    Installing it

    Search "ComfyUI-PyTorch210Patcher" in ComfyUI Manager, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/huyl3-cpu/ComfyUI-PyTorch210Patcher.git
    

    Then restart ComfyUI. This pack itself has no requirements.txt and downloads no models - the real dependency is Kijai's ComfyUI-WanVideoWrapper, which you must already have installed, since that's the thing being patched. No wrapper, no patch.

    Common issues & the honest take

    • Status says "Failed to import WanVideoModel." The wrapper isn't where the node expects it - different path or not loaded. Install or update ComfyUI-WanVideoWrapper first, then run again.
    • Check upstream before you band-aid. Kijai updates his wrapper fast, and the underlying bug may already be fixed. Peek at the WanVideoWrapper repo's changelog before installing a monkey-patch - this is a stopgap, and it knows it.
    • The "8–13% faster" claim in the README is PyTorch 2.10's own speedup, not something this node adds. The patch is performance-neutral.
    • If you hit a similar AttributeError from a different pack, this whole placeholder-before-init trick is a decent template for a fix - and a good excuse to learn how monkey-patching in ComfyUI works.
    CategoryWanVideoWrapper/Utils

    Inputs (3)

    NameTypeDefaultDescription
    force_patchoptBOOLEANtrueForce patch even if PyTorch < 2.10
    fix_string_to_seedoptBOOLEANtrueFix string_to_seed deprecation warning
    verboseoptBOOLEANtruePrint patch status

    Outputs (1)

    NameTypeDescription
    statusSTRING