16
16
import json
17
17
import logging
18
18
import os
19
+ from typing import Dict
19
20
import uuid
20
21
from abc import ABCMeta , abstractmethod
21
22
@@ -582,7 +583,7 @@ def _get_or_create_name(self, name=None):
582
583
return name_from_base (self .base_job_name )
583
584
584
585
@staticmethod
585
- def _json_encode_hyperparameters (hyperparameters ) :
586
+ def _json_encode_hyperparameters (hyperparameters : dict ) -> dict :
586
587
"""Applies Json encoding for certain Hyperparameter types, returns hyperparameters.
587
588
588
589
Args:
@@ -661,14 +662,14 @@ def _prepare_for_training(self, job_name=None):
661
662
self ._prepare_debugger_for_training ()
662
663
self ._prepare_profiler_for_training ()
663
664
664
- def _script_mode_hyperparam_update (self , code_dir , script ) :
665
+ def _script_mode_hyperparam_update (self , code_dir : str , script : str ) -> None :
665
666
"""Applies in-place update to hyperparameters required for script mode with training.
666
667
667
668
Args:
668
669
code_dir (str): The directory hosting the training scripts.
669
670
script (str): The relative filepath of the training entry-point script.
670
671
"""
671
- hyperparams = {}
672
+ hyperparams : Dict [ str , str ] = {}
672
673
hyperparams [DIR_PARAM_NAME ] = code_dir
673
674
hyperparams [SCRIPT_PARAM_NAME ] = script
674
675
hyperparams [CONTAINER_LOG_LEVEL_PARAM_NAME ] = self .container_log_level
@@ -677,7 +678,7 @@ def _script_mode_hyperparam_update(self, code_dir, script):
677
678
678
679
self ._hyperparameters .update (EstimatorBase ._json_encode_hyperparameters (hyperparams ))
679
680
680
- def _stage_user_code_in_s3 (self ):
681
+ def _stage_user_code_in_s3 (self ) -> str :
681
682
"""Upload the user training script to s3 and return the location.
682
683
683
684
Returns: s3 uri
@@ -2615,14 +2616,14 @@ def _prepare_for_training(self, job_name=None):
2615
2616
2616
2617
self ._validate_and_set_debugger_configs ()
2617
2618
2618
- def _script_mode_hyperparam_update (self , code_dir , script ) :
2619
+ def _script_mode_hyperparam_update (self , code_dir : str , script : str ) -> None :
2619
2620
"""Applies in-place update to hyperparameters required for script mode with training.
2620
2621
2621
2622
Args:
2622
2623
code_dir (str): The directory hosting the training scripts.
2623
2624
script (str): The relative filepath of the training entry-point script.
2624
2625
"""
2625
- hyperparams = {}
2626
+ hyperparams : Dict [ str , str ] = {}
2626
2627
hyperparams [DIR_PARAM_NAME ] = code_dir
2627
2628
hyperparams [SCRIPT_PARAM_NAME ] = script
2628
2629
hyperparams [CONTAINER_LOG_LEVEL_PARAM_NAME ] = self .container_log_level
0 commit comments