You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I run this demo.ipynb, I encounter the following import error. Theoretically, Python should be able to successfully import from the current directory using ..utils.easydict. Can you explain why this is happening?
ImportError Traceback (most recent call last)
Cell In[1], line 8
4 import cv2
6 import torch
----> 8 from config import (Config,
9 eval_dict_leaf)
11 from utils import (retrieve_text,
12 _frame_from_video,
13 setup_internvideo2)
File InternVideo-main/InternVideo2/multi_modality/demo/config.py:17
13 from importlib import import_module
15 import yaml
---> 17 from ..utils.easydict import EasyDict
19 all = ["Config", "pretty_text"]
22 BASE_KEY = "base"
ImportError: attempted relative import with no known parent package
The text was updated successfully, but these errors were encountered:
__init__.py: This empty file signals to Python that the my_project directory is a package.
Method2:
Absolute Imports: If you don't want to create a package structure, use absolute imports:
from InternVideo-main.InternVideo2.multi_modality.utils.easydict import EasyDict
This assumes your my_project directory is on your Python path (either in your PYTHONPATH environment variable or in a location Python searches by default).
When I run this demo.ipynb, I encounter the following import error. Theoretically, Python should be able to successfully import from the current directory using ..utils.easydict. Can you explain why this is happening?
ImportError Traceback (most recent call last)
Cell In[1], line 8
4 import cv2
6 import torch
----> 8 from config import (Config,
9 eval_dict_leaf)
11 from utils import (retrieve_text,
12 _frame_from_video,
13 setup_internvideo2)
File InternVideo-main/InternVideo2/multi_modality/demo/config.py:17
13 from importlib import import_module
15 import yaml
---> 17 from ..utils.easydict import EasyDict
19 all = ["Config", "pretty_text"]
22 BASE_KEY = "base"
ImportError: attempted relative import with no known parent package
The text was updated successfully, but these errors were encountered: