Disable breakmodel if we error on the check

This commit is contained in:
Henk 2022-09-28 01:00:06 +02:00
parent d2ff32be32
commit 52e120c706
1 changed files with 6 additions and 4 deletions

View File

@ -1566,10 +1566,12 @@ def get_layer_count(model, directory=""):
model_config = AutoConfig.from_pretrained(directory, revision=vars.revision, cache_dir="cache")
else:
model_config = AutoConfig.from_pretrained(model, revision=vars.revision, cache_dir="cache")
if ((utils.HAS_ACCELERATE and model_config.model_type != 'gpt2') or model_config.model_type in ("gpt_neo", "gptj", "xglm", "opt")) and not vars.nobreakmodel:
return utils.num_layers(model_config)
else:
try:
if ((utils.HAS_ACCELERATE and model_config.model_type != 'gpt2') or model_config.model_type in ("gpt_neo", "gptj", "xglm", "opt")) and not vars.nobreakmodel:
return utils.num_layers(model_config)
else:
return None
except:
return None
else:
return None