Example #1
0
def test_model_image(sagemaker_session):
    ipinsights = IPInsights(sagemaker_session=sagemaker_session,
                            **ALL_REQ_ARGS)
    data = RecordSet("s3://{}/{}".format(BUCKET_NAME, PREFIX),
                     num_records=1,
                     feature_dim=FEATURE_DIM,
                     channel='train')
    ipinsights.fit(data, MINI_BATCH_SIZE)

    model = ipinsights.create_model()
    assert model.image == registry(REGION, "ipinsights") + '/ipinsights:1'
def test_model_image(sagemaker_session):
    ipinsights = IPInsights(sagemaker_session=sagemaker_session, **ALL_REQ_ARGS)
    data = RecordSet(
        "s3://{}/{}".format(BUCKET_NAME, PREFIX),
        num_records=1,
        feature_dim=FEATURE_DIM,
        channel="train",
    )
    ipinsights.fit(data, MINI_BATCH_SIZE)

    model = ipinsights.create_model()
    assert image_uris.retrieve("ipinsights", REGION) == model.image_uri
Example #3
0
def test_predictor_type(sagemaker_session):
    ipinsights = IPInsights(sagemaker_session=sagemaker_session,
                            **ALL_REQ_ARGS)
    data = RecordSet("s3://{}/{}".format(BUCKET_NAME, PREFIX),
                     num_records=1,
                     feature_dim=FEATURE_DIM,
                     channel='train')
    ipinsights.fit(data, MINI_BATCH_SIZE)
    model = ipinsights.create_model()
    predictor = model.deploy(1, TRAIN_INSTANCE_TYPE)

    assert isinstance(predictor, IPInsightsPredictor)
def test_predictor_custom_serialization(sagemaker_session):
    ipinsights = IPInsights(sagemaker_session=sagemaker_session, **ALL_REQ_ARGS)
    data = RecordSet(
        "s3://{}/{}".format(BUCKET_NAME, PREFIX),
        num_records=1,
        feature_dim=FEATURE_DIM,
        channel="train",
    )
    ipinsights.fit(data, MINI_BATCH_SIZE)
    model = ipinsights.create_model()
    custom_serializer = Mock()
    custom_deserializer = Mock()
    predictor = model.deploy(
        1,
        INSTANCE_TYPE,
        serializer=custom_serializer,
        deserializer=custom_deserializer,
    )

    assert isinstance(predictor, IPInsightsPredictor)
    assert predictor.serializer is custom_serializer
    assert predictor.deserializer is custom_deserializer