zeno-ml / zeno-client

Python client for creating new Zeno projects and uploading data
https://zenoml.com/docs/intro/#creating-a-project
MIT License
8 stars 0 forks source link

JSON Decoding Error on upload_dataset #13

Closed neubig closed 12 months ago

neubig commented 12 months ago

I'm getting the following error when I do upload dataset:

project.upload_dataset(df, id_column="example_id", label_column="label", data_column="context")

I have a jupyter notebook to reproduce, which I will share privately.

---------------------------------------------------------------------------
JSONDecodeError                           Traceback (most recent call last)
File [~/anaconda3/envs/zeno-build/lib/python3.10/site-packages/requests/models.py:971](https://file+.vscode-resource.vscode-cdn.net/Users/gneubig/sand/~/anaconda3/envs/zeno-build/lib/python3.10/site-packages/requests/models.py:971), in Response.json(self, **kwargs)
    970 try:
--> 971     return complexjson.loads(self.text, **kwargs)
    972 except JSONDecodeError as e:
    973     # Catch JSON-related errors and raise as requests.JSONDecodeError
    974     # This aliases json.JSONDecodeError and simplejson.JSONDecodeError

File [~/anaconda3/envs/zeno-build/lib/python3.10/json/__init__.py:346](https://file+.vscode-resource.vscode-cdn.net/Users/gneubig/sand/~/anaconda3/envs/zeno-build/lib/python3.10/json/__init__.py:346), in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
    343 if (cls is None and object_hook is None and
    344         parse_int is None and parse_float is None and
    345         parse_constant is None and object_pairs_hook is None and not kw):
--> 346     return _default_decoder.decode(s)
    347 if cls is None:

File [~/anaconda3/envs/zeno-build/lib/python3.10/json/decoder.py:337](https://file+.vscode-resource.vscode-cdn.net/Users/gneubig/sand/~/anaconda3/envs/zeno-build/lib/python3.10/json/decoder.py:337), in JSONDecoder.decode(self, s, _w)
    333 """Return the Python representation of ``s`` (a ``str`` instance
    334 containing a JSON document).
    335 
    336 """
--> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    338 end = _w(s, end).end()

File [~/anaconda3/envs/zeno-build/lib/python3.10/json/decoder.py:355](https://file+.vscode-resource.vscode-cdn.net/Users/gneubig/sand/~/anaconda3/envs/zeno-build/lib/python3.10/json/decoder.py:355), in JSONDecoder.raw_decode(self, s, idx)
    354 except StopIteration as err:
--> 355     raise JSONDecodeError("Expecting value", s, err.value) from None
    356 return obj, end

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

JSONDecodeError                           Traceback (most recent call last)
[/Users/gneubig/sand/web_arena_zeno.ipynb](https://file+.vscode-resource.vscode-cdn.net/Users/gneubig/sand/web_arena_zeno.ipynb) Cell 9 line 1
----> [1](vscode-notebook-cell:/Users/gneubig/sand/web_arena_zeno.ipynb#X23sZmlsZQ%3D%3D?line=0) project.upload_dataset(df, id_column="example_id", label_column="label", data_column="context")

File [~/anaconda3/envs/zeno-build/lib/python3.10/site-packages/zeno_client/client.py:93](https://file+.vscode-resource.vscode-cdn.net/Users/gneubig/sand/~/anaconda3/envs/zeno-build/lib/python3.10/site-packages/zeno_client/client.py:93), in ZenoProject.upload_dataset(self, df, id_column, label_column, data_column)
     91     print("Successfully uploaded data")
     92 else:
---> 93     raise Exception(response.json()["detail"])

File [~/anaconda3/envs/zeno-build/lib/python3.10/site-packages/requests/models.py:975](https://file+.vscode-resource.vscode-cdn.net/Users/gneubig/sand/~/anaconda3/envs/zeno-build/lib/python3.10/site-packages/requests/models.py:975), in Response.json(self, **kwargs)
    971     return complexjson.loads(self.text, **kwargs)
    972 except JSONDecodeError as e:
    973     # Catch JSON-related errors and raise as requests.JSONDecodeError
    974     # This aliases json.JSONDecodeError and simplejson.JSONDecodeError
--> 975     raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)

JSONDecodeError: Expecting value: line 1 column 1 (char 0)
neubig commented 12 months ago

Closing this in favor of managing on linear: https://linear.app/zenoml/issue/ZEN-148/bug-502-error-and-ensuing-json-decoding-error-when-uploading-large