Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception when saving weights from QLORA due to UnboundLocalError #24096

Closed
2 of 4 tasks
ethanhs opened this issue Jun 7, 2023 · 3 comments · Fixed by #24103
Closed
2 of 4 tasks

Exception when saving weights from QLORA due to UnboundLocalError #24096

ethanhs opened this issue Jun 7, 2023 · 3 comments · Fixed by #24103

Comments

@ethanhs
Copy link

ethanhs commented Jun 7, 2023

System Info

  • transformers version: 4.30.0.dev0
  • Platform: Linux-6.1.0-9-amd64-x86_64-with-glibc2.36
  • Python version: 3.10.10
  • Huggingface_hub version: 0.15.1
  • Safetensors version: 0.3.1
  • PyTorch version (GPU?): 2.0.1+cu117 (False)
  • Tensorflow version (GPU?): not installed (NA)
  • Flax version (CPU?/GPU?/TPU?): not installed (NA)
  • Jax version: not installed
  • JaxLib version: not installed
  • Using GPU in script?: yes
  • Using distributed or parallel set-up in script?: no

Who can help?

@sgugger you reviewed the PR so it looks like your eyes were on this most recently. Relevant commit: 357f281

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • My own task or dataset (give details below)

Reproduction

Run the following notebook: https://colab.research.google.com/github/utensil/llm-playground/blob/main/notebooks/axolotl/colab/axolotl_falcon_1b_qlora_gsm8k.ipynb.

I get the following error:

Traceback (most recent call last):
  File "/home/e/et/ethanhs/axolotl/axolotl/scripts/finetune.py", line 295, in <module>
    fire.Fire(train)
  File "/home/e/et/ethanhs/miniconda3/lib/python3.10/site-packages/fire/core.py", line 141, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
  File "/home/e/et/ethanhs/miniconda3/lib/python3.10/site-packages/fire/core.py", line 475, in _Fire
    component, remaining_args = _CallAndUpdateTrace(
  File "/home/e/et/ethanhs/miniconda3/lib/python3.10/site-packages/fire/core.py", line 691, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
  File "/home/e/et/ethanhs/axolotl/axolotl/scripts/finetune.py", line 282, in train
    trainer.train(resume_from_checkpoint=resume_from_checkpoint)
  File "/home/e/et/ethanhs/miniconda3/lib/python3.10/site-packages/transformers/trainer.py", line 1661, in train
    return inner_training_loop(
  File "/home/e/et/ethanhs/miniconda3/lib/python3.10/site-packages/transformers/trainer.py", line 2070, in _inner_training_loop
    self._load_best_model()
  File "/home/e/et/ethanhs/miniconda3/lib/python3.10/site-packages/transformers/trainer.py", line 2258, in _load_best_model
    self._issue_warnings_after_load(load_result)
UnboundLocalError: local variable 'load_result' referenced before assignment

Expected behavior

I expect for transformers not to raise an exception.

@sgugger
Copy link
Collaborator

sgugger commented Jun 7, 2023

cc @younesbelkada

@younesbelkada
Copy link
Contributor

Hi @ethanhs
Thanks for reporting #24103 should solve the issue

@ethanhs
Copy link
Author

ethanhs commented Jun 8, 2023

Thanks for the quick response and quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants