What did you find confusing? Please describe.
I find it very counterintuitive that the encoding of the hyperparameters depends on the presence of source_dir behind the scenes. I wasted a lot of time debugging this issue after I moved to a setup with no source_dir. Ideally, this should not happen and, in any case, this should not be a detail that's hidden deep inside.
See:
|
def set_hyperparameters(self, **kwargs): |
|
"""Sets the hyperparameter dictionary to use for training. |
|
|
|
The hyperparameters are made accessible as a dict[str, str] to the |
|
training code on SageMaker. For convenience, this accepts other types |
|
for keys and values, but ``str()`` will be called to convert them before |
|
training. |
|
|
|
If a source directory is specified, this method escapes the dict argument as JSON, |
|
and updates the private hyperparameter attribute. |
|
""" |
|
if self.source_dir: |
|
self._hyperparameters.update(EstimatorBase._json_encode_hyperparameters(kwargs)) |
|
else: |
|
for k, v in kwargs.items(): |
|
self._hyperparameters[k] = v |
Describe how documentation can be improved
This behavior should ideally NOT exist. However, if there are strong reasons for this, at least it should be mentioned in the docstring for source_dir and/or hyperparameters.
Additional context

What did you find confusing? Please describe.
I find it very counterintuitive that the encoding of the hyperparameters depends on the presence of
source_dirbehind the scenes. I wasted a lot of time debugging this issue after I moved to a setup with nosource_dir. Ideally, this should not happen and, in any case, this should not be a detail that's hidden deep inside.See:
sagemaker-python-sdk/src/sagemaker/estimator.py
Lines 3283 to 3298 in 2f86ad9
Describe how documentation can be improved
This behavior should ideally NOT exist. However, if there are strong reasons for this, at least it should be mentioned in the docstring for
source_dirand/orhyperparameters.Additional context