Lightning-AI / lit-llama

Implementation of the LLaMA language model based on nanoGPT. Supports flash attention, Int8 and GPTQ 4bit quantization, LoRA and LLaMA-Adapter fine-tuning, pre-training. Apache 2.0-licensed.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ValueError: Precision 'bf16-true' is invalid

AlphaGoMK opened this issue · comments

I got ValueError when running python finetune/lora.py

Traceback (most recent call last):
  File "/data/llm/lit-llama/finetune/lora.py", line 218, in <module>
    CLI(main)
  File "/home/.local/lib/python3.9/site-packages/jsonargparse/_cli.py", line 85, in CLI
    return _run_component(component, cfg_init)
  File "/home/.local/lib/python3.9/site-packages/jsonargparse/_cli.py", line 147, in _run_component
    return component(**cfg)
  File "/data/llm/lit-llama/finetune/lora.py", line 55, in main
    fabric = L.Fabric(accelerator="cuda", devices=1, precision="bf16-true") # fixme bf16-true
  File "/home/.local/lib/python3.9/site-packages/lightning/fabric/fabric.py", line 89, in __init__
    self._connector = _Connector(
  File "/home/.local/lib/python3.9/site-packages/lightning/fabric/connector.py", line 126, in __init__
    self._check_config_and_set_final_flags(
  File "/home/.local/lib/python3.9/site-packages/lightning/fabric/connector.py", line 208, in _check_config_and_set_final_flags
    raise ValueError(f"Precision {repr(precision)} is invalid. Allowed precision values: {supported_precision}")
ValueError: Precision 'bf16-true' is invalid. Allowed precision values: ('64', '32', '16', 'bf16', 64, 32, 16)

Looks like default version of lightning==2.0.6 in pypi caused such error.

Comparing the code in 2.0.6 with master commit, lacking of "16-true" caused the value error.

Problem solved after install lightning from github.

  1. git clone git@github.com:Lightning-AI/lightning.git
  2. cd lightning && pip install .

Sorry about the trouble and good suggestion. In practice, I recommend installing fit via the requirements.txt

pip install requirements.txt --upgrade

which uses the suggested installation from GitHub
Screenshot 2023-08-13 at 10 33 13 AM