Skip to content

create_model() method on HyperparameterTuner #3469

@athewsey

Description

@athewsey

Describe the feature you'd like

HyperparameterTuner should offer a create_model(...) method similar to Estimator.create_model(), to support consistent workflows on one-shot-trained vs HPO-tuned models.

The method should automatically select the best training job from the HPO run as the candidate to create.

How would this feature be used? Please describe.

Although the estimator.deploy(...) and API is convenient, it abstracts a lot of complexity (traversing Model > EndpointConfig > Endpoint in the service APIs) that's sometimes useful to keep a handle on.

I have a project that goes via model instead, like this:

model = estimator.create_model(...)
model.create()

predictor = model.deploy(...)

...Because it's then easy to delete the Model, or edit or force re-creation of it in the middle.

If HyperparameterTuner added an equivalent create_model() method, this workflow would seamlessly port across to HPO-tuned models too - like this:

model = tuner.create_model(...)  # Currently not supported
model.create()

predictor = model.deploy(...)
model.register(...)

Describe alternatives you've considered

As mentioned way back in #642, it is already possible to trace from tuner to an equivalent Estimator for the best training job - and create a model from there:

estimator = sagemaker.estimator.Estimator.attach(tuner.best_training_job())
estimator.create_model(...)
...

As far as I'm aware, tracking back from a predictor to a model is also possible but requires either dropping to boto3 or using private methods like:

model = sagemaker.Model(predictor._get_model_names()[0])

Since HyperparameterTuner already offers a deploy() API mirroring Estimator though, IMO it'd be much nicer for usability if create_model() was available too.

Additional context

By similar argument I'd probably also ask HyperparameterTuner support transformer(...) and register_model(...) methods like Estimator does today... But not sure if those would be better bundled here or independent feature requests.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions