Merge pull request #219 from ebolam/united

Fix for GPT2 breakmodel in the UI
This commit is contained in:
henk717 2022-09-28 00:17:27 +02:00 committed by GitHub
commit 3906cc1bd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -1565,11 +1565,14 @@ 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")
return utils.num_layers(model_config)
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
else:
return None
def get_oai_models(key):
vars.oaiapikey = key
if vars.model_selected == 'OAI':