Merge pull request #351 from one-some/peft

Change PEFT directory structure to be inside model
This commit is contained in:
henk717
2023-05-06 18:43:57 +02:00
committed by GitHub
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.