mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-29 02:49:30 +01:00
Properly format exceptions in the UI
This commit is contained in:
parent
3390196a14
commit
3e70bce576
@ -483,7 +483,7 @@ def do_train(lora_name: str, always_override: bool, save_steps: int, micro_batch
|
|||||||
exc = traceback.format_exc()
|
exc = traceback.format_exc()
|
||||||
logger.error('Failed to reload the model.')
|
logger.error('Failed to reload the model.')
|
||||||
print(exc)
|
print(exc)
|
||||||
return exc
|
return exc.replace('\n', '\n\n')
|
||||||
|
|
||||||
# == Start prepping the model itself ==
|
# == Start prepping the model itself ==
|
||||||
if not hasattr(shared.model, 'lm_head') or hasattr(shared.model.lm_head, 'weight'):
|
if not hasattr(shared.model, 'lm_head') or hasattr(shared.model.lm_head, 'weight'):
|
||||||
@ -518,7 +518,7 @@ def do_train(lora_name: str, always_override: bool, save_steps: int, micro_batch
|
|||||||
state_dict_peft = torch.load(f"{lora_file_path}/adapter_model.bin")
|
state_dict_peft = torch.load(f"{lora_file_path}/adapter_model.bin")
|
||||||
set_peft_model_state_dict(lora_model, state_dict_peft)
|
set_peft_model_state_dict(lora_model, state_dict_peft)
|
||||||
except:
|
except:
|
||||||
yield traceback.format_exc()
|
yield traceback.format_exc().replace('\n', '\n\n')
|
||||||
return
|
return
|
||||||
|
|
||||||
if shared.args.monkey_patch:
|
if shared.args.monkey_patch:
|
||||||
|
@ -75,7 +75,7 @@ def load_model_wrapper(selected_model, loader, autoload=False):
|
|||||||
exc = traceback.format_exc()
|
exc = traceback.format_exc()
|
||||||
logger.error('Failed to load the model.')
|
logger.error('Failed to load the model.')
|
||||||
print(exc)
|
print(exc)
|
||||||
yield exc
|
yield exc.replace('\n', '\n\n')
|
||||||
|
|
||||||
|
|
||||||
def load_lora_wrapper(selected_loras):
|
def load_lora_wrapper(selected_loras):
|
||||||
@ -159,7 +159,7 @@ def download_model_wrapper(repo_id, progress=gr.Progress()):
|
|||||||
yield ("Done!")
|
yield ("Done!")
|
||||||
except:
|
except:
|
||||||
progress(1.0)
|
progress(1.0)
|
||||||
yield traceback.format_exc()
|
yield traceback.format_exc().replace('\n', '\n\n')
|
||||||
|
|
||||||
|
|
||||||
def create_model_menus():
|
def create_model_menus():
|
||||||
|
Loading…
Reference in New Issue
Block a user