Skip to content

WeightsUnpickler error: Unsupported operand 56 #2414

Description

@vidu3k333
Traceback (most recent call last):
  File "E:\sd-scripts\networks\sdxl_merge_lora.py", line 515, in <module>
    merge(args)
  File "E:\sd-scripts\networks\sdxl_merge_lora.py", line 428, in merge
    state_dict, metadata = merge_lora_models(args.models, args.ratios, args.lbws, merge_dtype, args.concat, args.shuffle)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\sd-scripts\networks\sdxl_merge_lora.py", line 260, in merge_lora_models
    lora_sd, lora_metadata = load_state_dict(model, merge_dtype)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\sd-scripts\networks\sdxl_merge_lora.py", line 30, in load_state_dict
    sd = torch.load(file_name, map_location="cpu")
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\ColleSLAW\sd-scripts\venv\Lib\site-packages\torch\serialization.py", line 1494, in load
    raise pickle.UnpicklingError(_get_wo_message(str(e))) from None
_pickle.UnpicklingError: Weights only load failed. In PyTorch 2.6, we changed the default value of the `weights_only` argument in `torch.load` from `False` to `True`. Re-running `torch.load` with `weights_only` set to `False` will likely succeed, but it can result in arbitrary code execution. Do it only if you got the file from a trusted source.
Please file an issue with the following so that we can make `weights_only=True` compatible with your use case: WeightsUnpickler error: Unsupported operand 56

Check the documentation of torch.load to learn more about types accepted by default with weights_only https://pytorch.org/docs/stable/generated/torch.load.html.

I'm aware that I need to convert my LoRAs to weights, but I'm just doing this with my own trained models. How do I skip this and just merge?

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