-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Describe the bug
When using the Estimator
with the source_dir
and entry_point
parameters, the entry_point
script is required to be at the root of source_dir
. This restriction seems unnecessary and, indeed, not present in the CLI API.
From the docs:
If source_dir is specified, then entry_point must point to a file located at the root of source_dir.
To reproduce
Suppose a code directory structure:
src/
|- code/
| |- script.py
|- config/
| |- config.yaml
The following is not allowed: Estimator(source_dir="src", entry_point="code/script.py")
. Instead, the sagemaker
library will strip the relative path from entry_point
and the job will failed because it cannot find script.py
.
Expected behavior
The entry_point
should support relative paths. Indeed, the CLI API seems to support this without any issue.
Additional context
The solution seems fairly simple: delete this line:
self.entry_point = os.path.basename(self.entry_point)
I'm not sure why it's necessary to strip the relative path. In my local testing, deleting this line seems to fix the issue.