Midas disco diffusion – FileNotFoundError: No such file or directory: './externals/Next_ViT/classification/nextvit.py'
Question:
I am working on a new project and it shows an error when i run the Midas function.
Below is the error log:-
FileNotFoundError Traceback (most recent call last)
<ipython-input-39-1d47f7ced3c1> in <module>
1 #@title ### 1.4 Define Midas functions
2
----> 3 from midas.dpt_depth import DPTDepthModel
4 from midas.midas_net import MidasNet
5 from midas.midas_net_custom import MidasNet_small
/content/MiDaS/midas/backbones/next_vit.py in <module>
6 from .utils import activations, forward_default, get_activation
7
----> 8 file = open("./externals/Next_ViT/classification/nextvit.py", "r")
9 source_code = file.read().replace(" utils", " externals.Next_ViT.classification.utils")
10 exec(source_code)
FileNotFoundError: [Errno 2] No such file or directory: './externals/Next_ViT/classification/nextvit.py'
Answers:
MiDaS updated to Version 3.1 and the file you are expecting is changed.
Go to the file /content/MiDas/midas/backbones/next_vit.py
and edit the line
file = open("./externals/Next_ViT/classification/nextvit.py","r")
to
file = open("/content/MiDas/midas/backbones/vit.py","r")
The issue is already discussed in the github discussion
I am working on a new project and it shows an error when i run the Midas function.
Below is the error log:-
FileNotFoundError Traceback (most recent call last)
<ipython-input-39-1d47f7ced3c1> in <module>
1 #@title ### 1.4 Define Midas functions
2
----> 3 from midas.dpt_depth import DPTDepthModel
4 from midas.midas_net import MidasNet
5 from midas.midas_net_custom import MidasNet_small
/content/MiDaS/midas/backbones/next_vit.py in <module>
6 from .utils import activations, forward_default, get_activation
7
----> 8 file = open("./externals/Next_ViT/classification/nextvit.py", "r")
9 source_code = file.read().replace(" utils", " externals.Next_ViT.classification.utils")
10 exec(source_code)
FileNotFoundError: [Errno 2] No such file or directory: './externals/Next_ViT/classification/nextvit.py'
MiDaS updated to Version 3.1 and the file you are expecting is changed.
Go to the file /content/MiDas/midas/backbones/next_vit.py
and edit the line
file = open("./externals/Next_ViT/classification/nextvit.py","r")
to
file = open("/content/MiDas/midas/backbones/vit.py","r")
The issue is already discussed in the github discussion