Skip to content

Unpickling error while: face_reconstruction = pipeline( Tasks.face_reconstruction, model='damo/cv_resnet50_face-reconstruction', model_revision='v2.0.0-HRN' ) #73

Description

@subh-775

2025-03-25 10:41:53,551 - modelscope - INFO - Use user-specified model revision: v2.0.0-HRN
Downloading Model from https://www.modelscope.cn/ to directory: /root/.cache/modelscope/hub/models/damo/cv_resnet50_face-reconstruction
2025-03-25 10:41:56,599 - modelscope - INFO - Use user-specified model revision: v2.0.0-HRN
2025-03-25 10:41:58,813 - modelscope - INFO - initiate model from /root/.cache/modelscope/hub/models/damo/cv_resnet50_face-reconstruction
2025-03-25 10:41:58,814 - modelscope - INFO - initiate model from location /root/.cache/modelscope/hub/models/damo/cv_resnet50_face-reconstruction.
2025-03-25 10:41:58,816 - modelscope - INFO - initialize model from /root/.cache/modelscope/hub/models/damo/cv_resnet50_face-reconstruction
initialize network with normal
initialize network with normal
2025-03-25 10:42:00,790 - modelscope - WARNING - No preprocessor field found in cfg.
2025-03-25 10:42:00,792 - modelscope - WARNING - No val key and type key found in preprocessor domain of configuration.json file.
2025-03-25 10:42:00,794 - modelscope - WARNING - Cannot find available config to build preprocessor at mode inference, current config: {'model_dir': '/root/.cache/modelscope/hub/models/damo/cv_resnet50_face-reconstruction'}. trying to build by task and model information.
2025-03-25 10:42:00,797 - modelscope - WARNING - No preprocessor key ('face_reconstruction', 'face-reconstruction') found in PREPROCESSOR_MAP, skip building preprocessor.

UnpicklingError Traceback (most recent call last)
/usr/local/lib/python3.11/dist-packages/modelscope/utils/registry.py in build_from_cfg(cfg, registry, group_key, default_args)
210 else:
--> 211 return obj_cls(**args)
212 except Exception as e:

6 frames
UnpicklingError: Weights only load failed. This file can still be loaded, to do so you have two options, do those steps only if you trust the source of the checkpoint.
(1) 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.
(2) Alternatively, to load with weights_only=True please check the recommended steps in the following error message.
WeightsUnpickler error: Unsupported global: GLOBAL numpy.core.multiarray.scalar was not an allowed global by default. Please use torch.serialization.add_safe_globals([scalar]) or the torch.serialization.safe_globals([scalar]) context manager to allowlist this global if you trust this class/function.

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.

During handling of the above exception, another exception occurred:

UnpicklingError Traceback (most recent call last)
/usr/local/lib/python3.11/dist-packages/modelscope/utils/registry.py in build_from_cfg(cfg, registry, group_key, default_args)
212 except Exception as e:
213 # Normal TypeError does not print class name.
--> 214 raise type(e)(f'{obj_cls.name}: {e}')

UnpicklingError: FaceReconstructionPipeline: Weights only load failed. This file can still be loaded, to do so you have two options, do those steps only if you trust the source of the checkpoint.
(1) 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.
(2) Alternatively, to load with weights_only=True please check the recommended steps in the following error message.
WeightsUnpickler error: Unsupported global: GLOBAL numpy.core.multiarray.scalar was not an allowed global by default. Please use torch.serialization.add_safe_globals([scalar]) or the torch.serialization.safe_globals([scalar]) context manager to allowlist this global if you trust this class/function.

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.

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