Skip to content

SageMaker Core v2 #269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ source .env
## Run CodeGen
* To generate all CodeGen code run the below
```
python src/sagemaker_core/tools/codegen.py
python src/sagemaker/core/tools/codegen.py
```

## Testing
Expand Down
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
SageMaker Core Resources
########################

.. automodule:: sagemaker_core.main.resources
.. automodule:: sagemaker.core.resources
:members:
:noindex:

Expand All @@ -13,6 +13,6 @@ SageMaker Core Resources
SageMaker Core Shapes
########################

.. automodule:: sagemaker_core.main.shapes
.. automodule:: sagemaker.core.shapes
:members:
:noindex:
22 changes: 11 additions & 11 deletions example_notebooks/get_started.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"outputs": [],
"source": [
"import time\n",
"from sagemaker_core.helper.session_helper import Session, get_execution_role\n",
"from sagemaker.core.helper.session_helper import Session, get_execution_role\n",
"\n",
"# Set up region, role and bucket parameters used throughout the notebook.\n",
"sagemaker_session = Session()\n",
Expand Down Expand Up @@ -197,8 +197,8 @@
"metadata": {},
"outputs": [],
"source": [
"from sagemaker_core.resources import TrainingJob\n",
"from sagemaker_core.shapes import AlgorithmSpecification, Channel, DataSource, S3DataSource, ResourceConfig, StoppingCondition, OutputDataConfig\n",
"from sagemaker.core.resources import TrainingJob\n",
"from sagemaker.core.shapes import AlgorithmSpecification, Channel, DataSource, S3DataSource, ResourceConfig, StoppingCondition, OutputDataConfig\n",
"\n",
"job_name = 'xgboost-churn-' + time.strftime(\"%Y-%m-%d-%H-%M-%S\", time.gmtime()) # Name of training job\n",
"instance_type = 'ml.m4.xlarge' # SageMaker instance type to use for training\n",
Expand Down Expand Up @@ -291,8 +291,8 @@
"metadata": {},
"outputs": [],
"source": [
"from sagemaker_core.resources import HyperParameterTuningJob\n",
"from sagemaker_core.shapes import HyperParameterTuningJobConfig, \\\n",
"from sagemaker.core.resources import HyperParameterTuningJob\n",
"from sagemaker.core.shapes import HyperParameterTuningJobConfig, \\\n",
" ResourceLimits, HyperParameterTuningJobWarmStartConfig, ParameterRanges, AutoParameter, \\\n",
" Autotune, HyperParameterTrainingJobDefinition, HyperParameterTuningJobObjective, HyperParameterAlgorithmSpecification, \\\n",
" OutputDataConfig, StoppingCondition, ResourceConfig\n",
Expand Down Expand Up @@ -436,8 +436,8 @@
"metadata": {},
"outputs": [],
"source": [
"from sagemaker_core.resources import Model\n",
"from sagemaker_core.shapes import ContainerDefinition\n",
"from sagemaker.core.resources import Model\n",
"from sagemaker.core.shapes import ContainerDefinition\n",
"\n",
"#model_s3_uri = training_job.model_artifacts.s3_model_artifacts # Get URI of model artifacts from the training job.\n",
"model_s3_uri = TrainingJob.get(tuning_job.best_training_job.training_job_name).model_artifacts.s3_model_artifacts # Get URI of model artifacts of the best model from the tuning job.\n",
Expand Down Expand Up @@ -469,8 +469,8 @@
"metadata": {},
"outputs": [],
"source": [
"from sagemaker_core.resources import TransformJob\n",
"from sagemaker_core.shapes import TransformInput, TransformDataSource, TransformS3DataSource, TransformOutput, TransformResources\n",
"from sagemaker.core.resources import TransformJob\n",
"from sagemaker.core.shapes import TransformInput, TransformDataSource, TransformS3DataSource, TransformOutput, TransformResources\n",
"\n",
"model_name = customer_churn_model.get_name()\n",
"transform_job_name = 'churn-prediction' + time.strftime(\"%Y-%m-%d-%H-%M-%S\", time.gmtime()) # Name of TranformJob\n",
Expand Down Expand Up @@ -576,8 +576,8 @@
"metadata": {},
"outputs": [],
"source": [
"from sagemaker_core.resources import Endpoint, EndpointConfig\n",
"from sagemaker_core.shapes import ProductionVariant\n",
"from sagemaker.core.resources import Endpoint, EndpointConfig\n",
"from sagemaker.core.shapes import ProductionVariant\n",
"\n",
"endpoint_config_name = 'churn-prediction-endpoint-config' # Name of endpoint configuration\n",
"model_name = customer_churn_model.get_name() # Get name of SageMaker model created in previous step\n",
Expand Down
14 changes: 7 additions & 7 deletions example_notebooks/inference_and_resource_chaining.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
"metadata": {},
"outputs": [],
"source": [
"from sagemaker_core.helper.session_helper import get_execution_role, Session\n",
"from sagemaker.core.helper.session_helper import get_execution_role, Session\n",
"from rich import print\n",
"\n",
"# Get region, role, bucket\n",
Expand Down Expand Up @@ -266,7 +266,7 @@
"# Create TrainingJob with SageMakerCore\n",
"\n",
"import time\n",
"from sagemaker_core.resources import TrainingJob, AlgorithmSpecification, Channel, DataSource, S3DataSource, \\\n",
"from sagemaker.core.resources import TrainingJob, AlgorithmSpecification, Channel, DataSource, S3DataSource, \\\n",
" OutputDataConfig, ResourceConfig, StoppingCondition\n",
"\n",
"job_name_v3 = 'xgboost-iris-' + time.strftime(\"%Y-%m-%d-%H-%M-%S\", time.gmtime())\n",
Expand Down Expand Up @@ -377,8 +377,8 @@
"metadata": {},
"outputs": [],
"source": [
"from sagemaker_core.shapes import ContainerDefinition, ProductionVariant\n",
"from sagemaker_core.resources import Model, EndpointConfig, Endpoint\n",
"from sagemaker.core.shapes import ContainerDefinition, ProductionVariant\n",
"from sagemaker.core.resources import Model, EndpointConfig, Endpoint\n",
"from time import gmtime, strftime\n",
"\n",
"# Get model_data_url from training_job object\n",
Expand Down Expand Up @@ -611,7 +611,7 @@
"metadata": {},
"outputs": [],
"source": [
"from sagemaker_core.shapes import ProductionVariant, AsyncInferenceConfig, AsyncInferenceOutputConfig, AsyncInferenceClientConfig\n",
"from sagemaker.core.shapes import ProductionVariant, AsyncInferenceConfig, AsyncInferenceOutputConfig, AsyncInferenceClientConfig\n",
"\n",
"async_endpoint_config = EndpointConfig.create(\n",
" endpoint_config_name=key,\n",
Expand Down Expand Up @@ -755,7 +755,7 @@
"# Delete any sagemaker core resource objects created in this notebook\n",
"def delete_all_sagemaker_resources():\n",
" all_objects = list(locals().values()) + list(globals().values())\n",
" deletable_objects = [obj for obj in all_objects if hasattr(obj, 'delete') and obj.__class__.__module__ == 'sagemaker_core.main.resources']\n",
" deletable_objects = [obj for obj in all_objects if hasattr(obj, 'delete') and obj.__class__.__module__ == 'sagemaker.core.resources']\n",
" \n",
" for obj in deletable_objects:\n",
" obj.delete()\n",
Expand All @@ -766,7 +766,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "py3.10",
"language": "python",
"name": "python3"
},
Expand Down
22 changes: 11 additions & 11 deletions example_notebooks/intelligent_defaults_and_logging.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
"metadata": {},
"outputs": [],
"source": [
"# Uninstall previous version of sagemaker_core and restart kernel\n",
"# Uninstall previous version of sagemaker-core and restart kernel\n",
"!pip uninstall sagemaker-core -y"
]
},
Expand All @@ -116,7 +116,7 @@
"metadata": {},
"outputs": [],
"source": [
"# Install the latest version of sagemaker_core\n",
"# Install the latest version of sagemaker-core\n",
"\n",
"!pip install sagemaker-core --upgrade"
]
Expand All @@ -127,7 +127,7 @@
"metadata": {},
"outputs": [],
"source": [
"# Check the version of sagemaker_core\n",
"# Check the version of sagemaker-core\n",
"!pip show -v sagemaker-core"
]
},
Expand Down Expand Up @@ -167,7 +167,7 @@
"metadata": {},
"outputs": [],
"source": [
"from sagemaker_core.helper.session_helper import Session, get_execution_role\n",
"from sagemaker.core.helper.session_helper import Session, get_execution_role\n",
"from rich import print\n",
"\n",
"# Get region, role, bucket\n",
Expand Down Expand Up @@ -362,8 +362,8 @@
"outputs": [],
"source": [
"import time\n",
"from sagemaker_core.resources import Cluster\n",
"from sagemaker_core.shapes import ClusterInstanceGroupSpecification, ClusterLifeCycleConfig\n",
"from sagemaker.core.resources import Cluster\n",
"from sagemaker.core.shapes import ClusterInstanceGroupSpecification, ClusterLifeCycleConfig\n",
" \n",
"cluster_name_v3 = 'xgboost-cluster-' + time.strftime(\"%Y-%m-%d-%H-%M-%S\", time.gmtime())\n",
"\n",
Expand Down Expand Up @@ -408,8 +408,8 @@
"outputs": [],
"source": [
"import time\n",
"from sagemaker_core.resources import TrainingJob\n",
"from sagemaker_core.shapes import AlgorithmSpecification, Channel, DataSource, S3DataSource, ResourceConfig, StoppingCondition\n",
"from sagemaker.core.resources import TrainingJob\n",
"from sagemaker.core.shapes import AlgorithmSpecification, Channel, DataSource, S3DataSource, ResourceConfig, StoppingCondition\n",
"\n",
"job_name_v3 = 'xgboost-iris-' + time.strftime(\"%Y-%m-%d-%H-%M-%S\", time.gmtime())\n",
"\n",
Expand Down Expand Up @@ -481,7 +481,7 @@
"outputs": [],
"source": [
"# Setting log_level to DEBUG using configure_logging with string parameter \n",
"from sagemaker_core.main.utils import configure_logging\n",
"from sagemaker.core.utils import configure_logging\n",
"\n",
"configure_logging('DEBUG')"
]
Expand All @@ -493,7 +493,7 @@
"outputs": [],
"source": [
"# Get TrainingJob with DEBUG log_level\n",
"from sagemaker_core.resources import TrainingJob\n",
"from sagemaker.core.resources import TrainingJob\n",
"\n",
"training_job = TrainingJob.get(job_name_v3)"
]
Expand Down Expand Up @@ -549,7 +549,7 @@
"# Delete any sagemaker core resource objects created in this notebook\n",
"def delete_all_sagemaker_resources():\n",
" all_objects = list(locals().values()) + list(globals().values())\n",
" deletable_objects = [obj for obj in all_objects if hasattr(obj, 'delete') and obj.__class__.__module__ == 'sagemaker_core.main.resources']\n",
" deletable_objects = [obj for obj in all_objects if hasattr(obj, 'delete') and obj.__class__.__module__ == 'sagemaker.core.resources']\n",
" \n",
" for obj in deletable_objects:\n",
" obj.delete()\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"## 1. Dependency Installation\n",
"### 1.1. Python Dependencies & Imports\n",
"This notebook requires the following Python dependencies:\n",
"* AWS [`sagemaker_core`]()\n",
"* AWS [`sagemaker-core`]()\n",
"\n",
"Let's install or upgrade these dependencies using the following command:"
]
Expand Down Expand Up @@ -46,7 +46,7 @@
"import json\n",
"import os\n",
"\n",
"from sagemaker_core.helper.session_helper import get_execution_role, Session\n",
"from sagemaker.core.helper.session_helper import get_execution_role, Session\n",
"import pathlib \n",
"import huggingface_hub"
]
Expand Down Expand Up @@ -135,8 +135,8 @@
},
"outputs": [],
"source": [
"from sagemaker_core.shapes import ContainerDefinition, ProductionVariant\n",
"from sagemaker_core.resources import Model, EndpointConfig, Endpoint\n",
"from sagemaker.core.shapes import ContainerDefinition, ProductionVariant\n",
"from sagemaker.core.resources import Model, EndpointConfig, Endpoint\n",
"from time import gmtime, strftime"
]
},
Expand Down Expand Up @@ -194,7 +194,7 @@
},
"outputs": [],
"source": [
"from sagemaker_core.shapes import ProductionVariantRoutingConfig\n",
"from sagemaker.core.shapes import ProductionVariantRoutingConfig\n",
"\n",
"routing_config = ProductionVariantRoutingConfig(\n",
" routing_strategy=\"LEAST_OUTSTANDING_REQUESTS\"\n",
Expand Down Expand Up @@ -314,7 +314,7 @@
"# Delete any sagemaker core resource objects created in this notebook\n",
"def delete_all_sagemaker_resources():\n",
" all_objects = list(locals().values()) + list(globals().values())\n",
" deletable_objects = [obj for obj in all_objects if hasattr(obj, 'delete') and obj.__class__.__module__ == 'sagemaker_core.main.resources']\n",
" deletable_objects = [obj for obj in all_objects if hasattr(obj, 'delete') and obj.__class__.__module__ == 'sagemaker.core.resources']\n",
" \n",
" for obj in deletable_objects:\n",
" obj.delete()\n",
Expand Down
12 changes: 6 additions & 6 deletions example_notebooks/sagemaker-core-llama-3-8B.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"## 1. Dependency Installation\n",
"### 1.1. Python Dependencies & Imports\n",
"This notebook requires the following Python dependencies:\n",
"* AWS [`sagemaker_core`]()\n",
"* AWS [`sagemaker-core`]()\n",
"\n",
"Let's install or upgrade these dependencies using the following command:"
]
Expand Down Expand Up @@ -43,7 +43,7 @@
"import json\n",
"import os\n",
"\n",
"from sagemaker_core.helper.session_helper import get_execution_role, Session\n",
"from sagemaker.core.helper.session_helper import get_execution_role, Session\n",
"import pathlib \n",
"import huggingface_hub"
]
Expand Down Expand Up @@ -124,8 +124,8 @@
},
"outputs": [],
"source": [
"from sagemaker_core.shapes import ContainerDefinition, ProductionVariant\n",
"from sagemaker_core.resources import Model, EndpointConfig, Endpoint\n",
"from sagemaker.core.shapes import ContainerDefinition, ProductionVariant\n",
"from sagemaker.core.resources import Model, EndpointConfig, Endpoint\n",
"from time import gmtime, strftime"
]
},
Expand Down Expand Up @@ -182,7 +182,7 @@
},
"outputs": [],
"source": [
"from sagemaker_core.shapes import ProductionVariantRoutingConfig\n",
"from sagemaker.core.shapes import ProductionVariantRoutingConfig\n",
"\n",
"routing_config = ProductionVariantRoutingConfig(\n",
" routing_strategy=\"LEAST_OUTSTANDING_REQUESTS\"\n",
Expand Down Expand Up @@ -302,7 +302,7 @@
"# Delete any sagemaker core resource objects created in this notebook\n",
"def delete_all_sagemaker_resources():\n",
" all_objects = list(locals().values()) + list(globals().values())\n",
" deletable_objects = [obj for obj in all_objects if hasattr(obj, 'delete') and obj.__class__.__module__ == 'sagemaker_core.main.resources']\n",
" deletable_objects = [obj for obj in all_objects if hasattr(obj, 'delete') and obj.__class__.__module__ == 'sagemaker.core.resources']\n",
" \n",
" for obj in deletable_objects:\n",
" obj.delete()\n",
Expand Down
14 changes: 7 additions & 7 deletions example_notebooks/sagemaker_core_overview.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"metadata": {},
"outputs": [],
"source": [
"# Uninstall previous version of sagemaker_core and restart kernel\n",
"# Uninstall previous version of sagemaker-core and restart kernel\n",
"!pip uninstall sagemaker-core -y"
]
},
Expand All @@ -102,7 +102,7 @@
"metadata": {},
"outputs": [],
"source": [
"# Install the latest version of sagemaker_core\n",
"# Install the latest version of sagemaker-core\n",
"\n",
"!pip install sagemaker-core --upgrade"
]
Expand All @@ -113,7 +113,7 @@
"metadata": {},
"outputs": [],
"source": [
"# Check the version of sagemaker_core\n",
"# Check the version of sagemaker-core\n",
"!pip show -v sagemaker-core"
]
},
Expand Down Expand Up @@ -153,7 +153,7 @@
"metadata": {},
"outputs": [],
"source": [
"from sagemaker_core.helper.session_helper import Session, get_execution_role\n",
"from sagemaker.core.helper.session_helper import Session, get_execution_role\n",
"from rich import print\n",
"\n",
"# Get region, role, bucket\n",
Expand Down Expand Up @@ -382,7 +382,7 @@
"# Create TrainingJob with SageMakerCore\n",
"\n",
"import time\n",
"from sagemaker_core.resources import TrainingJob, AlgorithmSpecification, Channel, DataSource, S3DataSource, \\\n",
"from sagemaker.core.resources import TrainingJob, AlgorithmSpecification, Channel, DataSource, S3DataSource, \\\n",
" OutputDataConfig, ResourceConfig, StoppingCondition\n",
"\n",
"job_name_v3 = 'xgboost-iris-' + time.strftime(\"%Y-%m-%d-%H-%M-%S\", time.gmtime())\n",
Expand Down Expand Up @@ -531,7 +531,7 @@
"source": [
"# List TrainingJobs with SageMakerCore\n",
"import datetime\n",
"from sagemaker_core.resources import TrainingJob\n",
"from sagemaker.core.resources import TrainingJob\n",
"\n",
"creation_time_after = datetime.datetime.now() - datetime.timedelta(days=1)\n",
"\n",
Expand Down Expand Up @@ -562,7 +562,7 @@
"# Delete any sagemaker core resource objects created in this notebook\n",
"def delete_all_sagemaker_resources():\n",
" all_objects = list(locals().values()) + list(globals().values())\n",
" deletable_objects = [obj for obj in all_objects if hasattr(obj, 'delete') and obj.__class__.__module__ == 'sagemaker_core.main.resources']\n",
" deletable_objects = [obj for obj in all_objects if hasattr(obj, 'delete') and obj.__class__.__module__ == 'sagemaker.core.resources']\n",
" \n",
" for obj in deletable_objects:\n",
" obj.delete()\n",
Expand Down
Loading