当前位置:   article > 正文

hugging face模型下载方法_hugging face 下载

hugging face 下载

huggingface普通下载会被墙
下载前先登录: huggingface-cli login
然后在python中运行代码(运行python文件不会显示进度条,将其复制粘贴到命令行中运行)

from huggingface_hub import snapshot_download

repo_id = "stabilityai/stable-diffusion-2-base"  # "stabilityai/stable-diffusion-2-base"
local_dir = '/root/home/huggingface_model_dir/stable-diffusion-2-base'
cache_dir = local_dir + "/cache"
snapshot_download(cache_dir=cache_dir, local_dir=local_dir, repo_id=repo_id, local_dir_use_symlinks=False,
                  resume_download=True, allow_patterns=["*.model", "*.json", "*.bin", "*.py", "*.md", "*.txt"],
                  ignore_patterns=["*.safetensors", "*.msgpack", "*.h5", "*.ot", ], )
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

其中repo地址即为hugging face项目名
local_dir为项目保存地址

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Guff_9hys/article/detail/943058
推荐阅读
相关标签
  

闽ICP备14008679号