aws / aws/amazon-sagemaker-examples
Endpoint defined in `rl_roboschool_ray.ipynb` cannot accept the test input
- Dominant language
- Jupyter Notebook
- Stars
- 11k
- Forks
- 7k
- Avg merge
- 8h 29m
- Merged PRs (30d)
- 8
Description
Problem notebook:
```
https://github.com/aws/amazon-sagemaker-examples/blob/master/reinforcement_learning/rl_roboschool_ray/rl_roboschool_ray.ipynb
```
Problem cell:
```python
# ray 0.8.2 requires all the following inputs
# 'prev_action', 'is_training', 'prev_reward' and 'seq_lens' are placeholders for this example
# they won't affect prediction results
input = {"inputs": {'observations': np.ones(shape=(1,observation_space_mapping[roboschool_problem])).tolist(),
'prev_action': [0, 0],
'is_training': False,
'prev_reward': -1,
'seq_lens': -1
}
}
result = predictor.predict(input)
result['outputs']['actions']
```
Traceback:
```
JSONDecodeError Traceback (most recent call last)
in
----> 1 result = predictor.predict(input)
2
3 result['outputs']['actions']
~/anaconda3/envs/amazonei_mxnet_p36/lib/python3.6/site-packages/sagemaker/tensorflow/serving.py in predict(self, data, initial_args)
118 args["CustomAttributes"] = self._model_attributes
119
--> 120 return super(Predictor, self).predict(data, args)
121
122
~/anaconda3/envs/amazonei_mxnet_p36/lib/python3.6/site-packages/sagemaker/predictor.py in predict(self, data, initial_args, target_model, target_variant)
112 request_args = self._create_request_args(data, initial_args, target_model, target_variant)
113 response = self.sagemaker_session.sagemaker_runtime_client.invoke_endpoint(**request_args)
--> 114 return self._handle_response(response)
115
116 def _handle_response(self, response):
~/anaconda3/envs/amazonei_mxnet_p36/lib/python3.6/site-packages/sagemaker/predictor.py in _handle_response(self, response)
122 if self.deserializer is not None:
123 # It's the deserializer's responsibility to close the stream
--> 124 return self.deserializer(response_body, response["ContentType"])
125 data = response_body.read()
126 response_body.close()
~/anaconda3/envs/amazonei_mxnet_p36/lib/python3.6/site-packages/sagemaker/predictor.py in __call__(self, stream, content_type)
585 """
586 try:
--> 587 return json.load(codecs.getreader("utf-8")(stream))
588 finally:
589 stream.close()
~/anaconda3/envs/amazonei_mxnet_p36/lib/python3.6/json/__init__.py in load(fp, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
297 cls=cls, object_hook=object_hook,
298 parse_float=parse_float, parse_int=parse_int,
--> 299 parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
300
301
~/anaconda3/envs/amazonei_mxnet_p36/lib/python3.6/json/__init__.py in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
352 parse_int is None and parse_float is None and
353 parse_constant is None and object_pairs_hook is None and not kw):
--> 354 return _default_decoder.decode(s)
355 if cls is None:
356 cls = JSONDecoder
~/anaconda3/envs/amazonei_mxnet_p36/lib/python3.6/json/decoder.py in decode(self, s, _w)
337
338 """
--> 339 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
340 end = _w(s, end).end()
341 if end != len(s):
~/anaconda3/envs/amazonei_mxnet_p36/lib/python3.6/json/decoder.py in raw_decode(self, s, idx)
355 obj, end = self.scan_once(s, idx)
356 except StopIteration as err:
--> 357 raise JSONDecodeError("Expecting value", s, err.value) from None
358 return obj, end
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
```
Contributor guide
Research direction
Start with reinforcement_learning/rl_roboschool_ray/rl_roboschool_ray.ipynb and reproduce the problem cell using predictor.predict(input). Inspect the endpoint response alongside the SageMaker TensorFlow serving deserializer traceback; done means the supplied test input is accepted and result['outputs']['actions'] can be read successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, jupyter-notebook, python
- Domain
- api, cloud, machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100