Skip to content

[BUG]: prompt jsonl file read ERROR #3658

@ifromeast

Description

@ifromeast

🐛 Describe the bug

I have just test

from coati.dataset.utils import jload
jdict = jload("./seed_prompts_en.jsonl")

and it will report ERROR that

JSONDecodeError                           Traceback (most recent call last)
Cell In[5], line 2
      1 from coati.dataset.utils import jload
----> 2 jdict = jload("[./seed_prompts_en.jsonl](https://vscode-remote+ssh-002dremote-002b10-002e0-002e79-002e70.vscode-resource.vscode-cdn.net/root/alpaca_test/TeachBot/rlhf/dataset/seed_prompts_en.jsonl)")

File /usr/local/lib/python3.8/dist-packages/coati/dataset/utils.py:20, in jload(f, mode)
     18 """Load a .json file into a dictionary."""
     19 f = _make_r_io_base(f, mode)
---> 20 jdict = json.load(f)
     21 f.close()
     22 return jdict

File /usr/lib/python3.8/json/__init__.py:293, in load(fp, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
    274 def load(fp, *, cls=None, object_hook=None, parse_float=None,
    275         parse_int=None, parse_constant=None, object_pairs_hook=None, **kw):
    276     """Deserialize ``fp`` (a ``.read()``-supporting file-like object containing
    277     a JSON document) to a Python object.
    278 
   (...)
    291     kwarg; otherwise ``JSONDecoder`` is used.
    292     """
--> 293     return loads(fp.read(),
    294         cls=cls, object_hook=object_hook,
    295         parse_float=parse_float, parse_int=parse_int,
...
    339 if end != len(s):
--> 340     raise JSONDecodeError("Extra data", s, end)
    341 return obj

JSONDecodeError: Extra data: line 2 column 1 (char 462)

Is there something wrong with the file or the utils.py?

Environment

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions