PEFT: Change directory structure to be inside model

This commit is contained in:
somebody
2023-05-06 11:16:09 -05:00
parent f02ddab7c7
commit b7db709c47
2 changed files with 9 additions and 3 deletions

View File

@@ -215,7 +215,15 @@ class HFTorchInferenceModel(HFInferenceModel):
# PEFT Loading. This MUST be done after all save_pretrained calls are
# finished on the main model.
if utils.args.peft:
peft_local_path = os.path.join("models/peft", utils.args.peft.replace("/", "_"))
local_peft_dir = os.path.join(m_self.get_local_model_path(), "peft")
# Make PEFT dir if it doesn't exist
try:
os.makedirs(local_peft_dir)
except FileExistsError:
pass
peft_local_path = os.path.join(local_peft_dir, utils.args.peft.replace("/", "_"))
logger.debug(f"Loading PEFT '{utils.args.peft}', possible local path is '{peft_local_path}'.")
peft_installed_locally = True

View File

@@ -1,2 +0,0 @@
PEFT models will be stored in this directory when downloaded.
Please don't be too mean to this directory.