Depth-Anything icon indicating copy to clipboard operation
Depth-Anything copied to clipboard

Unable to load pre-trained model, unexpected keyword argument 'antagonists'(has been resolved)

Open xbxbcvoo opened this issue 1 year ago • 2 comments

I followed the instructions and placed the pytorch_model. bin and config.json files in the same specified folder, and made modifications to depth-anything. However, I encountered an error while running run.py: TypeError: interpolate() got an unexpected keyword argument 'antagonists' 1

Can anyone guide me on how to solve this problem? Thank you very much

xbxbcvoo avatar Feb 20 '24 11:02 xbxbcvoo

It looks like the pytorch interpolate function got updated between versions 1.10 and 1.11 to include the antialias keyword.

So most likely, the error you're getting is from using an older version of pytorch that doesn't support that keyword.

One way to fix the problem would be to update your pytorch installation (i.e. using conda or pip, depending on how it's installed) to a newer version, it needs to be at least v1.11 or higher. That may cause other problems depending gpu support and versions of other libraries (e.g. torchvision), so an alternative solution would be to simply comment out the line that's causing the error. You should find it on line 204 in the file: torchhub > facebookresearch_dinov2_main > vision_transformer.py

heyoeyo avatar Feb 20 '24 14:02 heyoeyo

It looks like the pytorch interpolate function got updated between versions 1.10 and 1.11 to include the antialias keyword.

So most likely, the error you're getting is from using an older version of pytorch that doesn't support that keyword.

One way to fix the problem would be to update your pytorch installation (i.e. using conda or pip, depending on how it's installed) to a newer version, it needs to be at least v1.11 or higher. That may cause other problems depending gpu support and versions of other libraries (e.g. torchvision), so an alternative solution would be to simply comment out the line that's causing the error. You should find it on line 204 in the file: torchhub > facebookresearch_dinov2_main > vision_transformer.py

In fact, the PyTorch version I am using is 1.9, but it still has this error. But after listening to your suggestion and commenting out the line 204, it works! Thank you very much for your suggestion :)

xbxbcvoo avatar Feb 20 '24 19:02 xbxbcvoo