Skip to content
This repository was archived by the owner on Aug 25, 2025. It is now read-only.

Is main source code out of sync with weights provided? #279

@devinvenable

Description

@devinvenable

--output_path output
/home/devin/src/2024/python/games/venv/lib/python3.12/site-packages/timm/models/layers/init.py:48: FutureWarning: Importing from timm.models.layers is deprecated, please import via timm.layers
warnings.warn(f"Importing from {name} is deprecated, please import via timm.layers", FutureWarning)
Initialize
Device: cpu
/home/devin/src/2024/python/games/MiDaS/midas/base_model.py:11: FutureWarning: You are using torch.load with weights_only=False (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for weights_only will be flipped to True. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via torch.serialization.add_safe_globals. We recommend you start setting weights_only=True for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
parameters = torch.load(path, map_location=torch.device('cpu'))
Traceback (most recent call last):
File "/home/devin/src/2024/python/games/MiDaS/run.py", line 276, in
run(args.input_path, args.output_path, args.model_weights, args.model_type, args.optimize, args.side, args.height,
File "/home/devin/src/2024/python/games/MiDaS/run.py", line 126, in run
model, transform, net_w, net_h = load_model(device, model_path, model_type, optimize, height, square)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/devin/src/2024/python/games/MiDaS/midas/model_loader.py", line 50, in load_model
model = DPTDepthModel(
^^^^^^^^^^^^^^
File "/home/devin/src/2024/python/games/MiDaS/midas/dpt_depth.py", line 163, in init
self.load(path)
File "/home/devin/src/2024/python/games/MiDaS/midas/base_model.py", line 16, in load
self.load_state_dict(parameters)
File "/home/devin/src/2024/python/games/venv/lib/python3.12/site-packages/torch/nn/modules/module.py", line 2584, in load_state_dict
raise RuntimeError(
RuntimeError: Error(s) in loading state_dict for DPTDepthModel:
Unexpected key(s) in state_dict: "pretrained.model.blocks.0.attn.relative_position_index", "pretrained.model.blocks.1.attn.relative_position_index", "pretrained.model.blocks.2.attn.relative_position_index", "pretrained.model.blocks.3.attn.relative_position_index", "pretrained.model.blocks.4.attn.relative_position_index", "pretrained.model.blocks.5.attn.relative_position_index", "pretrained.model.blocks.6.attn.relative_position_index", "pretrained.model.blocks.7.attn.relative_position_index", "pretrained.model.blocks.8.attn.relative_position_index", "pretrained.model.blocks.9.attn.relative_position_index", "pretrained.model.blocks.10.attn.relative_position_index", "pretrained.model.blocks.11.attn.relative_position_index", "pretrained.model.blocks.12.attn.relative_position_index", "pretrained.model.blocks.13.attn.relative_position_index", "pretrained.model.blocks.14.attn.relative_position_index", "pretrained.model.blocks.15.attn.relative_position_index", "pretrained.model.blocks.16.attn.relative_position_index", "pretrained.model.blocks.17.attn.relative_position_index", "pretrained.model.blocks.18.attn.relative_position_index", "pretrained.model.blocks.19.attn.relative_position_index", "pretrained.model.blocks.20.attn.relative_position_index", "pretrained.model.blocks.21.attn.relative_position_index", "pretrained.model.blocks.22.attn.relative_position_index", "pretrained.model.blocks.23.attn.relative_position_index".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions