From b7db709c4729cc2ec522fc987a4fe6f0126f4bea Mon Sep 17 00:00:00 2001 From: somebody Date: Sat, 6 May 2023 11:16:09 -0500 Subject: [PATCH] PEFT: Change directory structure to be inside model --- modeling/inference_models/hf_torch.py | 10 +++++++++- models/peft/README.txt | 2 -- 2 files changed, 9 insertions(+), 3 deletions(-) delete mode 100644 models/peft/README.txt diff --git a/modeling/inference_models/hf_torch.py b/modeling/inference_models/hf_torch.py index d4d5320b..c46195ba 100644 --- a/modeling/inference_models/hf_torch.py +++ b/modeling/inference_models/hf_torch.py @@ -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 diff --git a/models/peft/README.txt b/models/peft/README.txt deleted file mode 100644 index fc7b72c4..00000000 --- a/models/peft/README.txt +++ /dev/null @@ -1,2 +0,0 @@ -PEFT models will be stored in this directory when downloaded. -Please don't be too mean to this directory.