首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >OSError:当试图加载CompVis/稳定扩散-v1-4:<class‘requests.Exctions.HTTPError’>时出现了一个特定的连接错误

OSError:当试图加载CompVis/稳定扩散-v1-4:<class‘requests.Exctions.HTTPError’>时出现了一个特定的连接错误
EN

Stack Overflow用户
提问于 2022-11-03 14:38:38
回答 1查看 489关注 0票数 2

系统信息

谷歌Colab,免费版,GPU

信息

  • 官方示例脚本
  • 我自己修改的脚本

任务

  • 官方支持的examples文件夹中的任务(如胶水/班次,.),
  • My
  • My
  • own任务或dataset (详见下文)

再生产

  1. https://github.com/woctezuma/stable-diffusion-colab
  2. https://colab.research.google.com/github/woctezuma/stable-diffusion-colab/blob/main/stable_diffusion.ipynb#scrollTo=GR4vF2bw-sHR
  3. copy创建以驱动
  4. 运行第一单元
  5. 运行第二单元
  6. ,将我的令牌从https://huggingface.co/settings/tokens
  7. paste复制到已归档的
  8. 按下enter

>H 133#1错误- https://discuss.huggingface.co/t/invalid-token-passed/22711

  1. https://huggingface.co/settings/tokens mange无效并刷新<https://discuss.huggingface.co/t/invalid-token-passed/22711
  2. https://huggingface.co/settings/tokens>H 238H 139再次运行第二个单元格<>H 240<代码>H 141复制和粘贴在新标记<代码>H 242<代码>G 243中

代码语言:javascript
复制
        _|    _|  _|    _|    _|_|_|    _|_|_|  _|_|_|  _|      _|    _|_|_|      _|_|_|_|    _|_|      _|_|_|  _|_|_|_|
        _|    _|  _|    _|  _|        _|          _|    _|_|    _|  _|            _|        _|    _|  _|        _|
        _|_|_|_|  _|    _|  _|  _|_|  _|  _|_|    _|    _|  _|  _|  _|  _|_|      _|_|_|    _|_|_|_|  _|        _|_|_|
        _|    _|  _|    _|  _|    _|  _|    _|    _|    _|    _|_|  _|    _|      _|        _|    _|  _|        _|
        _|    _|    _|_|      _|_|_|    _|_|_|  _|_|_|  _|      _|    _|_|_|      _|        _|    _|    _|_|_|  _|_|_|_|

        To login, `huggingface_hub` now requires a token generated from https://huggingface.co/settings/tokens .
        
Token: 
Login successful
Your token has been saved to /root/.huggingface/token
Authenticated through git-credential store but this isn't the helper defined on your machine.
You might have to re-authenticate when pushing to the Hugging Face Hub. Run the following command in your terminal in case you want to set this credential helper as the default

git config --global credential.helper store

  1. 我运行的git config --global credential.helper store比我能重新运行的任何东西都要多,并向前移动2单元
  2. 单元代码

代码语言:javascript
复制
import mediapy as media
import torch
from torch import autocast
from diffusers import StableDiffusionPipeline

model_id = "CompVis/stable-diffusion-v1-4"
device = "cuda"
remove_safety = False


pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=scheduler, torch_dtype=torch.float16, revision="fp16", use_auth_token=True)
if remove_safety:
  pipe.safety_checker = lambda images, clip_input: (images, False)
pipe = pipe.to(device)

  1. ERROR

代码语言:javascript
复制
[/usr/local/lib/python3.7/dist-packages/requests/models.py](https://localhost:8080/#) in raise_for_status(self)
    940         if http_error_msg:
--> 941             raise HTTPError(http_error_msg, response=self)
    942 

HTTPError: 403 Client Error: Forbidden for url: https://huggingface.co/CompVis/stable-diffusion-v1-4/resolve/fp16/model_index.json

The above exception was the direct cause of the following exception:

HfHubHTTPError                            Traceback (most recent call last)
[/usr/local/lib/python3.7/dist-packages/diffusers/configuration_utils.py](https://localhost:8080/#) in get_config_dict(cls, pretrained_model_name_or_path, **kwargs)
    233                     subfolder=subfolder,
--> 234                     revision=revision,
    235                 )

[/usr/local/lib/python3.7/dist-packages/huggingface_hub/file_download.py](https://localhost:8080/#) in hf_hub_download(repo_id, filename, subfolder, repo_type, revision, library_name, library_version, cache_dir, user_agent, force_download, force_filename, proxies, etag_timeout, resume_download, use_auth_token, local_files_only, legacy_cache_layout)
   1056                     proxies=proxies,
-> 1057                     timeout=etag_timeout,
   1058                 )

[/usr/local/lib/python3.7/dist-packages/huggingface_hub/file_download.py](https://localhost:8080/#) in get_hf_file_metadata(url, use_auth_token, proxies, timeout)
   1358     )
-> 1359     hf_raise_for_status(r)
   1360 

[/usr/local/lib/python3.7/dist-packages/huggingface_hub/utils/_errors.py](https://localhost:8080/#) in hf_raise_for_status(response, endpoint_name)
    253         # as well (request id and/or server error message)
--> 254         raise HfHubHTTPError(str(HTTPError), response=response) from e
    255 

HfHubHTTPError: <class 'requests.exceptions.HTTPError'> (Request ID: esduBFUm9KJXSxYhFffq4)

During handling of the above exception, another exception occurred:

OSError                                   Traceback (most recent call last)
[<ipython-input-6-9b05f13f8bf3>](https://localhost:8080/#) in <module>
      9 
     10 
---> 11 pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=scheduler, torch_dtype=torch.float16, revision="fp16", use_auth_token=True)
     12 if remove_safety:
     13   pipe.safety_checker = lambda images, clip_input: (images, False)

[/usr/local/lib/python3.7/dist-packages/diffusers/pipeline_utils.py](https://localhost:8080/#) in from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
    371                 local_files_only=local_files_only,
    372                 use_auth_token=use_auth_token,
--> 373                 revision=revision,
    374             )
    375             # make sure we only download sub-folders and `diffusers` filenames

[/usr/local/lib/python3.7/dist-packages/diffusers/configuration_utils.py](https://localhost:8080/#) in get_config_dict(cls, pretrained_model_name_or_path, **kwargs)
    254             except HTTPError as err:
    255                 raise EnvironmentError(
--> 256                     "There was a specific connection error when trying to load"
    257                     f" {pretrained_model_name_or_path}:\n{err}"
    258                 )

OSError: There was a specific connection error when trying to load CompVis/stable-diffusion-v1-4:
<class 'requests.exceptions.HTTPError'> (Request ID: esduBFUm9KJXSxYhFffq4)

预期行为

运行所有单元格并生成照片,如GitHub项目显示的https://github.com/woctezuma/stable-diffusion-colab

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-11-04 21:11:41

只需访问拥抱脸网站,并同意条款。

https://huggingface.co/CompVis/stable-diffusion-v1-4

你需要登录到你的拥抱脸帐户。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74304875

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档