Add --panic to raise when loading fails

This commit is contained in:
somebody
2023-07-08 14:04:46 -05:00
parent fd6f66a98d
commit c2ee30af32
3 changed files with 8 additions and 0 deletions

View File

@@ -363,6 +363,8 @@ class HFTorchInferenceModel(HFInferenceModel):
return GPTNeoForCausalLM.from_pretrained(location, **tf_kwargs)
except Exception as e:
logger.warning(f"{self.model_name} is a no-go; {e} - Falling back to auto.")
if utils.args.panic:
raise e
# Try to determine model type from either AutoModel or falling back to legacy
try:
@@ -414,6 +416,9 @@ class HFTorchInferenceModel(HFInferenceModel):
logger.error("Invalid load key! Aborting.")
raise
if utils.args.panic:
raise e
logger.warning(f"Fell back to GPT2LMHeadModel due to {e}")
logger.debug(traceback.format_exc())