def validate()

in src/sagemaker/training_compiler/config.py [0:0]


    def validate(cls, estimator):
        """Checks if SageMaker Training Compiler is configured correctly.

        Args:
            estimator (:class:`sagemaker.estimator.Estimator`): An estimator object.
                When SageMaker Training Compiler is enabled, it validates if
                the estimator is configured to be compatible with Training Compiler.


        Raises:
            ValueError: Raised if the requested configuration is not compatible
                        with SageMaker Training Compiler.
        """
        if is_pipeline_variable(estimator.instance_type):
            warn_msg = (
                "Estimator instance_type is a PipelineVariable (%s), "
                "which has to be interpreted as one of the "
                "%s classes in execution time."
            )
            logger.warning(
                warn_msg,
                type(estimator.instance_type),
                str(cls.SUPPORTED_INSTANCE_CLASS_PREFIXES).replace(",", ""),
            )
        elif estimator.instance_type:
            if "local" not in estimator.instance_type:
                requested_instance_class = estimator.instance_type.split(".")[
                    1
                ]  # Expecting ml.class.size
                if not any(
                    [requested_instance_class == i for i in cls.SUPPORTED_INSTANCE_CLASS_PREFIXES]
                ):
                    error_helper_string = (
                        "Unsupported Instance class {}."
                        "SageMaker Training Compiler only supports {}"
                    )
                    error_helper_string = error_helper_string.format(
                        requested_instance_class, cls.SUPPORTED_INSTANCE_CLASS_PREFIXES
                    )
                    raise ValueError(error_helper_string)
            elif estimator.instance_type == "local":
                error_helper_string = (
                    "SageMaker Training Compiler doesn't support local mode."
                    "It only supports the following GPU instances: {}"
                )
                error_helper_string = error_helper_string.format(
                    cls.SUPPORTED_INSTANCE_CLASS_PREFIXES
                )
                raise ValueError(error_helper_string)

        if estimator.distribution and "smdistributed" in estimator.distribution:
            raise ValueError(
                "SageMaker distributed training configuration is currently not compatible with "
                "SageMaker Training Compiler."
            )

        if estimator.debugger_hook_config or (not estimator.disable_profiler):
            helper_string = (
                "Using Debugger and/or Profiler with SageMaker Training Compiler "
                "might add recompilation overhead and degrade"
                "performance. Found debugger_hook_config={} "
                "disable_profiler={}. Please set "
                "debugger_hook_config=None and disable_profiler=True for optimal "
                "performance. For more information, see Training Compiler "
                "Performance Considerations "
                "(https://docs.aws.amazon.com/sagemaker/latest/dg/training-compiler-tips-pitfalls.html"
                "#training-compiler-tips-pitfalls-considerations)."
            )
            helper_string = helper_string.format(
                estimator.debugger_hook_config, estimator.disable_profiler
            )
            logger.warning(helper_string)

        if estimator.instance_groups:
            raise ValueError(
                "SageMaker Training Compiler currently only supports homogeneous clusters of "
                "the following GPU instance families: {}. Please use the 'instance_type' "
                "and 'instance_count' parameters instead of 'instance_groups'".format(
                    cls.SUPPORTED_INSTANCE_CLASS_PREFIXES
                )
            )