MiDaS icon indicating copy to clipboard operation
MiDaS copied to clipboard

what is tisAttributeError: 'LevitDistilled' object has no attribute 'blocks'

Open reza-shahriari opened this issue 1 year ago • 6 comments

i am trying to run dpt_levit_224 but i am seeing this: AttributeError: 'LevitDistilled' object has no attribute 'blocks' python3 run.py --model_type dpt_levit_224 --side /usr/lib/python3/dist-packages/requests/__init__.py:89: RequestsDependencyWarning: urllib3 (1.26.16) or chardet (3.0.4) doesn't match a supported version! warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported " Initialize Device: cuda /home/reza/.local/lib/python3.8/site-packages/torch/functional.py:504: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ../aten/src/ATen/native/TensorShape.cpp:3483.) return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined] Traceback (most recent call last): File "run.py", line 276, in <module> run(args.input_path, args.output_path, args.model_weights, args.model_type, args.optimize, args.side, args.height, File "run.py", line 126, in run model, transform, net_w, net_h = load_model(device, model_path, model_type, optimize, height, square) File "/home/reza/MiDaS/midas/model_loader.py", line 138, in load_model model = DPTDepthModel( File "/home/reza/MiDaS/midas/dpt_depth.py", line 160, in __init__ super().__init__(head, **kwargs) File "/home/reza/MiDaS/midas/dpt_depth.py", line 71, in __init__ self.pretrained, self.scratch = _make_encoder( File "/home/reza/MiDaS/midas/blocks.py", line 90, in _make_encoder pretrained = _make_pretrained_levit_384( File "/home/reza/MiDaS/midas/backbones/levit.py", line 103, in _make_pretrained_levit_384 return _make_levit_backbone( File "/home/reza/MiDaS/midas/backbones/levit.py", line 31, in _make_levit_backbone pretrained.model.blocks[hooks[0]].register_forward_hook(get_activation("1")) File "/home/reza/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1614, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LevitDistilled' object has no attribute 'blocks'

reza-shahriari avatar Jul 22 '23 08:07 reza-shahriari

Same issue here

peterw2333 avatar Jul 31 '23 15:07 peterw2333

Same issue here

sjanbs avatar Aug 23 '23 02:08 sjanbs

Same issue here

Michaelsladkov avatar Dec 08 '23 10:12 Michaelsladkov

Same issue here

ZoenkitZ avatar Apr 26 '24 16:04 ZoenkitZ