From 5c49a0dcd02c3cf2e31a00fdaf554f36895276d7 Mon Sep 17 00:00:00 2001 From: "Alex \"mcmonkey\" Goodwin" Date: Sat, 25 Mar 2023 12:37:32 -0700 Subject: [PATCH] fix error from prepare call running twice in a row --- modules/training.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/training.py b/modules/training.py index e2be18e..0e210c5 100644 --- a/modules/training.py +++ b/modules/training.py @@ -90,7 +90,8 @@ def do_train(loraName: str, microBatchSize: int, batchSize: int, epochs: int, le evalData = load_dataset("json", data_files=cleanPath('training/datasets', f'{evalDataset}.json')) evalData = evalData['train'].shuffle().map(generate_and_tokenize_prompt) # Start prepping the model itself - model = prepare_model_for_int8_training(model) + if not hasattr(model, 'lm_head') or hasattr(model.lm_head, 'weight'): + model = prepare_model_for_int8_training(model) config = LoraConfig( r=loraRank, lora_alpha=loraAlpha,