artidoro / qlora

QLoRA: Efficient Finetuning of Quantized LLMs
https://arxiv.org/abs/2305.14314
MIT License
10.08k stars 823 forks source link

TypeError: 'NoneType' object is not iterable #268

Open reilgun opened 1 year ago

reilgun commented 1 year ago

Any idea what could be causing this error? My configuration is as follows: https://raw.githubusercontent.com/reilgun/runpod-qlora-trainer/master/scripts/run_flash_large.sh

Loading checkpoint shards: 100%|██████████| 3/3 [00:29<00:00,  9.95s/it]
/usr/local/lib/python3.10/dist-packages/transformers/utils/hub.py:374: FutureWarning: The `use_auth_token` argument is deprecated and will be removed in v5 of Transformers.
  warnings.warn(
Downloading (…)neration_config.json: 100%|██████████| 182/182 [00:00<00:00, 812kB/s]
/usr/local/lib/python3.10/dist-packages/transformers/models/auto/tokenization_auto.py:640: FutureWarning: The `use_auth_token` argument is deprecated and will be removed in v5 of Transformers.
  warnings.warn(
Downloading (…)okenizer_config.json: 100%|██████████| 855/855 [00:00<00:00, 4.05MB/s]
Downloading tokenizer.model: 100%|██████████| 500k/500k [00:00<00:00, 12.1MB/s]
Downloading (…)cial_tokens_map.json: 100%|██████████| 438/438 [00:00<00:00, 1.99MB/s]
Adding special tokens.
Traceback (most recent call last):
  File "/workspace/qlora/flash_qlora.py", line 6, in <module>
    train()
  File "/workspace/qlora/qlora.py", line 707, in train
    model, tokenizer = get_accelerate_model(args, checkpoint_dir)
  File "/workspace/qlora/qlora.py", line 372, in get_accelerate_model
    "unk_token": tokenizer.convert_ids_to_tokens(
  File "/usr/local/lib/python3.10/dist-packages/transformers/tokenization_utils.py", line 912, in convert_ids_to_tokens
    for index in ids:
TypeError: 'NoneType' object is not iterable
DDJN-data-science commented 1 year ago

I get the same error. I used the config from llama 2 7b here and only changed path to model. Everything else has been just like the repo here for me.

reilgun commented 1 year ago

I've trained qloras successfully with the same docker container in the past. I don't know if it's something about the model I am using that triggers this error. You can see it's spicyboros-2.2

DDJN-data-science commented 1 year ago

@reilgun For me I found that adding the unk_token is the only thing causing it to fail. Simply commenting out the line seems to work when I use it for LLaMa 2