Closed
Description
Bug
Overview
Commit a6d093eb96e62311ffa02cdeb97d78c90fc86e74
This bug happens if there is an exception in parse_arguments
function call because the logger is only bound after it
fms-hf-tuning/tuning/sft_trainer.py
Line 530 in a6d093e
So the logger
variable here is unbound
fms-hf-tuning/tuning/sft_trainer.py
Line 550 in a6d093e
Steps to reproduce
$ python3 -m tuning.sft_trainer --output_dir foo --use_flash_attn false --bnb_qlora true
Traceback (most recent call last):
File "/Users/haribala/Documents/code/remote/github.com/foundation-model-stack/fms-hf-tuning/tuning/sft_trainer.py", line 527, in main
) = parse_arguments(parser, job_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/haribala/Documents/code/remote/github.com/foundation-model-stack/fms-hf-tuning/tuning/sft_trainer.py", line 485, in parse_arguments
) = parser.parse_args_into_dataclasses(return_remaining_strings=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/haribala/Documents/code/remote/github.com/foundation-model-stack/fms-hf-tuning/.venv/lib/python3.11/site-packages/transformers/hf_argparser.py", line 339, in parse_args_into_dataclasses
obj = dtype(**inputs)
^^^^^^^^^^^^^^^
File "<string>", line 5, in __init__
File "/Users/haribala/Documents/code/remote/github.com/foundation-model-stack/fms-hf-tuning/tuning/config/acceleration_configs/quantized_lora_config.py", line 72, in __post_init__
ensure_nested_dataclasses_initialized(self)
File "/Users/haribala/Documents/code/remote/github.com/foundation-model-stack/fms-hf-tuning/tuning/config/acceleration_configs/utils.py", line 34, in ensure_nested_dataclasses_initialized
values = nested_type(*values)
^^^^^^^^^^^^^^^^^^^^
File "<string>", line 5, in __init__
File "/Users/haribala/Documents/code/remote/github.com/foundation-model-stack/fms-hf-tuning/tuning/config/acceleration_configs/utils.py", line 86, in __post_init__
super().__post_init__()
File "/Users/haribala/Documents/code/remote/github.com/foundation-model-stack/fms-hf-tuning/tuning/config/acceleration_configs/quantized_lora_config.py", line 58, in __post_init__
raise ValueError("quant_type can only be either 'nf4' or 'fp4.")
ValueError: quant_type can only be either 'nf4' or 'fp4.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/Users/haribala/Documents/code/remote/github.com/foundation-model-stack/fms-hf-tuning/tuning/sft_trainer.py", line 631, in <module>
fire.Fire(main)
File "/Users/haribala/Documents/code/remote/github.com/foundation-model-stack/fms-hf-tuning/.venv/lib/python3.11/site-packages/fire/core.py", line 143, in Fire
component_trace = _Fire(component, args, parsed_flag_args, context, name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/haribala/Documents/code/remote/github.com/foundation-model-stack/fms-hf-tuning/.venv/lib/python3.11/site-packages/fire/core.py", line 477, in _Fire
component, remaining_args = _CallAndUpdateTrace(
^^^^^^^^^^^^^^^^^^^^
File "/Users/haribala/Documents/code/remote/github.com/foundation-model-stack/fms-hf-tuning/.venv/lib/python3.11/site-packages/fire/core.py", line 693, in _CallAndUpdateTrace
component = fn(*varargs, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/haribala/Documents/code/remote/github.com/foundation-model-stack/fms-hf-tuning/tuning/sft_trainer.py", line 550, in main
logger.error(traceback.format_exc())
^^^^^^
UnboundLocalError: cannot access local variable 'logger' where it is not associated with a value
Metadata
Assignees
Labels
No labels