Skip to content

Commit a317edd

Browse files
authored
Fix TuningStep validation error by adding V3 HyperparameterTuner duck typing support (#5344)
1 parent 41f9aa3 commit a317edd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sagemaker-core/src/sagemaker/core/workflow/pipeline_context.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -382,11 +382,11 @@ def retrieve_caller_name(job_instance):
382382
if isinstance(job_instance, Transformer):
383383
return "transform"
384384

385-
# Duck typing for HyperparameterTuner: has 'fit' method and 'best_estimator' method
386-
# This avoids importing from sagemaker.train which would violate architecture
387-
if hasattr(job_instance, 'fit') and hasattr(job_instance, 'best_estimator'):
385+
# Duck typing for HyperparameterTuner: has 'tune' method and 'model_trainer' attribute
386+
# This covers both V2 (fit/best_estimator) and V3 (tune/model_trainer) implementations
387+
if (hasattr(job_instance, 'fit') and hasattr(job_instance, 'best_estimator')) or \
388+
(hasattr(job_instance, 'tune') and hasattr(job_instance, 'model_trainer')):
388389
return "tune"
389-
390390
# if isinstance(job_instance, AutoML):
391391
# return "auto_ml"
392392

0 commit comments

Comments
 (0)