Add support for cache_model_artifact#241
Merged
Merged
Conversation
|
Job PR-241-16627d5 is done. |
|
Job PR-241-5b5fc59 is done. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #, if available:
Summary
Adds
FoundationModel.cache_model_artifact()to bundle HuggingFace weights with the serve script into a SageMakermodel.tar.gzand upload to S3, then reuse that artifact ondeploy(). Required for network-isolated endpoints (e.g., SageMaker Serverless Inference) that can't reach HuggingFace at runtime.Changes
cache_model_artifact(cache_path, *, overwrite=False)— downloads weights viahuggingface_hub.snapshot_download, packagesweights/+code/<serve_script>intomodel.tar.gz, uploads to{cache_path}/{model_id}/model.tar.gz. Returns a newFoundationModelwithmodel_artifact_uriset. Skips upload if the key already exists; raisesRuntimeErrorif the cached artifact'sautogluon-cloud-versionmetadata doesn't match the current version (unlessoverwrite=True).SagemakerBackend.deploy(..., repack: bool = True)— whenFalse, usesAutoGluonNonRepackInferenceModeldirectly so a pre-bundled tarball isn't downloaded, repacked, and re-uploaded by the SDK._deploy_backendpassesmodel_artifact_uriaspredictor_path, setsrepack=False, and overrideshyperparameters["model_path"]to/opt/ml/model/weights(raises if the user also setmodel_path).FoundationModelConfigis now a frozendataclasswith sensible instance-type defaults; renamedmodel_name→ag_model_keyand addedmodel_source_uri. Registry shrunk to chronos-bolt-{tiny,small,base} and chronos-2{,-small} (Mitra entries removed for now).serve_config/AG_SERVE_CONFIG→fm_serve_config/AG_FM_SERVE_CONFIG.to_dict/to_json/from_dict/from_jsononFoundationModel, excluding runtime context (role,cloud_output_path) so configs can be shared across users.huggingface_hub>=0.20,<2added toinstall_requires.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.