When creating a command for subprocess to run it doesnt find the file even though the path to the file is the correct path.
My environment is inside an ssh, with pytorch 2.1, cuda 12.2, python 3.10.12
Here’s what I tried with the error messages as well:
command = [
"python",
f"{cwd}/mmdetection/tools/train.py",
f"{project_folder}/{model_config_file}",
"--auto-scale-lr",
"--work-dir", f"{project_folder}/train_output"
]
subprocess.run(command)
FileNotFoundError: file "/home/MMDetection/script_headvhelmet_test/retinanet_r50_fpn_1x_coco" does not exist.
It doesn’t find the {project_folder}/{model_config_file} path but here’s the interesting thing; if I run the command exactly the same except I add “.py” I get this error:
command = [
"python",
f"{cwd}/mmdetection/tools/train.py",
f"{project_folder}/{model_config_file}.py",
"--auto-scale-lr",
"--work-dir", f"{project_folder}/train_output"
]
subprocess.run(command)
FileNotFoundError: [Errno 2] No such file or directory: '/home/MMDetection/script_headvhelmet_test/retinanet_r50_fpn_1x_coco_script_headvhelmet_test.py.py'
So if you noticed the end of the file path was changed from:
retinanet_r50_fpn_1x_coco
to:
retinanet_r50_fpn_1x_coco_script_headvhelmet_test.py.py
The second path is the correct path except the additional “.py” that I added in the command. But without the “.py” in the command it doesnt find the rest of the path, and especially not with a “.py” at the end.
These commands are run back to back so the model_config_file
variable never changes