Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: 'int' object is not subscriptable #95

Open
fanzz1208 opened this issue Apr 28, 2024 · 3 comments
Open

TypeError: 'int' object is not subscriptable #95

fanzz1208 opened this issue Apr 28, 2024 · 3 comments

Comments

@fanzz1208
Copy link

/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

@yocabon
Copy link
Contributor

yocabon commented Apr 29, 2024

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.

@Develope-user
Copy link

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. .

@yuzi0537
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants