Skip to content

Commit 6122fb2

Browse files
992XXichao Wang
andauthored
feat(train): add the interactive Training Sessions client surface (#6452)
Adds the interactive Training Sessions client surface to sagemaker-train. * ServiceClient / TrainingClient / SamplingClient, exposed lazily from sagemaker.train * Typed request and result models, futures, and exception hierarchy * Session lifecycle management with refcounted handles and idempotent stop * Reference docs for the new modules under docs/api/sagemaker_train.rst * A "tokenizer" extra for the optional transformers dependency that get_tokenizer() needs The clients call the Training Sessions control plane and runtime through boto3, both of which are available in the public botocore release, so no vendored service models ship in the wheel. Co-authored-by: Xichao Wang <xichao@amazon.com>
1 parent 17b6396 commit 6122fb2

31 files changed

Lines changed: 20985 additions & 1 deletion

‎docs/api/sagemaker_train.rst‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,44 @@ Multi-Turn RL Training
3939
:undoc-members:
4040
:show-inheritance:
4141

42+
Interactive Training Sessions
43+
-----------------------------
44+
45+
.. automodule:: sagemaker.train.training_session
46+
:members:
47+
:undoc-members:
48+
:show-inheritance:
49+
50+
.. automodule:: sagemaker.train.training_session.service_client
51+
:members:
52+
:undoc-members:
53+
:show-inheritance:
54+
55+
.. automodule:: sagemaker.train.training_session.training_client
56+
:members:
57+
:undoc-members:
58+
:show-inheritance:
59+
60+
.. automodule:: sagemaker.train.training_session.sampling_client
61+
:members:
62+
:undoc-members:
63+
:show-inheritance:
64+
65+
.. automodule:: sagemaker.train.training_session.types
66+
:members:
67+
:undoc-members:
68+
:show-inheritance:
69+
70+
.. automodule:: sagemaker.train.training_session.futures
71+
:members:
72+
:undoc-members:
73+
:show-inheritance:
74+
75+
.. automodule:: sagemaker.train.training_session.exceptions
76+
:members:
77+
:undoc-members:
78+
:show-inheritance:
79+
4280
Model Evaluation
4381
----------------
4482

‎sagemaker-train/pyproject.toml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ Homepage = "https://github.com/aws/sagemaker-python-sdk"
5353
[project.optional-dependencies]
5454
rft-strands = ["strands-agents"]
5555
rft-langchain = ["httpx>=0.24.0"]
56+
tokenizer = ["transformers"]
5657
test = [
5758
"pytest",
5859
"pytest-cov",
@@ -63,7 +64,8 @@ test = [
6364
"scipy",
6465
"omegaconf",
6566
"graphene",
66-
"IPython"
67+
"IPython",
68+
"transformers",
6769
]
6870
notebook = [
6971
"ipywidgets>=8.0.0",

‎sagemaker-train/src/sagemaker/train/__init__.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,4 +158,16 @@ def __getattr__(name):
158158
from sagemaker.train.common_utils.finetune_utils import list_hyperparameters
159159

160160
return list_hyperparameters
161+
elif name == "ServiceClient":
162+
from sagemaker.train.training_session import ServiceClient
163+
164+
return ServiceClient
165+
elif name == "TrainingClient":
166+
from sagemaker.train.training_session import TrainingClient
167+
168+
return TrainingClient
169+
elif name == "SamplingClient":
170+
from sagemaker.train.training_session import SamplingClient
171+
172+
return SamplingClient
161173
raise AttributeError(f"module '{__name__}' has no attribute '{name}'")

0 commit comments

Comments
 (0)