18
18
19
19
20
20
class TrainingCompilerConfig (object ):
21
- """The configuration class for accelerating SageMaker training jobs through compilation.
22
-
23
- SageMaker Training Compiler speeds up training by optimizing the model execution graph.
24
-
25
- """
21
+ """The SageMaker Training Compiler configuration class."""
26
22
27
23
DEBUG_PATH = "/opt/ml/output/data/compiler/"
28
24
SUPPORTED_INSTANCE_CLASS_PREFIXES = ["p3" , "g4dn" , "p4" ]
@@ -37,9 +33,15 @@ def __init__(
37
33
):
38
34
"""This class initializes a ``TrainingCompilerConfig`` instance.
39
35
40
- Pass the output of it to the ``compiler_config``
36
+ `Amazon SageMaker Training Compiler
37
+ <https://docs.aws.amazon.com/sagemaker/latest/dg/training-compiler.html>`_
38
+ is a feature of SageMaker Training
39
+ and speeds up training jobs by optimizing model execution graphs.
40
+
41
+ You can compile Hugging Face models
42
+ by passing the object of this configuration class to the ``compiler_config``
41
43
parameter of the :class:`~sagemaker.huggingface.HuggingFace`
42
- class .
44
+ estimator .
43
45
44
46
Args:
45
47
enabled (bool): Optional. Switch to enable SageMaker Training Compiler.
@@ -48,13 +50,28 @@ def __init__(
48
50
This comes with a potential performance slowdown.
49
51
The default is ``False``.
50
52
51
- **Example**: The following example shows the basic ``compiler_config``
52
- parameter configuration, enabling compilation with default parameter values.
53
+ **Example**: The following code shows the basic usage of the
54
+ :class:`sagemaker.huggingface.TrainingCompilerConfig()` class
55
+ to run a HuggingFace training job with the compiler.
53
56
54
57
.. code-block:: python
55
58
56
- from sagemaker.huggingface import TrainingCompilerConfig
57
- compiler_config = TrainingCompilerConfig()
59
+ from sagemaker.huggingface import HuggingFace, TrainingCompilerConfig
60
+
61
+ huggingface_estimator=HuggingFace(
62
+ ...
63
+ compiler_config=TrainingCompilerConfig()
64
+ )
65
+
66
+ .. seealso::
67
+
68
+ For more information about how to enable SageMaker Training Compiler
69
+ for various training settings such as using TensorFlow-based models,
70
+ PyTorch-based models, and distributed training,
71
+ see `Enable SageMaker Training Compiler
72
+ <https://docs.aws.amazon.com/sagemaker/latest/dg/training-compiler-enable.html>`_
73
+ in the `Amazon SageMaker Training Compiler developer guide
74
+ <https://docs.aws.amazon.com/sagemaker/latest/dg/training-compiler.html>`_.
58
75
59
76
"""
60
77
0 commit comments