Closed niansong1996 closed 3 years ago
I've updated the `zhangir-azerbayev/evaluation_refactoring' branch to not use relative imports. However, this breaks 'demo.ipynb' because it seems that you cannot 'import SummerTime' from within the 'SummerTime' directory.
There are also other problems related to the demo being within the package. For example, in the demo we have to write 'import model' instead of 'import SummerTime.model'.
I propose we remove the demo from the repository and instead link to it in the readme.
I've updated the `zhangir-azerbayev/evaluation_refactoring' branch to not use relative imports. However, this breaks 'demo.ipynb' because it seems that you cannot 'import SummerTime' from within the 'SummerTime' directory.
There are also other problems related to the demo being within the package. For example, in the demo we have to write 'import model' instead of 'import SummerTime.model'.
@zhangir-azerbayev Interesting, what would happen if you do absolute imports like import model.base_model
rather than import SummerTime.mode.base_model
? I've always been using the previous way, I think the reason you can use the second way is because you did python setup.py install/develop
, which installed it locally so you can reference it like an external lib.
This is no longer relevant.
I recently found that relative import can easily break things. So let's try to use absolute import.
In case someone doesn't know what this means: if you are trying to import
SummModel
inmodel/base_model.py
frommodel/bart_model.py
usefrom model.base_model import SummModel
rather thanfrom .base_model import SummModel