diff --git a/hellomeme/tools/utils.py b/hellomeme/tools/utils.py index 22ea7a4..de30af3 100644 --- a/hellomeme/tools/utils.py +++ b/hellomeme/tools/utils.py @@ -132,12 +132,16 @@ def download_file_from_cloud(model_id, print(e) assert False, "@@ Failed to download model from modelscope" else: - from huggingface_hub import hf_hub_download + from huggingface_hub import hf_hub_download, login try: - model_path = hf_hub_download(model_id, filename=file_name, cache_dir=cache_dir, token=hf_token) - except Exception as e: - print(e) - assert False, "@@ Failed to download model from huggingface hub" + model_path = hf_hub_download(model_id, filename=file_name, cache_dir=cache_dir) + except: + try: + login(token=hf_token) + model_path = hf_hub_download(model_id, filename=file_name, cache_dir=cache_dir) + except Exception as e: + print(e) + assert False, "@@ Failed to download model from huggingface hub" return model_path def creat_model_from_cloud(model_cls, @@ -161,8 +165,13 @@ def creat_model_from_cloud(model_cls, model = model_cls.from_pretrained(model_path, subfolder=subfolder) else: try: - model = model_cls.from_pretrained(model_id, subfolder=subfolder, cache_dir=cache_dir, token=hf_token) - except Exception as e: - print(e) - assert False, "@@ Failed to download model from huggingface hub" + model = model_cls.from_pretrained(model_id, subfolder=subfolder, cache_dir=cache_dir) + except: + try: + from huggingface_hub import login + login(token=hf_token) + model = model_cls.from_pretrained(model_id, subfolder=subfolder, cache_dir=cache_dir) + except Exception as e: + print(e) + assert False, "@@ Failed to download model from huggingface hub" return model \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 71fce1d..f3dc1fb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "comfyui_hellomeme" description = "This repository is the official implementation of the [a/HelloMeme](https://arxiv.org/pdf/2410.22901) ComfyUI interface" -version = "1.3.20" +version = "1.3.21" license = {file = "LICENSE"} [project.urls]