Skip to content

How to load model programmatically? #1094

@velociraptor111

Description

@velociraptor111

I notice that whenever I run a new batch transform jobs, it will create a new model and saves it.
I can see all the models from my batch transform jobs in my AWS Sagemaker Dashboard/inference/models

Here is the script that I run

sagemaker_model = MXNetModel(model_data = 's3://' + sagemaker_session.default_bucket() + '/model/yolo_object_person_detector.tar.gz',
                             role = role, 
                             entry_point = 'entry_point.py',
                             py_version='py3',
                             framework_version='1.4.1',
                            sagemaker_session = sagemaker_session)

transformer = sagemaker_model.transformer(instance_count=1, instance_type='ml.m4.xlarge', output_path=batch_output)

transformer.transform(data=batch_input, content_type='application/x-image')

transformer.wait()

I've looked into the source code for declaration of class MXNetModel

class MXNetModel(FrameworkModel):
    """An MXNet SageMaker ``Model`` that can be deployed to a SageMaker ``Endpoint``."""

    __framework_name__ = "mxnet"
    _LOWEST_MMS_VERSION = "1.4"

def __init__(
        self,
        model_data,
        role,
        entry_point,
        image=None,
        py_version="py2",
        framework_version=MXNET_VERSION,
        predictor_cls=MXNetPredictor,
        model_server_workers=None,
        **kwargs
    ):

...

But I am not seeing anywhere where I can simply load the MXNetModel object using a URL Endpoint to the models in my dashboard.

If I go to console and click one of those models, I can see a button for Create batch transform job, so I know internally this is possible. But I can't find anything on the docs to do it programmatically.

Also as a side question:
How many models does the Free tier provide? In the free tier page: https://aws.amazon.com/sagemaker/pricing/ it just says the number of hours, but not necessarily the number of models

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions