h2o-llmstudio icon indicating copy to clipboard operation
h2o-llmstudio copied to clipboard

[BUG] peft/lora ValueError: Please specify `target_modules` in `peft_config` training docker

Open RobMulla opened this issue 1 year ago • 1 comments

🐛 Bug

Training on a custom datase using the docker release of LLM Studio. Selected the h2oai/h2ogpt-gm-oasst1-en-2048-falcon-7b-v2 backbone. At the start of training I recieve a ValueError: Please specify target_modulesinpeft_config`.

To Reproduce

I'm using all default config settings. With the attached CSV training dataset.

Stack trace:

2023-06-19 14:56:47,182 - INFO: Global random seed: 135674
2023-06-19 14:56:47,182 - WARNING: No OpenAI API Key set. Setting metric to BLEU. 
2023-06-19 14:56:47,182 - INFO: Preparing the data...
2023-06-19 14:56:47,182 - INFO: Setting up automatic validation split...
2023-06-19 14:56:47,187 - INFO: Preparing train and validation data
2023-06-19 14:56:47,187 - INFO: Loading train dataset...
2023-06-19 14:56:48,251 - INFO: Stop token ids: [tensor([   39,   103, 46617, 54146]), tensor([   39,   103, 18269,   444, 54146])]
2023-06-19 14:56:48,253 - INFO: Sample prompt: <|prompt|>Hey LexFriGPT, write a podcast introduction for Nick Bostrom<|endoftext|><|answer|>
2023-06-19 14:56:48,253 - INFO: Loading validation dataset...
2023-06-19 14:56:48,391 - INFO: Stop token ids: [tensor([   39,   103, 46617, 54146]), tensor([   39,   103, 18269,   444, 54146])]
2023-06-19 14:56:48,393 - INFO: Sample prompt: <|prompt|>Hey LexFriGPT, write a podcast introduction for Manolis Kellis<|endoftext|><|answer|>
2023-06-19 14:56:48,393 - INFO: Number of observations in train dataset: 153
2023-06-19 14:56:48,393 - INFO: Number of observations in validation dataset: 2
2023-06-19 14:56:48,779 - INFO: Using float16 for backbone
2023-06-19 15:01:11,507 - ERROR: Exception occurred during H2O LLM Studio run:
Traceback (most recent call last):
  File "/workspace/train_wave.py", line 106, in <module>
    run(cfg=cfg)
  File "/workspace/train.py", line 510, in run
    model = cfg.architecture.model_class(cfg)
  File "/workspace/llm_studio/src/models/text_causal_language_modeling_model.py", line 114, in __init__
    self.backbone = get_peft_model(self.backbone, lora_config)
  File "/root/.local/share/virtualenvs/workspace-dqq3IVyd/lib/python3.10/site-packages/peft/mapping.py", line 120, in get_peft_model
    return MODEL_TYPE_TO_PEFT_MODEL_MAPPING[peft_config.task_type](model, peft_config)
  File "/root/.local/share/virtualenvs/workspace-dqq3IVyd/lib/python3.10/site-packages/peft/peft_model.py", line 723, in __init__
    super().__init__(model, peft_config, adapter_name)
  File "/root/.local/share/virtualenvs/workspace-dqq3IVyd/lib/python3.10/site-packages/peft/peft_model.py", line 105, in __init__
    self.base_model = PEFT_TYPE_TO_MODEL_MAPPING[peft_config.peft_type](
  File "/root/.local/share/virtualenvs/workspace-dqq3IVyd/lib/python3.10/site-packages/peft/tuners/lora.py", line 174, in __init__
    self.add_adapter(adapter_name, self.peft_config[adapter_name])
  File "/root/.local/share/virtualenvs/workspace-dqq3IVyd/lib/python3.10/site-packages/peft/tuners/lora.py", line 179, in add_adapter
    config = self._prepare_lora_config(config, model_config)
  File "/root/.local/share/virtualenvs/workspace-dqq3IVyd/lib/python3.10/site-packages/peft/tuners/lora.py", line 389, in _prepare_lora_config
    raise ValueError("Please specify `target_modules` in `peft_config`")
ValueError: Please specify `target_modules` in `peft_config`

lexfridGPT.csv

RobMulla avatar Jun 19 '23 15:06 RobMulla

Thanks for opening this issue. It is already tracked here, with this PR open to fix the issue.

maxjeblick avatar Jun 19 '23 15:06 maxjeblick

@binga

this will be merged asap, for now you can enter it manually into the setting in the GUI: lora_target_modules: query_key_value,dense_h_to_4h,dense_4h_to_h,dense

psinger avatar Jun 27 '23 12:06 psinger

Fixed by https://github.com/h2oai/h2o-llmstudio/pull/166

maxjeblick avatar Jun 27 '23 15:06 maxjeblick