【safetensor】Debug

编程入门 行业动态 更新时间:2024-10-23 17:30:58

【<a href=https://www.elefans.com/category/jswz/34/1663721.html style=safetensor】Debug"/>

【safetensor】Debug

更多信息详见我的另一篇文档:
介绍

加载权重错误

从本地加载 stable-diffusion 时,

model_id = 'D:\code\git_diffusion_repo\sd\stable-diffusion-v1-5'
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16, revision="fp16")

出现 加载文件错误:

Loading pipeline components...:   0%|          | 0/7 [00:00<?, ?it/s]
Traceback (most recent call last):File "D:\code\Github_code\sd\stable-diffusion-main\加载权重.py", line 7, in <module>pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16, revision="fp16")File "C:\conda\envs\ldm\lib\site-packages\diffusers\pipelines\pipeline_utils.py", line 1105, in from_pretrainedloaded_sub_model = load_sub_model(File "C:\conda\envs\ldm\lib\site-packages\diffusers\pipelines\pipeline_utils.py", line 472, in load_sub_modelloaded_sub_model = load_method(os.path.join(cached_folder, name), **loading_kwargs)File "C:\conda\envs\ldm\lib\site-packages\transformers\modeling_utils.py", line 3019, in from_pretrainedstate_dict = load_state_dict(resolved_archive_file)File "C:\conda\envs\ldm\lib\site-packages\transformers\modeling_utils.py", line 463, in load_state_dictwith safe_open(checkpoint_file, framework="pt") as f:
safetensors_rust.SafetensorError: Error while deserializing header: HeaderTooLargeProcess finished with exit code 1
出现原因:

HeaderTooLarge 说明头解析错误

  • LFS在git下载中被略过,文件是空指针
  • 文档损坏
  • 不是safetensor格式的权重
  • 权重读取时被修改
解决
  • 从github或者hugging face原链接手动下载,注意标有LFS文件
  • 使用flag,强制下载LFS
  • 重新下载权重
  • 不使用软连接
  • 查看文件大小、检查md5 code

更多推荐

【safetensor】Debug

本文发布于:2023-12-05 02:43:41,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1662813.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:safetensor   Debug

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!