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

Update timm model name #35

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Update timm model name #35

wants to merge 1 commit into from

Conversation

kulits
Copy link

@kulits kulits commented Jan 4, 2023

vit_base_resnet50_384 was a deprecated (now-removed) alias for vit_base_r50_s16_384 (see [here]). This PR makes omnidata-tools compatible with recent versions of timm and does not affect compatibility with the timm version listed in the existing requirements.txt.

`vit_base_resnet50_384` was a deprecated (now-removed) alias for `vit_base_r50_s16_384` (see [[here](https://github.com/rwightman/pytorch-image-models/blob/v0.4.12/timm/models/vision_transformer_hybrid.py)]). This PR makes `omnidata-tools` compatible with recent versions of `timm` and does not affect compatibility with the `timm` version listed in the existing `requirements.txt`.
@JzTao321
Copy link

JzTao321 commented Nov 6, 2024

Traceback (most recent call last):
File "demo.py", line 63, in
model = DPTDepthModel(backbone='vitb_rn50_384', num_channels=3) # DPT Hybrid
File "/media/data2/taojiazheng/omnidata-main/omnidata_tools/torch/modules/midas/dpt_depth.py", line 101, in init
super().init(head, **kwargs)
File "/media/data2/taojiazheng/omnidata-main/omnidata_tools/torch/modules/midas/dpt_depth.py", line 48, in init
self.pretrained, self.scratch = _make_encoder(
File "/media/data2/taojiazheng/omnidata-main/omnidata_tools/torch/modules/midas/blocks.py", line 20, in _make_encoder
pretrained = _make_pretrained_vitb_rn50_384(
File "/media/data2/taojiazheng/omnidata-main/omnidata_tools/torch/modules/midas/vit.py", line 483, in _make_pretrained_vitb_rn50_384
model = timm.create_model("vit_base_r50_s16_384", pretrained=pretrained)
File "/home/taojiazheng/anaconda3/envs/omnidata/lib/python3.8/site-packages/timm/models/factory.py", line 81, in create_model
model = create_fn(pretrained=pretrained, **kwargs)
File "/home/taojiazheng/anaconda3/envs/omnidata/lib/python3.8/site-packages/timm/models/vision_transformer_hybrid.py", line 238, in vit_base_r50_s16_384
model = _create_vision_transformer_hybrid(
File "/home/taojiazheng/anaconda3/envs/omnidata/lib/python3.8/site-packages/timm/models/vision_transformer_hybrid.py", line 146, in _create_vision_transformer_hybrid
return _create_vision_transformer(
File "/home/taojiazheng/anaconda3/envs/omnidata/lib/python3.8/site-packages/timm/models/vision_transformer.py", line 531, in _create_vision_transformer
model = build_model_with_cfg(
File "/home/taojiazheng/anaconda3/envs/omnidata/lib/python3.8/site-packages/timm/models/helpers.py", line 457, in build_model_with_cfg
load_pretrained(
File "/home/taojiazheng/anaconda3/envs/omnidata/lib/python3.8/site-packages/timm/models/helpers.py", line 184, in load_pretrained
state_dict = load_state_dict_from_url(pretrained_url, progress=progress, map_location='cpu')
File "/home/taojiazheng/anaconda3/envs/omnidata/lib/python3.8/site-packages/torch/hub.py", line 557, in load_state_dict_from_url
return torch.load(cached_file, map_location=map_location)
File "/home/taojiazheng/anaconda3/envs/omnidata/lib/python3.8/site-packages/torch/serialization.py", line 608, in load
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
File "/home/taojiazheng/anaconda3/envs/omnidata/lib/python3.8/site-packages/torch/serialization.py", line 794, in _legacy_load
deserialized_objects[key]._set_from_file(f, offset, f_should_read_directly)
RuntimeError: unexpected EOF, expected 978043 more bytes. The file might be corrupted.
There are still issues after modification

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

Successfully merging this pull request may close these issues.

2 participants