naver / dust3r

DUSt3R: Geometric 3D Vision Made Easy

Home Page:https://dust3r.europe.naverlabs.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: 'int' object is not subscriptable

fanzz1208 opened this issue · comments

/opt/conda/envs/dust3r/lib/python3.11/site-packages/torch/cuda/init.py:619: UserWarning: Can't initialize NVML
warnings.warn("Can't initialize NVML")
Traceback (most recent call last):
File "/workspace/dust3r/demo.py", line 294, in
model = AsymmetricCroCo3DStereo.from_pretrained(weights_path).to(args.device)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/dust3r/dust3r/model.py", line 79, in from_pretrained
return super(AsymmetricCroCo3DStereo, cls).from_pretrained(pretrained_model_name_or_path, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/envs/dust3r/lib/python3.11/site-packages/huggingface_hub/utils/_validators.py", line 119, in _inner_fn
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/opt/conda/envs/dust3r/lib/python3.11/site-packages/huggingface_hub/hub_mixin.py", line 420, in from_pretrained
instance = cls._from_pretrained(
^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/envs/dust3r/lib/python3.11/site-packages/huggingface_hub/hub_mixin.py", line 643, in _from_pretrained
model = cls(**model_kwargs)
^^^^^^^^^^^^^^^^^^^
File "/workspace/dust3r/dust3r/model.py", line 71, in init
self.set_downstream_head(output_mode, head_type, landscape_only, depth_mode, conf_mode, **croco_kwargs)
File "/workspace/dust3r/dust3r/model.py", line 108, in set_downstream_head
assert img_size[0] % patch_size == 0 and img_size[1] % patch_size == 0,
~~~~~~~~^^^
TypeError: 'int' object is not subscriptable

Hi,
Make sure the path you're using is correct.
This look like dust3r is being initialized with the default CroCo parameters, which should not happen if weights_path is used.

Hello, I also encountered the same problem. Did you solve it? My solution is as follows.
Possible reasons for the bug: According to line 293 of the "damo.py" program, when "weights_path" is not specified, the program will find and load weights in the "naver" folder, but there is no "naver" file in the project folder, so weight loading fails.
Solution: Download the required weights, that is, "Checkpoints" according to the author's instructions, then modify line 293 of the code to point "weights_path" to the downloaded weights, and finally run the routine according to the author's instructions to solve the problem. .

Or you can use"--weights checkpoints/DUSt3R_ViTLarge_BaseDecoder_512_dpt.pth" instead "--model DUSt3R_ViTLarge_BaseDecoder_512_dpt"