Lightning-AI / Lightning-AI/lit-llama

Error while running modified prepare_alpaca.py on Linux Mint 21.1

Open
#401 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
6.1k
Forks
517
PR merge metrics
No merged PRs in 30d

Description

I wanted to try and replace the default alpaca dataset to fine-tune on with Microsoft Research's GPT-4 variant. I cut down the GPT-4 set to match the file size accordingly, then ran into this JSONDecodeError at the very end of the dataset. Kept popping up because I replaced it wrong due to lack of knowledge, but even if I replace it with a part of the original dataset it fails.

It's somewhat similar to #239 and #283.

```python
Traceback (most recent call last)
│ /home/mookie/AI/lit-llama/scripts/prepare_halfgpt4.py:131 in

│ 128 if __name__ == "__main__":
│ 129 │ from jsonargparse import CLI
│ 130 │
│ ❱ 131 │ CLI(prepare)
│ 132

│ /home/mookie/miniconda3/lib/python3.10/site-packages/jsonargparse/cli.py:85 in CLI

│ 82 │ │ │ return parser
│ 83 │ │ cfg = parser.parse_args(args) │
│ 84 │ │ cfg_init = parser.instantiate_classes(cfg) │
│ ❱ 85 │ │ return _run_component(component, cfg_init) │
│ 86 │ │
│ 87 │ subcommands = parser.add_subcommands(required=True) │
│ 88 │ comp_dict = {c.__name__: c for c in components} │
│ │
│ /home/mookie/miniconda3/lib/python3.10/site-packages/jsonargparse/cli.py:147 in _run_component │
│ │
│ 144 def _run_component(component, cfg): │
│ 145 │ cfg.pop("config", None) │
│ 146 │ if not inspect.isclass(component): │
│ ❱ 147 │ │ return component(**cfg) │
│ 148 │ subcommand = cfg.pop("subcommand") │
│ 149 │ if not subcommand: │
│ 150 │ │ return component(**cfg) │
│ │
│ /home/mookie/AI/lit-llama/scripts/prepare_halfgpt4.py:45 in prepare │
│ │
│ 42 │ tokenizer = Tokenizer(tokenizer_path) │
│ 43 │ │
│ 44 │ with open(file_path, "r") as file: │
│ ❱ 45 │ │ data = json.load(file) │
│ 46 │ │
│ 47 │ # Partition the dataset into train and test │
│ 48 │ train_split_size = len(data) - test_split_size │
│ │
│ /home/mookie/miniconda3/lib/python3.10/json/__init__.py:293 in load │
│ │
│ 290 │ To use a custom ``JSONDecoder`` subclass, specify it with the ``cls`` │
│ 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, │
│ 296 │ │ parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw) │
│ │
│ /home/mookie/miniconda3/lib/python3.10/json/__init__.py:346 in loads │
│ │
│ 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: │
│ 348 │ │ cls = JSONDecoder │
│ 349 │ if object_hook is not None: │
│ │
│ /home/mookie/miniconda3/lib/python3.10/json/decoder.py:337 in decode │
│ │
│ 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() │
│ 339 │ │ if end != len(s): │
│ 340 │ │ │ raise JSONDecodeError("Extra data", s, end) │
│ │
│ /home/mookie/miniconda3/lib/python3.10/json/decoder.py:353 in raw_decode │
│ │
│ 350 │ │ │
│ 351 │ │ """ │
│ 352 │ │ try: │
│ ❱ 353 │ │ │ obj, end = self.scan_once(s, idx) │
│ 354 │ │ except StopIteration as err: │
│ 355 │ │ │ raise JSONDecodeError("Expecting value", s, err.value) from None │
│ 356 │ │ return obj, end │
```

JSONDecodeError: Expecting ',' delimiter: line 137001 column 1 (char 22579669)

All I did for halfgpt4.py was replace the https:// and file name with a clone of my repo.

Sorry this format is really funky. Hope you can read it ok.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with scripts/prepare_halfgpt4.py, especially the json.load call at line 45, and reproduce the failure using the modified dataset described in the report. Compare the input near line 137001 with the original dataset and determine what behavior or guidance is needed for the preparation script to complete successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data, machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.