Squashed commit of the following:

commit dd612fd72e
Author: JiangCheng <jiangcheng@kezaihui.com>
Date:   Mon Jun 5 16:04:54 2023 +0800

    Failed to download the file and need to delete the created file path
This commit is contained in:
JiangCheng 2023-07-05 12:04:10 +02:00 committed by Eren Gölge
parent e42a72eb79
commit 53938e2d32
1 changed files with 12 additions and 7 deletions

View File

@ -317,14 +317,19 @@ class ModelManager(object):
else:
os.makedirs(output_path, exist_ok=True)
print(f" > Downloading model to {output_path}")
if "fairseq" in model_name:
self.download_fairseq_model(model_name, output_path)
elif "github_rls_url" in model_item:
self._download_github_model(model_item, output_path)
elif "hf_url" in model_item:
self._download_hf_model(model_item, output_path)
try:
if "fairseq" in model_name:
self.download_fairseq_model(model_name, output_path)
elif "github_rls_url" in model_item:
self._download_github_model(model_item, output_path)
elif "hf_url" in model_item:
self._download_hf_model(model_item, output_path)
self.print_model_license(model_item=model_item)
except requests.Exception.RequestException as e:
print(f" > Failed to download the model file to {output_path}")
rmtree(output_path)
raise e
self.print_model_license(model_item=model_item)
# find downloaded files
output_model_path = output_path
output_config_path = None