aws / aws/sagemaker-mxnet-training-toolkit

How to support multiple model inputs?

Open
#58 3 comments 0 reactions 0 assignees View on GitHub
type: question
Dominant language
Python
Stars
60
Forks
52
PR merge metrics
No merged PRs in 30d

Description

https://github.com/aws/sagemaker-mxnet-container/blob/ee9098c8c2de6a635dcd9f4b0819dc5340061cde/src/sagemaker_mxnet_container/serving.py#L228

If my mxnet model takes 2 data inputs (both are float arrays), how should I make it work at this point?

- I defined my model-shapes.json like
_[{"shape": [1, 12], "name": "data0"}, {"shape": [1, 12], "name": "data1"}]_

- And one example input looks like:
data = {'data0':[1.0, 2904.0, 1452.0, 464.0, 3022.0, 2948.0, 2548.0, 2.0, 0.0, 0.0, 0.0, 0.0], 'data1':[1.0, 2204.0, 1552.0, 494.0, 3032.0, 298.0, 2568.0, 2.0, 0.0, 0.0, 0.0, 0.0]}

But I got errors on the server side:
```
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/sagemaker_containers/_functions.py", line 84, in wrapper
return fn(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/sagemaker_mxnet_container/serving.py", line 229, in default_input_fn
[data_shape] = self._model.data_shapes

ValueError: too many values to unpack (expected 1)
```

Contributor guide

Open the contributing guide

Research direction

Start with src/sagemaker_mxnet_container/serving.py at line 228 and trace default_input_fn against the two entries in model-shapes.json. Reproduce the ValueError using the supplied data0 and data1 input, then inspect nearby serving tests or input-shape handling. Done means a model with both float-array inputs can be served without the unpacking failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
backend, machine-learning
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.