-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
feat(sagemaker): add support uncompressed model #30949
base: main
Are you sure you want to change the base?
feat(sagemaker): add support uncompressed model #30949
Conversation
if (!path.toLowerCase().endsWith(ARTIFACT_EXTENSION)) { | ||
throw new Error(`Asset must be a gzipped tar file with extension ${ARTIFACT_EXTENSION} (${this.path})`); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The asset's availability determination was moved after binding it as an asset.
if (!this.asset.isFile) { | ||
throw new Error(`Asset must be a file, if you want to use directory you can use 'ModelData.fromBucket()' with the 's3DataType' option to 'S3DataType.S3_PREFIX' and 'compressionType' option to 'CompressionType.NONE' (${this.path})`); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bundled assets are now allowed if they are not directories.
compressionType: this.asset.assetPath.toLowerCase().endsWith(COMPRESSED_ARTIFACT_EXTENSION) | ||
? CompressionType.GZIP | ||
: CompressionType.NONE, | ||
s3DataType: S3DataType.S3_OBJECT, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uncompressed single files are also supported
…ithub.com/WinterYukky/aws-cdk into feat/sagemaker/support-uncompressed-model
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Issue # (if applicable)
None.
Reason for this change
Currently,
sagemaker.Model
only supportModelDataUrl
.ModelDataUrl
must be gzip the model artifact.https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-model-containerdefinition.html#cfn-sagemaker-model-containerdefinition-modeldataurl
LLM, which is popular these days, is large and takes longer to compress. For example, the 70B parameter model could take 2 hours or more to compress. SageMaker has a way to use the uncompressed model, and this PR is needed to support the uncompressed model.
The uncompressed model is also recommended in the official documentation.
Description of changes
Users can now specify the use of the uncompressed model by taking the model's compression type and S3 data type as options. When using an uncompressed model, use
ModelDataSource
instead ofModelDataUrl
. SinceModelDataSource
cannot be used in some workloads, the compression model usesModelDataUrl
as before.Note
Currently you cannot use ModelDataSource in conjunction with SageMaker batch transform, SageMaker serverless endpoints, SageMaker multi-model endpoints, and SageMaker Marketplace.
https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ContainerDefinition.html#sagemaker-Type-ContainerDefinition-ModelDataSource
Also, asset bundling can now be used as a by-product of being able to use something other than tar.gz due to support for uncompressed models. Until now, no model artifacts with extensions other than tar.gz were permitted, but bundled assets are now allowed if they are not directories.
Since it is not possible to upload a directory or extract a zip with
s3_asset.asset
alone, the directory cannot continue to be used as an asset. (If there is a way to support directories, please let me know)Description of how you validated changes
I've added an integ test with assertions that invoke the model endpoint and verify the response.
Checklist
Other
sagemaker-alpha module document is not aligned contributing guide recommendation, so also I fix the it.
https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md#recommendations
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license