From e91d526bb2571889f84804f15001f23466693d00 Mon Sep 17 00:00:00 2001 From: Ashir Mumtaz <110593054+ashirmumtaz@users.noreply.github.com> Date: Sun, 29 Dec 2024 23:28:06 +0500 Subject: [PATCH] Update train.py This approach effectively retrieves the directory path of the current Python script, which can be useful for various purposes, such as: Reading or writing files relative to the script's location: You can construct file paths relative to the script's directory, making your code more portable. Loading resources: If your script needs to access resources like images, data files, or configuration files, you can use the script's directory as the base path. without this file through error: module not found (foldingdiff) --- bin/train.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/train.py b/bin/train.py index 7938b24..866ffc2 100644 --- a/bin/train.py +++ b/bin/train.py @@ -27,7 +27,8 @@ from pytorch_lightning.strategies.ddp import DDPStrategy from transformers import BertConfig - +# Add parent directory to Python path +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) from foldingdiff import datasets from foldingdiff import modelling from foldingdiff import losses