lpiccinelli-eth / UniDepth

Universal Monocular Metric Depth Estimation
Other
462 stars 39 forks source link

from unidepth.models import UniDepthV1HF error: #20

Closed wrx1990 closed 2 months ago

wrx1990 commented 2 months ago

when i import UniDepthV1HF, TypeError:

`--------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In[5], line 1 ----> 1 from unidepth.models import UniDepthV1HF 2 import numpy as np 3 from PIL import Image

File /qe/data/project/project_zxf/Agent/UniDepth_2/UniDepth/unidepth/models/init.py:1 ----> 1 from .unidepthv1 import UniDepthV1 3 all = [ 4 "UniDepthV1", 5 ]

File /qe/data/project/project_zxf/Agent/UniDepth_2/UniDepth/unidepth/models/unidepthv1/init.py:1 ----> 1 from .unidepthv1 import UniDepthV1 3 all = [ 4 "UniDepthV1", 5 ]

File /qe/data/project/project_zxf/Agent/UniDepth_2/UniDepth/unidepth/models/unidepthv1/unidepthv1.py:100 96 intrinsics[:, 1, 2] = (intrinsics[:, 1, 2] - pad_top) / ratio 97 return predictions, intrinsics --> 100 class UniDepthV1(nn.Module, 101 PyTorchModelHubMixin, 102 library_name="UniDepth", 103 repo_url="https://github.com/lpiccinelli-eth/UniDepth", 104 tags=["monocular-metric-depth-estimation"]): 105 def init( 106 self, 107 config, 108 eps: float = 1e-6, 109 **kwargs, 110 ): 111 super().init()

TypeError: UniDepthV1.__init_subclass__() takes no keyword arguments`

how can i solve this problem!

lpiccinelli-eth commented 2 months ago

Thi is due to an old version of huggingface-hub library, you would need to update it to at least 0.22.0 as in the requirements.txt.

Moreover, I think you should pull the latest changes in your local repo. For instance, requirements were amended and we combined UniDepthV1 and UniDepthV1HF classes in one.

wrx1990 commented 2 months ago

UniDepthV1

Thi is due to an old version of huggingface-hub library, you would need to update it to at least 0.22.0 as in the requirements.txt.

Moreover, I think you should pull the latest changes in your local repo. For instance, requirements were amended and we combined UniDepthV1 and UniDepthV1HF classes in one.

thank you!!!it worked