ashawkey / stable-dreamfusion

Text-to-3D & Image-to-3D & Mesh Exportation with NeRF + Diffusion.
Apache License 2.0
8k stars 710 forks source link

HTTPError: 403 Client Error: Forbidden for url #75

Open jiapei100 opened 1 year ago

jiapei100 commented 1 year ago
➜  stable-dreamfusion git:(main) ✗ python main.py --text "a hamburger" --workspace trial -O
~/.local/lib/python3.10/site-packages/numpy/core/getlimits.py:500: UserWarning: The value of the smallest subnormal for <class 'numpy.float64'> type is zero.
  setattr(self, word, getattr(machar, word).flat[0])
~/.local/lib/python3.10/site-packages/numpy/core/getlimits.py:89: UserWarning: The value of the smallest subnormal for <class 'numpy.float64'> type is zero.
  return self._float_to_str(self.smallest_subnormal)
~/.local/lib/python3.10/site-packages/numpy/core/getlimits.py:500: UserWarning: The value of the smallest subnormal for <class 'numpy.float32'> type is zero.
  setattr(self, word, getattr(machar, word).flat[0])
~/.local/lib/python3.10/site-packages/numpy/core/getlimits.py:89: UserWarning: The value of the smallest subnormal for <class 'numpy.float32'> type is zero.
  return self._float_to_str(self.smallest_subnormal)
Namespace(text='a hamburger', negative='', O=True, O2=False, test=False, save_mesh=False, eval_interval=10, workspace='trial', guidance='stable-diffusion', seed=0, iters=10000, lr=0.001, ckpt='latest', cuda_ray=True, max_steps=1024, num_steps=64, upsample_steps=64, update_extra_interval=16, max_ray_batch=4096, albedo_iters=1000, bg_radius=1.4, density_thresh=10, fp16=True, backbone='grid', w=64, h=64, jitter_pose=False, bound=1, dt_gamma=0, min_near=0.1, radius_range=[1.0, 1.5], fovy_range=[40, 70], dir_text=True, suppress_face=False, angle_overhead=30, angle_front=60, lambda_entropy=0.0001, lambda_opacity=0, lambda_orient=0.01, lambda_smooth=0, gui=False, W=800, H=800, radius=3, fovy=60, light_theta=60, light_phi=0, max_spp=1)
NeRFNetwork(
  (encoder): GridEncoder: input_dim=3 num_levels=16 level_dim=2 resolution=16 -> 2048 per_level_scale=1.3819 params=(903480, 2) gridtype=tiled align_corners=False
  (sigma_net): MLP(
    (net): ModuleList(
      (0): Linear(in_features=32, out_features=64, bias=True)
      (1): Linear(in_features=64, out_features=64, bias=True)
      (2): Linear(in_features=64, out_features=4, bias=True)
    )
  )
  (encoder_bg): FreqEncoder: input_dim=3 degree=6 output_dim=39
  (bg_net): MLP(
    (net): ModuleList(
      (0): Linear(in_features=39, out_features=64, bias=True)
      (1): Linear(in_features=64, out_features=3, bias=True)
    )
  )
)
2022-11-05 17:13:35.854107: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  SSE3 SSE4.1 SSE4.2 AVX AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
[INFO] try to load hugging face access token from the default place, make sure you have run `huggingface-cli login`.
[INFO] loading stable diffusion...
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ ~/.local/lib/python3.10/site-packages/huggingface_hub/utils/_errors.py:213 in        │
│ hf_raise_for_status                                                                              │
│                                                                                                  │
│   210 │   </Tip>                                                                                 │
│   211 │   """                                                                                    │
│   212 │   try:                                                                                   │
│ ❱ 213 │   │   response.raise_for_status()                                                        │
│   214 │   except HTTPError as e:                                                                 │
│   215 │   │   error_code = response.headers.get("X-Error-Code")                                  │
│   216                                                                                            │
│                                                                                                  │
│ ~/.local/lib/python3.10/site-packages/requests/models.py:1021 in raise_for_status    │
│                                                                                                  │
│   1018 │   │   │   )                                                                             │
│   1019 │   │                                                                                     │
│   1020 │   │   if http_error_msg:                                                                │
│ ❱ 1021 │   │   │   raise HTTPError(http_error_msg, response=self)                                │
│   1022 │                                                                                         │
│   1023 │   def close(self):                                                                      │
│   1024 │   │   """Releases the connection back to the pool. Once this method has been            │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
HTTPError: 403 Client Error: Forbidden for url: https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/vae/diffusion_pytorch_model.bin

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

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ ~/.local/lib/python3.10/site-packages/diffusers/modeling_utils.py:368 in             │
│ from_pretrained                                                                                  │
│                                                                                                  │
│   365 │   │   else:                                                                              │
│   366 │   │   │   try:                                                                           │
│   367 │   │   │   │   # Load from URL or cache if already cached                                 │
│ ❱ 368 │   │   │   │   model_file = hf_hub_download(                                              │
│   369 │   │   │   │   │   pretrained_model_name_or_path,                                         │
│   370 │   │   │   │   │   filename=WEIGHTS_NAME,                                                 │
│   371 │   │   │   │   │   cache_dir=cache_dir,                                                   │
│                                                                                                  │
│ ~/.local/lib/python3.10/site-packages/huggingface_hub/file_download.py:1053 in       │
│ hf_hub_download                                                                                  │
│                                                                                                  │
│   1050 │   if not local_files_only:                                                              │
│   1051 │   │   try:                                                                              │
│   1052 │   │   │   try:                                                                          │
│ ❱ 1053 │   │   │   │   metadata = get_hf_file_metadata(                                          │
│   1054 │   │   │   │   │   url=url,                                                              │
│   1055 │   │   │   │   │   use_auth_token=use_auth_token,                                        │
│   1056 │   │   │   │   │   proxies=proxies,                                                      │
│                                                                                                  │
│ ~/.local/lib/python3.10/site-packages/huggingface_hub/file_download.py:1359 in       │
│ get_hf_file_metadata                                                                             │
│                                                                                                  │
│   1356 │   │   proxies=proxies,                                                                  │
│   1357 │   │   timeout=timeout,                                                                  │
│   1358 │   )                                                                                     │
│ ❱ 1359 │   hf_raise_for_status(r)                                                                │
│   1360 │                                                                                         │
│   1361 │   # Return                                                                              │
│   1362 │   return HfFileMetadata(                                                                │
│                                                                                                  │
│ ~/.local/lib/python3.10/site-packages/huggingface_hub/utils/_errors.py:254 in        │
│ hf_raise_for_status                                                                              │
│                                                                                                  │
│   251 │   │                                                                                      │
│   252 │   │   # Convert `HTTPError` into a `HfHubHTTPError` to display request information       │
│   253 │   │   # as well (request id and/or server error message)                                 │
│ ❱ 254 │   │   raise HfHubHTTPError(str(HTTPError), response=response) from e                     │
│   255                                                                                            │
│   256                                                                                            │
│   257 def _raise_for_status(response):                                                           │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
HfHubHTTPError: <class 'requests.exceptions.HTTPError'> (Request ID: puiVq5ZfvAhgnsa-QeImQ)

During handling of the above exception, another exception occurred:

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ ............/stable-dreamfusion/main.py: │
│ 130 in <module>                                                                                  │
│                                                                                                  │
│   127 │   │                                                                                      │
│   128 │   │   if opt.guidance == 'stable-diffusion':                                             │
│   129 │   │   │   from nerf.sd import StableDiffusion                                            │
│ ❱ 130 │   │   │   guidance = StableDiffusion(device)                                             │
│   131 │   │   elif opt.guidance == 'clip':                                                       │
│   132 │   │   │   from nerf.clip import CLIP                                                     │
│   133 │   │   │   guidance = CLIP(device)                                                        │
│                                                                                                  │
│ ............/stable-dreamfusion/nerf/sd. │
│ py:39 in __init__                                                                                │
│                                                                                                  │
│    36 │   │   print(f'[INFO] loading stable diffusion...')                                       │
│    37 │   │                                                                                      │
│    38 │   │   # 1. Load the autoencoder model which will be used to decode the latents into im   │
│ ❱  39 │   │   self.vae = AutoencoderKL.from_pretrained("runwayml/stable-diffusion-v1-5", subfo   │
│    40 │   │                                                                                      │
│    41 │   │   # 2. Load the tokenizer and text encoder to tokenize and encode the text.          │
│    42 │   │   self.tokenizer = CLIPTokenizer.from_pretrained("openai/clip-vit-large-patch14")    │
│                                                                                                  │
│ ~/.local/lib/python3.10/site-packages/diffusers/modeling_utils.py:400 in             │
│ from_pretrained                                                                                  │
│                                                                                                  │
│   397 │   │   │   │   │   f"{pretrained_model_name_or_path} does not appear to have a file nam   │
│   398 │   │   │   │   )                                                                          │
│   399 │   │   │   except HTTPError as err:                                                       │
│ ❱ 400 │   │   │   │   raise EnvironmentError(                                                    │
│   401 │   │   │   │   │   "There was a specific connection error when trying to load"            │
│   402 │   │   │   │   │   f" {pretrained_model_name_or_path}:\n{err}"                            │
│   403 │   │   │   │   )                                                                          │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
OSError: There was a specific connection error when trying to load runwayml/stable-diffusion-v1-5:
<class 'requests.exceptions.HTTPError'> (Request ID: puiVq5ZfvAhgnsa-QeImQ)

Can anybody help please?

ashawkey commented 1 year ago

@jiapei100 Hi, you could try this: https://github.com/ashawkey/stable-dreamfusion/issues/76#issuecomment-1306567601