autogluon / autogluon/autogluon-cloud

TypeError: read_json() got an unexpected keyword argument 'header'

Open
#189 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
42
Forks
17
PR merge metrics
No merged PRs in 30d

Description

```
ModelError: Received server error (500) from primary with message "read_json() got an unexpected keyword argument 'header'
Traceback (most recent call last):
File "/opt/conda/lib/python3.11/site-packages/sagemaker_inference/transformer.py", line 150, in transform
result = self._run_handler_function(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/lib/python3.11/site-packages/sagemaker_inference/transformer.py", line 280, in _run_handler_function
result = func(*argv)
^^^^^^^^^^^
File "/opt/ml/model/code/tabular_serve.py", line 55, in transform_fn
data = _read_with_fallback(pd.read_json, buf, column_names)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/ml/model/code/tabular_serve.py", line 141, in _read_with_fallback
data = read_func(buf, header=None)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: read_json() got an unexpected keyword argument 'header'
```

Exact place where issue occurs: https://github.com/autogluon/autogluon-cloud/blob/f515ec202fad7cc1ca3fd5687335cdd6ca2f3ae5/src/autogluon/cloud/scripts/sagemaker_scripts/tabular_serve.py#L141

Afaik, `header` argument is only available in `read_csv`. Will try to fix this if this will become a blocker.

Contributor guide

Open the contributing guide

Research direction

The failure is at line 141 of src/autogluon/cloud/scripts/sagemaker_scripts/tabular_serve.py, inside _read_with_fallback. Inspect how pandas read_json and read_csv are called there, then reproduce the tabular serving path with JSON input. Done means the SageMaker request no longer raises the unexpected keyword argument error.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, pandas, python
Domain
cloud, machine-learning
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.