• 【debug】安装diffusion的bug解决合集


    环境问题

    ImportError: cannot import name ‘CLIPImageProcessor’ from
    ‘transformers’ (D:\Python\lib\site-packages\transformers_init_.py)

    https://github.com/huggingface/transformers/issues/23340

    解决:查看更详细信息,安装环境

    transformers-cli env
    
    • 1

    网络问题

    1 连接切换回本地,下载

    model_id = "runwayml/stable-diffusion-v1-5"
    pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
    pipe = pipe.to("cuda")
    
    • 1
    • 2
    • 3

    换成

    model_id = "本地仓"
    model_id = "D:\code\Github_code\Stable_diffusion\stable-diffusion-v1-5"
    
    pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16, revision="fp16")
    pipe = pipe.to(device)
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    2

    You seem to have cloned a repository without having git-lfs installed

    从别的电脑上复制过来,而不是从hugging face直接下载。需要使用

    git lfs pull
    
    • 1

    大文件下载中断问题

    仅克隆小文件,大文件用下载工具下载,然后软连接

     GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/runwayml/stable-diffusion-v1-5
    
    • 1

    不要用https,选ssh。

    git lfs install
    GIT_LFS_SKIP_SMUDGE=1  git clone git@hf.co:runwayml/stable-diffusion-v1-5
    
    • 1
    • 2

    4

    pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
    Loading pipeline components...:  29%|██████████████████████████████████▌                                                                                      | 2/7 [00:00<00:00, 12.42it/s]
    Traceback (most recent call last):
      File "C:\conda\envs\ldm\lib\site-packages\diffusers\models\modeling_utils.py", line 108, in load_state_dict
        return safetensors.torch.load_file(checkpoint_file, device="cpu")
      File "C:\conda\envs\ldm\lib\site-packages\safetensors\torch.py", line 308, in load_file
        with safe_open(filename, framework="pt", device=device) as f:
    safetensors_rust.SafetensorError: Error while deserializing header: HeaderTooLarge
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "", line 1, in 
      File "C:\conda\envs\ldm\lib\site-packages\diffusers\pipelines\pipeline_utils.py", line 1105, in from_pretrained
        loaded_sub_model = load_sub_model(
      File "C:\conda\envs\ldm\lib\site-packages\diffusers\pipelines\pipeline_utils.py", line 472, in load_sub_model
        loaded_sub_model = load_method(os.path.join(cached_folder, name), **loading_kwargs)
      File "C:\conda\envs\ldm\lib\site-packages\diffusers\models\modeling_utils.py", line 641, in from_pretrained
        state_dict = load_state_dict(model_file, variant=variant)
      File "C:\conda\envs\ldm\lib\site-packages\diffusers\models\modeling_utils.py", line 113, in load_state_dict
        raise OSError(
    OSError: You seem to have cloned a repository without having git-lfs installed. Please install git-lfs and run `git lfs install` followed by `git lfs pull` in the folder you cloned.
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
  • 相关阅读:
    Spring的Factories机制介绍
    前端甘特图组件开发(一)
    栈与队列:用栈实现队列
    【无标题】
    grpc在arm架构cpu的linux环境下生成java代码
    【C++】通过哈希表实现map和set
    C++ Reference: Standard C++ Library reference: C Library: cstring
    36_ue4进阶末日生存游戏开发[背包系统2]
    秋招挂麻了,就差去送外卖了,10w字Java八股啃完,春招必拿下
    Visual Studio 如何把一个解决方案中已经打开的选项页在另一个解决方案中打开
  • 原文地址:https://blog.csdn.net/prinTao/article/details/133943124