sagemaker-hyperpod 3.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. sagemaker/__init__.py +0 -0
  2. sagemaker/hyperpod/__init__.py +2 -0
  3. sagemaker/hyperpod/cli/__init__.py +0 -0
  4. sagemaker/hyperpod/cli/clients/__init__.py +12 -0
  5. sagemaker/hyperpod/cli/clients/kubernetes_client.py +365 -0
  6. sagemaker/hyperpod/cli/commands/__init__.py +0 -0
  7. sagemaker/hyperpod/cli/commands/cluster.py +627 -0
  8. sagemaker/hyperpod/cli/commands/inference.py +659 -0
  9. sagemaker/hyperpod/cli/commands/training.py +347 -0
  10. sagemaker/hyperpod/cli/constants/__init__.py +0 -0
  11. sagemaker/hyperpod/cli/constants/command_constants.py +105 -0
  12. sagemaker/hyperpod/cli/constants/exception_constants.py +13 -0
  13. sagemaker/hyperpod/cli/constants/hyperpod_instance_types.py +100 -0
  14. sagemaker/hyperpod/cli/constants/kueue_constants.py +17 -0
  15. sagemaker/hyperpod/cli/constants/pytorch_constants.py +15 -0
  16. sagemaker/hyperpod/cli/hyp_cli.py +132 -0
  17. sagemaker/hyperpod/cli/inference_utils.py +121 -0
  18. sagemaker/hyperpod/cli/service/__init__.py +12 -0
  19. sagemaker/hyperpod/cli/service/cancel_training_job.py +70 -0
  20. sagemaker/hyperpod/cli/service/discover_namespaces.py +108 -0
  21. sagemaker/hyperpod/cli/service/exec_command.py +75 -0
  22. sagemaker/hyperpod/cli/service/get_logs.py +136 -0
  23. sagemaker/hyperpod/cli/service/get_namespaces.py +59 -0
  24. sagemaker/hyperpod/cli/service/get_training_job.py +110 -0
  25. sagemaker/hyperpod/cli/service/list_pods.py +138 -0
  26. sagemaker/hyperpod/cli/service/list_training_jobs.py +178 -0
  27. sagemaker/hyperpod/cli/service/self_subject_access_review.py +47 -0
  28. sagemaker/hyperpod/cli/telemetry/__init__.py +12 -0
  29. sagemaker/hyperpod/cli/telemetry/user_agent.py +36 -0
  30. sagemaker/hyperpod/cli/templates/__init__.py +12 -0
  31. sagemaker/hyperpod/cli/templates/k8s_pytorch_job_template.py +74 -0
  32. sagemaker/hyperpod/cli/training_utils.py +200 -0
  33. sagemaker/hyperpod/cli/utils.py +183 -0
  34. sagemaker/hyperpod/cli/validators/__init__.py +12 -0
  35. sagemaker/hyperpod/cli/validators/cluster_validator.py +52 -0
  36. sagemaker/hyperpod/cli/validators/job_validator.py +346 -0
  37. sagemaker/hyperpod/cli/validators/validator.py +75 -0
  38. sagemaker/hyperpod/common/__init__.py +0 -0
  39. sagemaker/hyperpod/common/config/__init__.py +1 -0
  40. sagemaker/hyperpod/common/config/metadata.py +18 -0
  41. sagemaker/hyperpod/common/utils.py +299 -0
  42. sagemaker/hyperpod/inference/__init__.py +11 -0
  43. sagemaker/hyperpod/inference/config/__init__.py +0 -0
  44. sagemaker/hyperpod/inference/config/constants.py +18 -0
  45. sagemaker/hyperpod/inference/config/hp_endpoint_config.py +767 -0
  46. sagemaker/hyperpod/inference/config/hp_jumpstart_endpoint_config.py +572 -0
  47. sagemaker/hyperpod/inference/hp_endpoint.py +203 -0
  48. sagemaker/hyperpod/inference/hp_endpoint_base.py +223 -0
  49. sagemaker/hyperpod/inference/hp_jumpstart_endpoint.py +232 -0
  50. sagemaker/hyperpod/observability/MonitoringConfig.py +10 -0
  51. sagemaker/hyperpod/observability/__init__.py +0 -0
  52. sagemaker/hyperpod/observability/constants.py +2 -0
  53. sagemaker/hyperpod/observability/utils.py +64 -0
  54. sagemaker/hyperpod/training/__init__.py +9 -0
  55. sagemaker/hyperpod/training/config/__init__.py +1 -0
  56. sagemaker/hyperpod/training/config/hyperpod_pytorch_job_config.py +2977 -0
  57. sagemaker/hyperpod/training/config/hyperpod_pytorch_job_status.py +3083 -0
  58. sagemaker/hyperpod/training/hyperpod_pytorch_job.py +253 -0
  59. sagemaker_hyperpod-3.0.0.dist-info/METADATA +534 -0
  60. sagemaker_hyperpod-3.0.0.dist-info/RECORD +66 -0
  61. sagemaker_hyperpod-3.0.0.dist-info/WHEEL +5 -0
  62. sagemaker_hyperpod-3.0.0.dist-info/entry_points.txt +2 -0
  63. sagemaker_hyperpod-3.0.0.dist-info/licenses/LICENSE +175 -0
  64. sagemaker_hyperpod-3.0.0.dist-info/licenses/NOTICE +1 -0
  65. sagemaker_hyperpod-3.0.0.dist-info/top_level.txt +1 -0
  66. sagemaker_hyperpod-3.0.0.dist-info/zip-safe +1 -0
@@ -0,0 +1,534 @@
1
+ Metadata-Version: 2.4
2
+ Name: sagemaker-hyperpod
3
+ Version: 3.0.0
4
+ Summary: Amazon SageMaker HyperPod SDK and CLI
5
+ Home-page: https://github.com/aws/sagemaker-hyperpod-cli
6
+ Author: Amazon Web Services
7
+ License: Apache-2.0
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: License :: OSI Approved :: Apache Software License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.8
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Requires-Python: >=3.8
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ License-File: NOTICE
20
+ Requires-Dist: click==8.1.7
21
+ Requires-Dist: awscli>=1.34.9
22
+ Requires-Dist: awscli-cwlogs>=1.4.6
23
+ Requires-Dist: boto3<2.0,>=1.35.3
24
+ Requires-Dist: botocore>=1.35.6
25
+ Requires-Dist: kubernetes==33.1.0
26
+ Requires-Dist: pyyaml==6.0.2
27
+ Requires-Dist: ratelimit==2.2.1
28
+ Requires-Dist: tabulate==0.9.0
29
+ Requires-Dist: itables>=2.2.2
30
+ Requires-Dist: jinja2>=3.1.2
31
+ Requires-Dist: ipywidgets>=8.1.7
32
+ Requires-Dist: hydra-core==1.3.2
33
+ Requires-Dist: omegaconf==2.3
34
+ Requires-Dist: pynvml==11.4.1
35
+ Requires-Dist: requests==2.32.4
36
+ Requires-Dist: tqdm==4.66.5
37
+ Requires-Dist: zstandard==0.15.2
38
+ Requires-Dist: pytest==8.3.2
39
+ Requires-Dist: pytest-cov==5.0.0
40
+ Requires-Dist: pytest-order==1.3.0
41
+ Requires-Dist: tox==4.18.0
42
+ Requires-Dist: ruff==0.6.2
43
+ Requires-Dist: hera-workflows==5.16.3
44
+ Requires-Dist: sagemaker-core<2.0.0
45
+ Requires-Dist: pydantic<3.0.0,>=2.10.6
46
+ Requires-Dist: hyperpod-pytorch-job-template<2.0.0,>=1.0.0
47
+ Requires-Dist: hyperpod-custom-inference-template<2.0.0,>=1.0.0
48
+ Requires-Dist: hyperpod-jumpstart-inference-template<2.0.0,>=1.0.0
49
+ Dynamic: home-page
50
+ Dynamic: license-file
51
+ Dynamic: requires-dist
52
+ Dynamic: requires-python
53
+
54
+
55
+ # SageMaker HyperPod command-line interface
56
+
57
+ The Amazon SageMaker HyperPod command-line interface (HyperPod CLI) is a tool that helps manage training jobs on the SageMaker HyperPod clusters orchestrated by Amazon EKS.
58
+
59
+ This documentation serves as a reference for the available HyperPod CLI commands. For a comprehensive user guide, see [Orchestrating SageMaker HyperPod clusters with Amazon EKS](https://docs.aws.amazon.com/sagemaker/latest/dg/sagemaker-hyperpod-eks.html) in the *Amazon SageMaker Developer Guide*.
60
+
61
+ ## Table of Contents
62
+ - [Overview](#overview)
63
+ - [Prerequisites](#prerequisites)
64
+ - [Platform Support](#platform-support)
65
+ - [ML Framework Support](#ml-framework-support)
66
+ - [Installation](#installation)
67
+ - [Usage](#usage)
68
+ - [Getting Clusters](#getting-cluster-information)
69
+ - [Connecting to a Cluster](#connecting-to-a-cluster)
70
+ - [Getting Cluster Context](#getting-cluster-context)
71
+ - [Listing Pods](#listing-pods)
72
+ - [Accessing Logs](#accessing-logs)
73
+ - [CLI](#cli-)
74
+ - [Training](#training-)
75
+ - [Inference](#inference-)
76
+ - [SDK](#sdk-)
77
+ - [Training](#training-)
78
+ - [Inference](#inference)
79
+
80
+
81
+ ## Overview
82
+
83
+ The SageMaker HyperPod CLI is a tool that helps create training jobs and inference endpoint deployments to the Amazon SageMaker HyperPod clusters orchestrated by Amazon EKS. It provides a set of commands for managing the full lifecycle of jobs, including create, describe, list, and delete operations, as well as accessing pod and operator logs where applicable. The CLI is designed to abstract away the complexity of working directly with Kubernetes for these core actions of managing jobs on SageMaker HyperPod clusters orchestrated by Amazon EKS.
84
+
85
+ ## Prerequisites for Training
86
+
87
+ - HyperPod CLI currently supports starting PyTorchJobs. To start a job, you need to install Training Operator first.
88
+ - You can follow [pytorch operator doc](https://docs.aws.amazon.com/sagemaker/latest/dg/sagemaker-eks-operator-install.html) to install it.
89
+
90
+ ## Prerequisites for Inference
91
+
92
+ - HyperPod CLI supports creating Inference Endpoints through jumpstart and through custom Endpoint config
93
+ - You can follow [inference operator doc](https://github.com/aws/sagemaker-hyperpod-cli/tree/master/helm_chart/HyperPodHelmChart/charts/inference-operator) to install it.
94
+
95
+ ## Platform Support
96
+
97
+ SageMaker HyperPod CLI currently supports Linux and MacOS platforms. Windows platform is not supported now.
98
+
99
+ ## ML Framework Support
100
+
101
+ SageMaker HyperPod CLI currently supports start training job with:
102
+ - PyTorch ML Framework. Version requirements: PyTorch >= 1.10
103
+
104
+ ## Installation
105
+
106
+ 1. Make sure that your local python version is 3.8, 3.9, 3.10 or 3.11.
107
+
108
+ 1. Install ```helm```.
109
+
110
+ The SageMaker Hyperpod CLI uses Helm to start training jobs. See also the [Helm installation guide](https://helm.sh/docs/intro/install/).
111
+
112
+ ```
113
+ curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
114
+ chmod 700 get_helm.sh
115
+ ./get_helm.sh
116
+ rm -f ./get_helm.sh
117
+ ```
118
+
119
+ 1. Clone and install the sagemaker-hyperpod-cli package.
120
+
121
+ ```
122
+ pip install sagemaker-hyperpod
123
+ ```
124
+
125
+ 1. Verify if the installation succeeded by running the following command.
126
+
127
+ ```
128
+ hyperpod --help
129
+ ```
130
+
131
+ 1. If you have a running HyperPod cluster, you can try to run a training job using the sample configuration file provided at ```/examples/basic-job-example-config.yaml```.
132
+ - Get your HyperPod clusters to show their capacities.
133
+ ```
134
+ hyperpod get-clusters
135
+ ```
136
+ - Get your HyperPod clusters to show their capacities and quota allocation info for a team.
137
+ ```
138
+ hyperpod get-clusters -n hyperpod-ns-<team-name>
139
+ ```
140
+ - Connect to one HyperPod cluster and specify a namespace you have access to.
141
+ ```
142
+ hyperpod connect-cluster --cluster-name <cluster-name>
143
+ ```
144
+ - Start a job in your cluster. Change the `instance_type` in the yaml file to be same as the one in your HyperPod cluster. Also change the `namespace` you want to submit a job to, the example uses kubeflow namespace. You need to have installed PyTorch in your cluster.
145
+ ```
146
+ hyperpod start-job --config-file ./examples/basic-job-example-config.yaml
147
+ ```
148
+
149
+ ## Usage
150
+
151
+ The HyperPod CLI provides the following commands:
152
+
153
+ - [Getting Clusters](#getting-cluster-information)
154
+ - [Connecting to a Cluster](#connecting-to-a-cluster)
155
+ - [Getting Cluster Context](#getting-cluster-context)
156
+ - [Listing Pods](#listing-pods)
157
+ - [Accessing Logs](#accessing-logs)
158
+ - [CLI](#cli-)
159
+ - [Training](#training-)
160
+ - [Inference](#inference-)
161
+ - [SDK](#sdk-)
162
+ - [Training](#training-)
163
+ - [Inference](#inference)
164
+
165
+
166
+ ### Getting Cluster information
167
+
168
+ This command lists the available SageMaker HyperPod clusters and their capacity information.
169
+
170
+ ```
171
+ hyp list-cluster [--region <region>] [--namespace <namespace>] [--output <json|table>]
172
+ ```
173
+
174
+ * `region` (string) - Optional. The region that the SageMaker HyperPod and EKS clusters are located. If not specified, it will be set to the region from the current AWS account credentials.
175
+ * `namespace` (string) - Optional. The namespace that users want to check the quota with. Only the SageMaker managed namespaces are supported.
176
+ * `output` (enum) - Optional. The output format. Available values are `table` and `json`. The default value is `json`.
177
+
178
+ ### Connecting to a Cluster
179
+
180
+ This command configures the local Kubectl environment to interact with the specified SageMaker HyperPod cluster and namespace.
181
+
182
+ ```
183
+ hyp set-cluster-context --cluster-name <cluster-name> [--namespace <namespace>]
184
+ ```
185
+
186
+ * `cluster-name` (string) - Required. The SageMaker HyperPod cluster name to configure with.
187
+ * `namespace` (string) - Optional. The namespace that you want to connect to. If not specified, Hyperpod cli commands will auto discover the accessible namespace.
188
+
189
+ ### Getting Cluster Context
190
+
191
+ Get all the context related to the current set Cluster
192
+
193
+ ```
194
+ hyp get-cluster-context
195
+ ```
196
+
197
+ ### Listing Pods
198
+
199
+ This command lists all the pods associated with a specific training job.
200
+
201
+ ```
202
+ hyp list-pods hyp-pytorch-job --job-name <job-name>
203
+ ```
204
+
205
+ * `job-name` (string) - Required. The name of the job to list pods for.
206
+
207
+ ### Accessing Logs
208
+
209
+ This command retrieves the logs for a specific pod within a training job.
210
+
211
+ ```
212
+ hyp get-logs hyp-pytorch-job --pod-name <pod-name> --job-name <job-name>
213
+ ```
214
+
215
+ * `job-name` (string) - Required. The name of the job to get the log for.
216
+ * `pod-name` (string) - Required. The name of the pod to get the log from.
217
+
218
+
219
+ ### CLI
220
+
221
+ ### Training
222
+
223
+ #### Creating a Training Job
224
+
225
+ ```
226
+ hyp create hyp-pytorch-job \
227
+ --version 1.0 \
228
+ --job-name test-pytorch-job \
229
+ --image pytorch/pytorch:latest \
230
+ --command '["python", "train.py"]' \
231
+ --args '["--epochs", "10", "--batch-size", "32"]' \
232
+ --environment '{"PYTORCH_CUDA_ALLOC_CONF": "max_split_size_mb:32"}' \
233
+ --pull-policy "IfNotPresent" \
234
+ --instance-type ml.p4d.24xlarge \
235
+ --tasks-per-node 8 \
236
+ --label-selector '{"accelerator": "nvidia", "network": "efa"}' \
237
+ --deep-health-check-passed-nodes-only true \
238
+ --scheduler-type "kueue" \
239
+ --queue-name "training-queue" \
240
+ --priority "high" \
241
+ --max-retry 3 \
242
+ --volumes '["data-vol", "model-vol", "checkpoint-vol"]' \
243
+ --persistent-volume-claims '["shared-data-pvc", "model-registry-pvc"]' \
244
+ --output-s3-uri s3://my-bucket/model-artifacts
245
+ ```
246
+
247
+ Key required parameters explained:
248
+
249
+ --job-name: Unique identifier for your training job
250
+
251
+ --image: Docker image containing your training environment
252
+
253
+ This command starts a training job named test-pytorch-job. The --output-s3-uri specifies where the trained model artifacts will be stored, for example, s3://my-bucket/model-artifacts. Note this location, as you’ll need it for deploying the custom model.
254
+
255
+ ### Inference
256
+
257
+ #### Creating a JumpstartModel Endpoint
258
+
259
+ Pre-trained Jumpstart models can be gotten from https://sagemaker.readthedocs.io/en/v2.82.0/doc_utils/jumpstart.html and fed into the call for creating the endpoint
260
+
261
+ ```
262
+ hyp create hyp-jumpstart-endpoint \
263
+ --version 1.0 \
264
+ --model-id jumpstart-model-id\
265
+ --instance-type ml.g5.8xlarge \
266
+ --endpoint-name endpoint-jumpstart \
267
+ --tls-output-s3-uri s3://sample-bucket
268
+ ```
269
+
270
+
271
+ #### Invoke a JumpstartModel Endpoint
272
+
273
+ ```
274
+ hyp invoke hyp-jumpstart-endpoint \
275
+ --endpoint-name endpoint-jumpstart \
276
+ --body '{"inputs":"What is the capital of USA?"}'
277
+ ```
278
+
279
+ #### Managing an Endpoint
280
+
281
+ ```
282
+ hyp list hyp-jumpstart-endpoint
283
+ hyp get hyp-jumpstart-endpoint --name endpoint-jumpstart
284
+ ```
285
+
286
+ #### Creating a Custom Inference Endpoint
287
+
288
+ ```
289
+ hyp create hyp-custom-endpoint \
290
+ --version 1.0 \
291
+ --endpoint-name my-custom-endpoint \
292
+ --model-name my-pytorch-model \
293
+ --model-source-type s3 \
294
+ --model-location my-pytorch-training/model.tar.gz \
295
+ --s3-bucket-name your-bucket \
296
+ --s3-region us-east-1 \
297
+ --instance-type ml.g5.8xlarge \
298
+ --image-uri 763104351884.dkr.ecr.us-east-1.amazonaws.com/pytorch-inference:latest \
299
+ --container-port 8080
300
+
301
+ ```
302
+
303
+ #### Invoke a Custom Inference Endpoint
304
+
305
+ ```
306
+ hyp invoke hyp-custom-endpoint \
307
+ --endpoint-name endpoint-custom-pytorch \
308
+ --body '{"inputs":"What is the capital of USA?"}'
309
+
310
+ ```
311
+
312
+ #### Deleting an Endpoint
313
+
314
+ ```
315
+ hyp delete hyp-jumpstart-endpoint --name endpoint-jumpstart
316
+ ```
317
+
318
+
319
+ ## SDK
320
+
321
+ Along with the CLI, we also have SDKs available that can perform the training and inference functionalities that the CLI performs
322
+
323
+ ### Training
324
+
325
+ #### Creating a Training Job
326
+
327
+ ```
328
+
329
+ from sagemaker.hyperpod import HyperPodPytorchJob
330
+ from sagemaker.hyperpod.job
331
+ import ReplicaSpec, Template, Spec, Container, Resources, RunPolicy, Metadata
332
+
333
+ # Define job specifications
334
+ nproc_per_node = "1" # Number of processes per node
335
+ replica_specs =
336
+ [
337
+ ReplicaSpec
338
+ (
339
+ name = "pod", # Replica name
340
+ template = Template
341
+ (
342
+ spec = Spec
343
+ (
344
+ containers =
345
+ [
346
+ Container
347
+ (
348
+ # Container name
349
+ name="container-name",
350
+
351
+ # Training image
352
+ image="123456789012.dkr.ecr.us-west-2.amazonaws.com/my-training-image:latest",
353
+
354
+ # Always pull image
355
+ image_pull_policy="Always",
356
+ resources=Resources\
357
+ (
358
+ # No GPUs requested
359
+ requests={"nvidia.com/gpu": "0"},
360
+ # No GPU limit
361
+ limits={"nvidia.com/gpu": "0"},
362
+ ),
363
+ # Command to run
364
+ command=["python", "train.py"],
365
+ # Script arguments
366
+ args=["--epochs", "10", "--batch-size", "32"],
367
+ )
368
+ ]
369
+ )
370
+ ),
371
+ )
372
+ ]
373
+ # Keep pods after completion
374
+ run_policy = RunPolicy(clean_pod_policy="None")
375
+
376
+ # Create and start the PyTorch job
377
+ pytorch_job = HyperPodPytorchJob
378
+ (
379
+ # Job name
380
+ metadata = Metadata(name="demo"),
381
+ # Processes per node
382
+ nproc_per_node = nproc_per_node,
383
+ # Replica specifications
384
+ replica_specs = replica_specs,
385
+ # Run policy
386
+ run_policy = run_policy,
387
+ # S3 location for artifacts
388
+ output_s3_uri="s3://my-bucket/model-artifacts"
389
+ )
390
+ # Launch the job
391
+ pytorch_job.create()
392
+
393
+
394
+ ```
395
+
396
+
397
+
398
+ ### Inference
399
+
400
+ #### Creating a JumpstartModel Endpoint
401
+
402
+ Pre-trained Jumpstart models can be gotten from https://sagemaker.readthedocs.io/en/v2.82.0/doc_utils/jumpstart.html and fed into the call for creating the endpoint
403
+
404
+ ```
405
+ from sagemaker.hyperpod.inference.config.hp_jumpstart_endpoint_config import Model, Server, SageMakerEndpoint, TlsConfig
406
+ from sagemaker.hyperpod.inference.hp_jumpstart_endpoint import HPJumpStartEndpoint
407
+
408
+ model = Model(
409
+ model_id="deepseek-llm-r1-distill-qwen-1-5b",
410
+ model_version="2.0.4"
411
+ )
412
+
413
+ server = Server(
414
+ instance_type="ml.g5.8xlarge"
415
+ )
416
+
417
+ endpoint_name = SageMakerEndpoint(name="endpoint-jumpstart")
418
+
419
+ tls_config = TlsConfig(tls_certificate_output_s3_uri="s3://sample-bucket")
420
+
421
+ js_endpoint = HPJumpStartEndpoint(
422
+ model=model,
423
+ server=server,
424
+ sage_maker_endpoint=endpoint_name,
425
+ tls_config=tls_config
426
+ )
427
+
428
+ js_endpoint.create()
429
+ ```
430
+
431
+
432
+ #### Invoke a JumpstartModel Endpoint
433
+
434
+ ```
435
+ data = '{"inputs":"What is the capital of USA?"}'
436
+ response = js_endpoint.invoke(body=data).body.read()
437
+ print(response)
438
+ ```
439
+
440
+
441
+ #### Creating a Custom Inference Endpoint
442
+
443
+ ```
444
+ from sagemaker.hyperpod.inference.config.hp_custom_endpoint_config import Model, Server, SageMakerEndpoint, TlsConfig, EnvironmentVariables
445
+ from sagemaker.hyperpod.inference.hp_custom_endpoint import HPCustomEndpoint
446
+
447
+ model = Model(
448
+ model_source_type="s3",
449
+ model_location="test-pytorch-job/model.tar.gz",
450
+ s3_bucket_name="my-bucket",
451
+ s3_region="us-east-2",
452
+ prefetch_enabled=True
453
+ )
454
+
455
+ server = Server(
456
+ instance_type="ml.g5.8xlarge",
457
+ image_uri="763104351884.dkr.ecr.us-east-2.amazonaws.com/huggingface-pytorch-tgi-inference:2.4.0-tgi2.3.1-gpu-py311-cu124-ubuntu22.04-v2.0",
458
+ container_port=8080,
459
+ model_volume_mount_name="model-weights"
460
+ )
461
+
462
+ resources = {
463
+ "requests": {"cpu": "30000m", "nvidia.com/gpu": 1, "memory": "100Gi"},
464
+ "limits": {"nvidia.com/gpu": 1}
465
+ }
466
+
467
+ env = EnvironmentVariables(
468
+ HF_MODEL_ID="/opt/ml/model",
469
+ SAGEMAKER_PROGRAM="inference.py",
470
+ SAGEMAKER_SUBMIT_DIRECTORY="/opt/ml/model/code",
471
+ MODEL_CACHE_ROOT="/opt/ml/model",
472
+ SAGEMAKER_ENV="1"
473
+ )
474
+
475
+ endpoint_name = SageMakerEndpoint(name="endpoint-custom-pytorch")
476
+
477
+ tls_config = TlsConfig(tls_certificate_output_s3_uri="s3://sample-bucket")
478
+
479
+ custom_endpoint = HPCustomEndpoint(
480
+ model=model,
481
+ server=server,
482
+ resources=resources,
483
+ environment=env,
484
+ sage_maker_endpoint=endpoint_name,
485
+ tls_config=tls_config,
486
+ )
487
+
488
+ custom_endpoint.create()
489
+ ```
490
+
491
+ #### Invoke a Custom Inference Endpoint
492
+
493
+ ```
494
+ data = '{"inputs":"What is the capital of USA?"}'
495
+ response = custom_endpoint.invoke(body=data).body.read()
496
+ print(response)
497
+ ```
498
+
499
+ #### Managing an Endpoint
500
+
501
+ ```
502
+ endpoint_iterator = HPJumpStartEndpoint.list()
503
+ for endpoint in endpoint_iterator:
504
+ print(endpoint.name, endpoint.status)
505
+
506
+ logs = js_endpoint.get_logs()
507
+ print(logs)
508
+
509
+ ```
510
+
511
+ #### Deleting an Endpoint
512
+
513
+ ```
514
+ js_endpoint.delete()
515
+
516
+ ```
517
+
518
+ #### Observability - Getting Monitoring Information
519
+ ```
520
+ from sagemaker.hyperpod.utils import get_monitoring_config,
521
+ monitor_config = get_monitoring_config()
522
+ monitor_config.grafanaURL
523
+ monitor_config.prometheusURL
524
+ ```
525
+
526
+ ## Disclaimer
527
+
528
+ * This CLI and SDK requires access to the user's file system to set and get context and function properly.
529
+ It needs to read configuration files such as kubeconfig to establish the necessary environment settings.
530
+
531
+
532
+ ## Working behind a proxy server ?
533
+ * Follow these steps from [here](https://docs.aws.amazon.com/cli/v1/userguide/cli-configure-proxy.html) to set up HTTP proxy connections
534
+
@@ -0,0 +1,66 @@
1
+ sagemaker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ sagemaker/hyperpod/__init__.py,sha256=7CPJoaQClt4zFWRYfd4Nzz1dXuWih-DnwoUlp5DxXdw,88
3
+ sagemaker/hyperpod/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ sagemaker/hyperpod/cli/hyp_cli.py,sha256=nSRg_OYytCcW9jb8vN14QktbG797H4f2UFVbEig7Oig,3032
5
+ sagemaker/hyperpod/cli/inference_utils.py,sha256=L8E-jPSh6Y3NnKeawZrld1x9MDanMYE1S55JsXahM4g,4084
6
+ sagemaker/hyperpod/cli/training_utils.py,sha256=1AoS232PwPVw7xDABeRtUNZNsAv8lW9umJqqFSYjLDc,7279
7
+ sagemaker/hyperpod/cli/utils.py,sha256=vebLKrdvpuRbjFD7ETFZ2JII2K8KsXAtmD9Qzh1WlJo,5580
8
+ sagemaker/hyperpod/cli/clients/__init__.py,sha256=0d289RSJpUxx6gqIWNBbZLq6_iAldaRAYd3lGcfuKOs,560
9
+ sagemaker/hyperpod/cli/clients/kubernetes_client.py,sha256=DH9x_5MoBGoxAQxAtysBn-uAfn35etNnEqBa9HqXtqo,12724
10
+ sagemaker/hyperpod/cli/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
+ sagemaker/hyperpod/cli/commands/cluster.py,sha256=O827iiLGtwUoSVHoawLS4dAeE0A9cKT5sMQjGXLmtis,23694
12
+ sagemaker/hyperpod/cli/commands/inference.py,sha256=8Vd5RjQc2u9ly46kBB1tyoKvH0chQ6eq7rSwuBzd4ew,22497
13
+ sagemaker/hyperpod/cli/commands/training.py,sha256=TKL9EpeLPYf4T_CgHUuraLLjrWcLKkIsOk4s6yReLIc,12088
14
+ sagemaker/hyperpod/cli/constants/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
+ sagemaker/hyperpod/cli/constants/command_constants.py,sha256=XuXCRHJo4_nrWGgMmz_czmVsS2CDsN2Jbd3x5PRMYWQ,3637
16
+ sagemaker/hyperpod/cli/constants/exception_constants.py,sha256=FjL1q0OaDHg2EdRK-zD0qXEzxw5cuAZeW7rTYLSoZvY,590
17
+ sagemaker/hyperpod/cli/constants/hyperpod_instance_types.py,sha256=Hmn_Ifi3xSmI-r0_EAZGgXf8jY3ThqJ47obZ7AlczJI,3788
18
+ sagemaker/hyperpod/cli/constants/kueue_constants.py,sha256=tCHJECH6oNwxHtXEsMMwRwqPG-yOjVy56_thJo9BkjM,830
19
+ sagemaker/hyperpod/cli/constants/pytorch_constants.py,sha256=GfSEqZnqqjoiF-hjtgkaAQ4XtJounwixYohIR3JY5Lg,687
20
+ sagemaker/hyperpod/cli/service/__init__.py,sha256=0d289RSJpUxx6gqIWNBbZLq6_iAldaRAYd3lGcfuKOs,560
21
+ sagemaker/hyperpod/cli/service/cancel_training_job.py,sha256=WJZv9kyqDtthGRaNqGrvNi7kOQoo6Ve8xLU5yRrdeUE,2415
22
+ sagemaker/hyperpod/cli/service/discover_namespaces.py,sha256=n3krmDLr4Pt-CMgrXCW7SUo8y11-Hwtqdlu_mMHKOlU,4705
23
+ sagemaker/hyperpod/cli/service/exec_command.py,sha256=B4PRyoGFzioHfJgtzJFCshLWABpeIf-EKmoCtMp0DLU,2468
24
+ sagemaker/hyperpod/cli/service/get_logs.py,sha256=zZlLw6Nc0DYYTbhLaAGOfca68oZDWcd0KqP4HeiNQTw,5880
25
+ sagemaker/hyperpod/cli/service/get_namespaces.py,sha256=_6a_fBF3of6_zAqBy78gVaK-KfaiHT1Du4Swig3eL1Q,1924
26
+ sagemaker/hyperpod/cli/service/get_training_job.py,sha256=Qw6vLNd4QAfdhkOiIq1XfP0afXNtk9pqRrlqIaTaHKk,4321
27
+ sagemaker/hyperpod/cli/service/list_pods.py,sha256=AnXr0HJGmM2h9CtdNNlOz3Vhk0R8Skg72_2_k7PGKYI,5362
28
+ sagemaker/hyperpod/cli/service/list_training_jobs.py,sha256=QcEdSC4jOpXYYnXYqYEXrCmivtNSStqBIqX9JXcfPzs,7376
29
+ sagemaker/hyperpod/cli/service/self_subject_access_review.py,sha256=a9g4p2mIB89BayzySK9s_BlAl0s858qeKuEc6SU8LI0,1570
30
+ sagemaker/hyperpod/cli/telemetry/__init__.py,sha256=0d289RSJpUxx6gqIWNBbZLq6_iAldaRAYd3lGcfuKOs,560
31
+ sagemaker/hyperpod/cli/telemetry/user_agent.py,sha256=Nvh4WQ9Z_xnGFbNPdjP4QxNuLuinInFnMO_baORdk9s,1103
32
+ sagemaker/hyperpod/cli/templates/__init__.py,sha256=0d289RSJpUxx6gqIWNBbZLq6_iAldaRAYd3lGcfuKOs,560
33
+ sagemaker/hyperpod/cli/templates/k8s_pytorch_job_template.py,sha256=SihmapLwqu33-QWevSonuKBQXGOhJQRmnzPJYu-RVoM,2856
34
+ sagemaker/hyperpod/cli/validators/__init__.py,sha256=0d289RSJpUxx6gqIWNBbZLq6_iAldaRAYd3lGcfuKOs,560
35
+ sagemaker/hyperpod/cli/validators/cluster_validator.py,sha256=1rgLw2OK-qH52PgPB86Itj1CvC49JZNCqTIbYr6sI-o,1969
36
+ sagemaker/hyperpod/cli/validators/job_validator.py,sha256=UDn9R5DnSNZ-zjgfG4BeMlJHXrb8W3odsdH5dE94kPM,12698
37
+ sagemaker/hyperpod/cli/validators/validator.py,sha256=tleiAbwwz0iQYszTtZbXIRptnYzjXr79qMnueVIShGs,2586
38
+ sagemaker/hyperpod/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
+ sagemaker/hyperpod/common/utils.py,sha256=mlMP9rXHtt8R2X-vVnmpeWh3OZfTXeCjTkDWg0npdHI,9299
40
+ sagemaker/hyperpod/common/config/__init__.py,sha256=jfi8GpxeBRDqMS8fG5t70Y_aoKmU490VGxIcHfdgeRI,63
41
+ sagemaker/hyperpod/common/config/metadata.py,sha256=CLedClRTdpYJlprv_9zbNuFrO-XUr4Imlw3EMvKO8vA,1025
42
+ sagemaker/hyperpod/inference/__init__.py,sha256=qiyu1bCemQHVUgcv_S5B6avICyMZT3iHBBbixQ-SryA,476
43
+ sagemaker/hyperpod/inference/hp_endpoint.py,sha256=XMgt2ELmwQGH9Rwm7BS_weEQMQsWHG8H6xVfocY9AFc,6359
44
+ sagemaker/hyperpod/inference/hp_endpoint_base.py,sha256=hI-po82coiWItZqHiZW-MZKd3UQV9GlujVVXpiVvqFo,5896
45
+ sagemaker/hyperpod/inference/hp_jumpstart_endpoint.py,sha256=fli46hvbTtfd85pGtMHWeuYPrjJQF3VAa-aMUH1TqaE,7505
46
+ sagemaker/hyperpod/inference/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
47
+ sagemaker/hyperpod/inference/config/constants.py,sha256=rPIvV81LeqnmwW4lDlYX_OO5egwQUIf9aY1wqheOoDw,745
48
+ sagemaker/hyperpod/inference/config/hp_endpoint_config.py,sha256=wWmtbNKIDzEtMw-nPCeKSyhPQNto8TidhOrbOMVV7ic,30285
49
+ sagemaker/hyperpod/inference/config/hp_jumpstart_endpoint_config.py,sha256=Mnjo2fNZopswbF4ywAQMFPSknHLJta_TzmetLXH66Pc,20953
50
+ sagemaker/hyperpod/observability/MonitoringConfig.py,sha256=xdCjRGI_b5by6sHDflYmZSpni5IvTCkrs6eRb4Hbe2I,222
51
+ sagemaker/hyperpod/observability/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
52
+ sagemaker/hyperpod/observability/constants.py,sha256=fa3iymjP_DJbi-ikYheK2r8Nm5-wte5SxZ9wknXJKZ4,136
53
+ sagemaker/hyperpod/observability/utils.py,sha256=UGaHb6RUpQB13mgn2v3eucX00gx42geRQbA1YMgii3E,2511
54
+ sagemaker/hyperpod/training/__init__.py,sha256=Glpf_ZbYsnhAlRmm9kbaRT6JVj_vDCMSXcVcm6rUI_0,316
55
+ sagemaker/hyperpod/training/hyperpod_pytorch_job.py,sha256=iskVfQwqfBXPRdrBmNeDUb26gKRwJ-CLPWinH7TGMmA,8118
56
+ sagemaker/hyperpod/training/config/__init__.py,sha256=OdsmBFovzGF9o3ceJ-cEhVSpF3HE6OiEO0bgn9pYEFM,46
57
+ sagemaker/hyperpod/training/config/hyperpod_pytorch_job_config.py,sha256=nNS2mKeZbQhNxqApiPhdKuWP0q9KjgFrkZ9Oo4P5Fsc,196236
58
+ sagemaker/hyperpod/training/config/hyperpod_pytorch_job_status.py,sha256=bTog5yvdDwmi5ZVCe6BlF8A1WvTrjJqc5jMON7rNUjI,200848
59
+ sagemaker_hyperpod-3.0.0.dist-info/licenses/LICENSE,sha256=CeipvOyAZxBGUsFoaFqwkx54aPnIKEtm9a5u2uXxEws,10142
60
+ sagemaker_hyperpod-3.0.0.dist-info/licenses/NOTICE,sha256=Eg13ogOmcI7JpMjxniFnKG81vwU3X8X7P_IlpvVg5RU,66
61
+ sagemaker_hyperpod-3.0.0.dist-info/METADATA,sha256=-g2k4Mu3VBDwJN2oYBEk-lLHKnx-o66ommHZCsLnSRI,16904
62
+ sagemaker_hyperpod-3.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
63
+ sagemaker_hyperpod-3.0.0.dist-info/entry_points.txt,sha256=qDEEXlXL_pcUVw0ucxvS_8GQJoRL0-o6MH-_F9faDV4,59
64
+ sagemaker_hyperpod-3.0.0.dist-info/top_level.txt,sha256=dzCY2cZ4aU_S6NM-0PxIEkCsiZXnzUM2UQbHsuyIU1c,10
65
+ sagemaker_hyperpod-3.0.0.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
66
+ sagemaker_hyperpod-3.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ hyp = sagemaker.hyperpod.cli.hyp_cli:cli