Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ def input_fn(input_data, content_type):
try:
if hasattr(schema_builder, "custom_input_translator"):
deserialized_data = schema_builder.custom_input_translator.deserialize(
io.BytesIO(input_data), content_type
io.BytesIO(input_data) if type(input_data)== bytes else io.BytesIO(input_data.encode('utf-8')), content_type
)
else:
deserialized_data = schema_builder.input_deserializer.deserialize(
io.BytesIO(input_data), content_type[0]
io.BytesIO(input_data) if type(input_data)== bytes else io.BytesIO(input_data.encode('utf-8')), content_type[0]
)

# Check if preprocess method is defined and call it
Expand Down
4 changes: 2 additions & 2 deletions src/sagemaker/serve/model_server/torchserve/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ def input_fn(input_data, content_type):
try:
if hasattr(schema_builder, "custom_input_translator"):
deserialized_data = schema_builder.custom_input_translator.deserialize(
io.BytesIO(input_data), content_type
io.BytesIO(input_data) if type(input_data)== bytes else io.BytesIO(input_data.encode('utf-8')), content_type
)
else:
deserialized_data = schema_builder.input_deserializer.deserialize(
io.BytesIO(input_data), content_type[0]
io.BytesIO(input_data) if type(input_data)== bytes else io.BytesIO(input_data.encode('utf-8')), content_type[0]
)

# Check if preprocess method is defined and call it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ def input_fn(input_data, content_type):
try:
if hasattr(schema_builder, "custom_input_translator"):
return schema_builder.custom_input_translator.deserialize(
io.BytesIO(input_data), content_type
io.BytesIO(input_data) if type(input_data)== bytes else io.BytesIO(input_data.encode('utf-8')), content_type
)
else:
return schema_builder.input_deserializer.deserialize(
io.BytesIO(input_data), content_type[0]
io.BytesIO(input_data) if type(input_data)== bytes else io.BytesIO(input_data.encode('utf-8')), content_type[0]
)
except Exception as e:
raise Exception("Encountered error in deserialize_request.") from e
Expand Down
Loading