From 0ca3941277a85d550b468c9020f1f37679fb24bd Mon Sep 17 00:00:00 2001 From: vmpuri Date: Wed, 9 Oct 2024 14:06:26 -0700 Subject: [PATCH] Delete models from old location for huggingface download --- torchchat/cli/download.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/torchchat/cli/download.py b/torchchat/cli/download.py index 14c19f943..0a912e014 100644 --- a/torchchat/cli/download.py +++ b/torchchat/cli/download.py @@ -149,6 +149,12 @@ def download_and_convert( model_config.distribution_channel == ModelDistributionChannel.HuggingFaceSnapshot ): + # Check if model is already downloaded in the old location + + if os.path.exists(models_dir / model_config.name): + print(f"Found model artifacts in {models_dir / model_config.name}. Downloading in Hugging Face cache...") + shutil.rmtree(models_dir / model_config.name) + _download_hf_snapshot(model_config, hf_token) return