Skip to content

RealTimePredictor.accept values not correctly checked #993

@vanoudh

Description

@vanoudh

Please fill out the form below.

System Information

  • Framework (e.g. TensorFlow) / Algorithm (e.g. KMeans): RealTimePredictor
  • Framework Version:
  • Python Version: notebook kernel conda_tensorflow_p36
  • CPU or GPU: CPU
  • Python SDK Version: sagemaker 1.35.1
  • Are you using a custom image:

Describe the problem

The accept parameter is not correctly checked when set on a RealTimePredictor.

If we set accept to a value not supported, it will default to application/json instead of throwing an error.

Minimal repro / logs

Please provide any logs and a bare minimum reproducible test case, as this will be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.

  • Exact command to reproduce:

from sagemaker.predictor import RealTimePredictor

predictor = RealTimePredictor('linear-learner-2019-08-22-15-54-26-888')

predictor.content_type = 'text/csv'
predictor.serializer = csv_serializer
predictor.accept = 'text/csv' # this is not a valid value
predictor.deserializer = csv_deserializer
predictor.predict(x_test)

output:

[['{"predictions": [{"score": 0.39518389105796814',
' "predicted_label": 0.0}',
' {"score": 0.6770541667938232',
' "predicted_label": 1.0}',
' {"score": 0.013649559579789639',
' "predicted_label": 0.0}',

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