repack_model: Unpack model tarball and creates a new model tarball with the...

View source: R/utils.R

repack_modelR Documentation

Unpack model tarball and creates a new model tarball with the provided code script.

Description

This function does the following: - uncompresses model tarball from S3 or local system into a temp folder - replaces the inference code from the model with the new code provided - compresses the new model tarball and saves it in S3 or local file system

Usage

repack_model(
  inference_script,
  source_directory,
  dependencies,
  model_uri,
  repacked_model_uri,
  sagemaker_session,
  kms_key = NULL
)

Arguments

inference_script

(str): path or basename of the inference script that will be packed into the model

source_directory

(str): path including all the files that will be packed into the model

dependencies

(list[str]): A list of paths to directories (absolute or relative) with any additional libraries that will be exported to the

model_uri

(str): S3 or file system location of the original model tar

repacked_model_uri

(str): path or file system location where the new model will be saved

sagemaker_session

(sagemaker.session.Session): a sagemaker session to interact with S3.

kms_key

(str): KMS key ARN for encrypting the repacked model file

Value

str: path to the new packed model

See Also

Other sagemaker_utils: .aws_partition(), .download_files_under_prefix(), base_from_name(), base_name_from_image(), build_dict(), common_variables, create_tar_file(), download_file(), download_folder(), get_config_value(), get_short_version(), name_from_base(), name_from_image(), regional_hostname(), retries(), sagemaker_short_timestamp(), sagemaker_timestamp(), secondary_training_status_changed(), secondary_training_status_message(), sts_regional_endpoint(), unique_name_from_base()


DyfanJones/sagemaker-r-local documentation built on June 14, 2022, 10:32 p.m.