'having problems in giving directory in colab

I am trying to run a file called train.py as well as creating a .ipynb file to act as my Command prompt. currently, I am in directory 1 containing 1.1 and 1.2, etc each folder has its own subfolders for example 1.1 contains 1.1.1 and 1.1.2 and also some files

I call

python3 1/1.1/1.1.1/train.py --x directory_a --y directory_b --z direcotory_c etc

in my cmd.ipynb and everything goes well

now I have a problem I want now to treat train.py as train.ipynb. in other words, I want to run different parts of the train code ( and later, other .py files) in colab in different cells. to clarify more I want to set x , y, z , etc in train.ipynb manually instead of parsing them and calling as above.

but the problem is that when I have cmd.ipynb and I run the above command, I can use the absolute path of arguments I need which are in different directories

but I cannot do the same thing by running train.ipynb, because if I am in a directory, the notebook doesn't accept a path from the previous directory

to give an specific example. first i need to import some files in "networks" folder which is in same directory of train.ipynb ( or train.py) if i %cd to this directory i can import libraries in this folder. but i also need to import some images for training which are in previous directory or my pretrained model is in another directory

I hope I clarified the problem .any solution for this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source