当前位置:   article > 正文

【debug】安装diffusion的bug解决合集_safetensors_rust.safetensorerror: error while dese

safetensors_rust.safetensorerror: error while deserializing header: headerto

环境问题

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 "<stdin>", line 1, in <module>
  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
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/239338
推荐阅读
相关标签
  

闽ICP备14008679号