From 58349f44a0924671e65de7cb42764fb846653afe Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Wed, 29 Mar 2023 11:55:34 -0300 Subject: [PATCH] Handle training exception for unsupported models --- modules/training.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/training.py b/modules/training.py index 913866d9..62ba181c 100644 --- a/modules/training.py +++ b/modules/training.py @@ -2,6 +2,7 @@ import json import sys import threading import time +import traceback from pathlib import Path import gradio as gr @@ -184,7 +185,13 @@ def do_train(lora_name: str, micro_batch_size: int, batch_size: int, epochs: int bias="none", task_type="CAUSAL_LM" ) - lora_model = get_peft_model(shared.model, config) + + try: + lora_model = get_peft_model(shared.model, config) + except: + yield traceback.format_exc() + return + trainer = transformers.Trainer( model=lora_model, train_dataset=train_data,