wxj630 / visual-chatgpt-zh

visual-chatgpt支持中文版本
Apache License 2.0
285 stars 43 forks source link

huggingface下载的本地包没有被get到 #7

Open freedomRen opened 1 year ago

freedomRen commented 1 year ago

运行一些基础组件报错 Repository Not Found for url: https://huggingface.co/models/ControlNet/resolve/main/annotator/ckpts/mlsd_large _512_fp32.pth. Please make sure you specified the correct repo_id and repo_type. If you are trying to access a private or gated repo, make sure you are authenticated. Invalid username or password.

wxj630 commented 1 year ago

是哪一行代码报的错

freedomRen commented 1 year ago

╭───────────────────── Traceback (most recent call last) ──────────────────────╮ │ /media/aiserver/**/Project/chatgpt/visual-chatgpt-zh/visual_chatgpt_zh.py │ │ :164 in │ │ │ │ 161 │ pretrained_model_dir = args.pretrained_model_dir │ │ 162 │ │ │ 163 │ loaddict = {e.split('')[0].strip(): e.split('_')[1].strip() for │ │ ❱ 164 │ bot = ConversationBot(load_dict=load_dict, pretrained_model_dir=pr │ │ 165 │ with gr.Blocks(css="#chatbot .overflow-y-auto{height:500px}") as d │ │ 166 │ │ chatbot = gr.Chatbot(elem_id="chatbot", label="Visual ChatGPT" │ │ 167 │ │ state = gr.State([]) │ │ │ │ /media/aiserver/**/Project/chatgpt/visual-chatgpt-zh/visual_chatgpt_zh.py │ │ :98 in init │ │ │ │ 95 │ │ │ │ 96 │ │ self.models = dict() │ │ 97 │ │ for class_name, device in load_dict.items(): │ │ ❱ 98 │ │ │ self.models[class_name] = globals()[class_name](device=dev │ │ 99 │ │ │ │ 100 │ │ self.tools = [] │ │ 101 │ │ for class_name, instance in self.models.items(): │ │ │ │ /media/aiserver//Project/chatgpt/visual-chatgpt-zh/modules/controlnet_l │ │ ine.py:6 in init │ │ │ │ 3 class Image2Line: │ │ 4 │ def init(self, device, pretrained_model_dir): │ │ 5 │ │ print("Initializing Image2Line") │ │ ❱ 6 │ │ self.detector = MLSDdetector.from_pretrained(f'{pretrained_mode │ │ 7 │ │ │ 8 │ @prompts(name="Line Detection On Image", │ │ 9 │ │ │ description="useful when you want to detect the straight l │ │ │ │ /home//anaconda3/envs/visgpt/lib/python3.8/site-packages/controlnet_aux │ │ /mlsd/init.py:21 in from_pretrained │ │ │ │ 18 │ @classmethod │ │ 19 │ def from_pretrained(cls, pretrained_model_or_path, filename=None): │ │ 20 │ │ filename = filename or "annotator/ckpts/mlsd_large_512_fp32.pth │ │ ❱ 21 │ │ model_path = hf_hub_download(pretrained_model_or_path, filename │ │ 22 │ │ │ │ 23 │ │ model = MobileV2_MLSD_Large() │ │ 24 │ │ model.load_state_dict(torch.load(model_path), strict=True) │ │ │ │ /home//anaconda3/envs/visgpt/lib/python3.8/site-packages/huggingface_hu │ │ b/utils/_validators.py:112 in _inner_fn │ │ │ │ 109 │ │ │ kwargs.items(), # Kwargs values │ │ 110 │ │ ): │ │ 111 │ │ │ if arg_name in ["repo_id", "from_id", "to_id"]: │ │ ❱ 112 │ │ │ │ validate_repo_id(arg_value) │ │ 113 │ │ │ │ │ 114 │ │ │ elif arg_name == "token" and arg_value is not None: │ │ 115 │ │ │ │ has_token = True │ │ │ │ /home//anaconda3/envs/visgpt/lib/python3.8/site-packages/huggingface_hu │ │ b/utils/_validators.py:160 in validate_repo_id │ │ │ │ 157 │ │ raise HFValidationError(f"Repo id must be a string, not {type( │ │ 158 │ │ │ 159 │ if repo_id.count("/") > 1: │ │ ❱ 160 │ │ raise HFValidationError( │ │ 161 │ │ │ "Repo id must be in the form 'repo_name' or 'namespace/rep │ │ 162 │ │ │ f" '{repo_id}'. Use repo_type argument if needed." │ │ 163 │ │ ) │ ╰──────────────────────────────────────────────────────────────────────────────╯ HFValidationError: Repo id must be in the form 'repo_name' or 'namespace/repo_name': '/home/****/Project/chatgpt/visual-chatgpt-zh/models/ControlNet'. Use repo_type argument if needed.

  1. 可能核对下requirement 包的版本 尤其 huggingface_hub 我的 Name: huggingface-hub Version: 0.13.2
  2. huggingface_hub 包的 file_download.py 的 hf_hub_download函数 ,被传入了俩个参数 repo_id: str, 传入的就是自己下载的模型地址+模型路径 filename: str 上游指定的一个默认的模型参数,现在排查在这里了。 应该应该是没去检查模型在不在就去下载了 还引用了一个错误的下载地址,
wxj630 commented 1 year ago

你要先用download_hf_models.sh下载模型呀

freedomRen commented 1 year ago

我模型都下载好了 只是程序没有get到 ,有点类似这个bug https://github.com/huggingface/setfit/issues/111

freedomRen commented 1 year ago

你本地的huggingface_hub 版本对不。 这是在使用 Image2Canny_cpu CannyText2Image_cpu Image2Line_cpu ineText2Image_cuda:0等的时候才会出现的问题

wxj630 commented 1 year ago

我试一下

wxj630 commented 1 year ago

我试了下,主要是controlnet_aux这个包的问题,我更新了一下代码,你再拉下新代码试下

freedomRen commented 1 year ago

好的 我看下你的改动