Skip to content

Getting 500 Internal Server Error / Exception in ASGI application #14

@ghost

Description

Here is a small write-up I've build and use it:

(.venv) root@node2:~# huggingface-cli download meta-llama/Meta-Llama-3.1-405B-Instruct-FP8 --local-dir /data/test-llama31-405b-fp8 --token $HF_TOKEN 
Fetching 242 files:   0%|                                                                                            | 0/242 [00:00<?, ?it/s]Downloading 'model-00004-of-00109.safetensors' to '/data/test-llama31-405b-fp8/.cache/huggingface/download/model-00004-of-00109.safetensors.376536d7284c6a79a65ee8e3fb3ee3fdf1a13040f72ac31ca7d2e4b13e7d52a3.incomplete'
Downloading 'model-00007-of-00109.safetensors' to '/data/test-llama31-405b-fp8/.cache/huggingface/download/model-00007-of-00109.safetensors.1fcdeb3bc4556d7da5bdf242919dc50df950563d8191d3be518fb001ab3e6331.incomplete'
Downloading 'model-00006-of-00109.safetensors' to '/data/test-llama31-405b-fp8/.cache/huggingface/download/model-00006-of-00109.safetensors.877173ef17665d02a697423e2b5c1e0fd8b3f50a8ba5c09b413896027c487789.incomplete'
Downloading 'model-00001-of-00109.safetensors' to '/data/test-llama31-405b-fp8/.cache/huggingface/download/model-00001-of-00109.safetensors.27d6760e00f3b8fcf6ab7824a2de50f07f59cc08b03d263b6c0d562daf8622bf.incomplete'
Downloading 'model-00003-of-00109.safetensors' to '/data/test-llama31-405b-fp8/.cache/huggingface/download/model-00003-of-00109.safetensors.26bb5d1cd5b224dee88f442b1a6acdf196a5d647d5af6834c62aa6a2a01bdd05.incomplete'
Downloading 'model-00005-of-00109.safetensors' to '/data/test-llama31-405b-fp8/.cache/huggingface/download/model-00005-of-00109.safetensors.fba70c82a800da30df1f08a2fd80829679d290dac140a8203c9a4c8076eab931.incomplete'
Downloading 'model-00002-of-00109.safetensors' to '/data/test-llama31-405b-fp8/.cache/huggingface/download/model-00002-of-00109.safetensors.efef014770d588f4206f2da94ac251db8958f6a8ce1e38762d28c044bb015198.incomplete'
Downloading 'model-00008-of-00109.safetensors' to '/data/test-llama31-405b-fp8/.cache/huggingface/download/model-00008-of-00109.safetensors.410058afd38e1cdbca5a1a9cdae4e25f6d006763c3b224b6101611049458e109.incomplete'
Fetching 242 files:   2%|██                                                                                  | 6/242 [00:01<01:09,  3.41it/s]
Downloading 'model-00009-of-00109.safetensors' to '/data/test-llama31-405b-fp8/.cache/huggingface/download/model-00009-of-00109.safetensors.c41de3c512d78c8de6266adffa0db49850ee4692a6d74c2084f6519c450abdd6.incomplete'
Downloading 'model-00010-of-00109.safetensors' to '/data/test-llama31-405b-fp8/.cache/huggingface/download/model-00010-of-00109.safetensors.f919b1ef9202fe7b15871fc3f18610d3f799f8bbdd7b4bbfddc3ce7dc652fd21.incomplete'
Downloading 'model-00011-of-00109.safetensors' to '/data/test-llama31-405b-fp8/.cache/huggingface/download/model-00011-of-00109.safetensors.b235950238fed5a7260863c9f38efeea90d919467156b9d80d1301429b2c82f3.incomplete'
Traceback (most recent call last):
  File "/root/.venv/lib/python3.10/site-packages/huggingface_hub/utils/_errors.py", line 304, in hf_raise_for_status
    response.raise_for_status()
  File "/root/.venv/lib/python3.10/site-packages/requests/models.py", line 1024, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: http://172.16.50.10:8090/repos/c6/4c/c64c854f39008d2148640af0dd443a6a3334f993ea71b7a970e2ac0dbdb25591/27d6760e00f3b8fcf6ab7824a2de50f07f59cc08b03d263b6c0d562daf8622bf?response-content-disposition=inline%3B+filename*%3DUTF-8%27%27model-00001-of-00109.safetensors%3B+filename%3D%22model-00001-of-00109.safetensors%22%3B&Expires=1723210405&Policy=eyJTdGF0ZW1lbnQiOlt7IkNvbmRpdGlvbiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTcyMzIxMDQwNX19LCJSZXNvdXJjZSI6Imh0dHBzOi8vY2RuLWxmcy11cy0xLmh1Z2dpbmdmYWNlLmNvL3JlcG9zL2M2LzRjL2M2NGM4NTRmMzkwMDhkMjE0ODY0MGFmMGRkNDQzYTZhMzMzNGY5OTNlYTcxYjdhOTcwZTJhYzBkYmRiMjU1OTEvMjdkNjc2MGUwMGYzYjhmY2Y2YWI3ODI0YTJkZTUwZjA3ZjU5Y2MwOGIwM2QyNjNiNmMwZDU2MmRhZjg2MjJiZj9yZXNwb25zZS1jb250ZW50LWRpc3Bvc2l0aW9uPSoifV19&Signature=fr9up4qmn0-~hwfDOHbqsKbRUKmaY~arE~9CHFuq5soQPLXTV4cwysE2REWplGAadJZCJxlDWUxM6ira3HjnkFt4hqtzSG2Sb3nDJOQ-8lRLD7T2XUIgLtGiwn-zcIaXOOerHg9~rI8R~Q7QpGX078lpTpml0-chIzB8FrHmmMAfVCvnDsGIsT2FYV-hqR2m-YWIlAty7a-WlBykkDpkaQNu3iz-VYztzJviTVQo4IDRd~6P6euGLW5iyTEzQsi1-gYEm6dBfyrazhvHqEzLr56Tm0Y43AewnhYoWC5a~onjcAy502CdYKUcDDCzSjlsaMZ7baHLNu7YOdPwPYCuXA__&Key-Pair-Id=K24J24Z295AEI9

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

Traceback (most recent call last):
  File "/root/.venv/bin/huggingface-cli", line 8, in <module>
    sys.exit(main())
  File "/root/.venv/lib/python3.10/site-packages/huggingface_hub/commands/huggingface_cli.py", line 52, in main
    service.run()
  File "/root/.venv/lib/python3.10/site-packages/huggingface_hub/commands/download.py", line 146, in run
    print(self._download())  # Print path to downloaded files
  File "/root/.venv/lib/python3.10/site-packages/huggingface_hub/commands/download.py", line 180, in _download
    return snapshot_download(
  File "/root/.venv/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn
    return fn(*args, **kwargs)
  File "/root/.venv/lib/python3.10/site-packages/huggingface_hub/_snapshot_download.py", line 299, in snapshot_download
    thread_map(
  File "/root/.venv/lib/python3.10/site-packages/tqdm/contrib/concurrent.py", line 69, in thread_map
    return _executor_map(ThreadPoolExecutor, fn, *iterables, **tqdm_kwargs)
  File "/root/.venv/lib/python3.10/site-packages/tqdm/contrib/concurrent.py", line 51, in _executor_map
    return list(tqdm_class(ex.map(fn, *iterables, chunksize=chunksize), **kwargs))
  File "/root/.venv/lib/python3.10/site-packages/tqdm/std.py", line 1181, in __iter__
    for obj in iterable:
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 621, in result_iterator
    yield _result_or_cancel(fs.pop())
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 319, in _result_or_cancel
    return fut.result(timeout)
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 458, in result
    return self.__get_result()
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
  File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/root/.venv/lib/python3.10/site-packages/huggingface_hub/_snapshot_download.py", line 273, in _inner_hf_hub_download
    return hf_hub_download(
  File "/root/.venv/lib/python3.10/site-packages/huggingface_hub/utils/_deprecation.py", line 101, in inner_f
    return f(*args, **kwargs)
  File "/root/.venv/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn
    return fn(*args, **kwargs)
  File "/root/.venv/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 1220, in hf_hub_download
    return _hf_hub_download_to_local_dir(
  File "/root/.venv/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 1515, in _hf_hub_download_to_local_dir
    _download_to_tmp_and_move(
  File "/root/.venv/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 1915, in _download_to_tmp_and_move
    http_get(
  File "/root/.venv/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 463, in http_get
    r = _request_wrapper(
  File "/root/.venv/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 400, in _request_wrapper
    hf_raise_for_status(response)
  File "/root/.venv/lib/python3.10/site-packages/huggingface_hub/utils/_errors.py", line 371, in hf_raise_for_status
    raise HfHubHTTPError(str(e), response=response) from e
huggingface_hub.utils._errors.HfHubHTTPError: 500 Server Error: Internal Server Error for url: http://172.16.50.10:8090/repos/c6/4c/c64c854f39008d2148640af0dd443a6a3334f993ea71b7a970e2ac0dbdb25591/27d6760e00f3b8fcf6ab7824a2de50f07f59cc08b03d263b6c0d562daf8622bf?response-content-disposition=inline%3B+filename*%3DUTF-8%27%27model-00001-of-00109.safetensors%3B+filename%3D%22model-00001-of-00109.safetensors%22%3B&Expires=1723210405&Policy=eyJTdGF0ZW1lbnQiOlt7IkNvbmRpdGlvbiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTcyMzIxMDQwNX19LCJSZXNvdXJjZSI6Imh0dHBzOi8vY2RuLWxmcy11cy0xLmh1Z2dpbmdmYWNlLmNvL3JlcG9zL2M2LzRjL2M2NGM4NTRmMzkwMDhkMjE0ODY0MGFmMGRkNDQzYTZhMzMzNGY5OTNlYTcxYjdhOTcwZTJhYzBkYmRiMjU1OTEvMjdkNjc2MGUwMGYzYjhmY2Y2YWI3ODI0YTJkZTUwZjA3ZjU5Y2MwOGIwM2QyNjNiNmMwZDU2MmRhZjg2MjJiZj9yZXNwb25zZS1jb250ZW50LWRpc3Bvc2l0aW9uPSoifV19&Signature=fr9up4qmn0-~hwfDOHbqsKbRUKmaY~arE~9CHFuq5soQPLXTV4cwysE2REWplGAadJZCJxlDWUxM6ira3HjnkFt4hqtzSG2Sb3nDJOQ-8lRLD7T2XUIgLtGiwn-zcIaXOOerHg9~rI8R~Q7QpGX078lpTpml0-chIzB8FrHmmMAfVCvnDsGIsT2FYV-hqR2m-YWIlAty7a-WlBykkDpkaQNu3iz-VYztzJviTVQo4IDRd~6P6euGLW5iyTEzQsi1-gYEm6dBfyrazhvHqEzLr56Tm0Y43AewnhYoWC5a~onjcAy502CdYKUcDDCzSjlsaMZ7baHLNu7YOdPwPYCuXA__&Key-Pair-Id=K24J24Z295AEI9
(.venv) root@node2:~# 
root@node1:~# curl -I http://localhost:8090/repos/c6/4c/c64c854f39008d2148640af0dd443a6a3334f993ea71b7a970e2ac0dbdb25591/model-00005-of-00109.safetensors
HTTP/1.1 500 Internal Server Error
date: Tue, 06 Aug 2024 14:39:15 GMT
server: uvicorn
content-length: 21
content-type: text/plain; charset=utf-8

root@node1:~# Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | INFO | httpx | HTTP Request: HEAD https://cdn-lfs.huggingface.co/repos/c6/4c/c64c854f39008d2148640af0dd443a6a3334f993ea71b7a970e2ac0dbdb25591/model-00005-of-00109.safetensors "HTTP/1.1 403 Forbidden"
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | INFO | stdout | INFO:     127.0.0.1:37654 - "HEAD /repos/c6/4c/c64c854f39008d2148640af0dd443a6a3334f993ea71b7a970e2ac0dbdb25591/model-00005-of-00109.safetensors HTTP/1.1" 500 Internal Server Error
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr | ERROR:    Exception in ASGI application
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr | Traceback (most recent call last):
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |   File "/data/olah/.venv/lib/python3.10/site-packages/uvicorn/protocols/http/httptools_impl.py", line 399, in run_asgi
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |     result = await app(  # type: ignore[func-returns-value]
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |   File "/data/olah/.venv/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 70, in __call__
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |     return await self.app(scope, receive, send)
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |   File "/data/olah/.venv/lib/python3.10/site-packages/fastapi/applications.py", line 1054, in __call__
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |     await super().__call__(scope, receive, send)
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |   File "/data/olah/.venv/lib/python3.10/site-packages/starlette/applications.py", line 123, in __call__
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |     await self.middleware_stack(scope, receive, send)
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |   File "/data/olah/.venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |     raise exc
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |   File "/data/olah/.venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |     await self.app(scope, receive, _send)
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |   File "/data/olah/.venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 65, in __call__
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |     await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |   File "/data/olah/.venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |     raise exc
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |   File "/data/olah/.venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |     await app(scope, receive, sender)
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |   File "/data/olah/.venv/lib/python3.10/site-packages/starlette/routing.py", line 756, in __call__
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |     await self.middleware_stack(scope, receive, send)
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |   File "/data/olah/.venv/lib/python3.10/site-packages/starlette/routing.py", line 776, in app
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |     await route.handle(scope, receive, send)
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |   File "/data/olah/.venv/lib/python3.10/site-packages/starlette/routing.py", line 297, in handle
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |     await self.app(scope, receive, send)
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |   File "/data/olah/.venv/lib/python3.10/site-packages/starlette/routing.py", line 77, in app
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |     await wrap_app_handling_exceptions(app, request)(scope, receive, send)
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |   File "/data/olah/.venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |     raise exc
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |   File "/data/olah/.venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |     await app(scope, receive, sender)
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |   File "/data/olah/.venv/lib/python3.10/site-packages/starlette/routing.py", line 72, in app
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |     response = await func(request)
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |   File "/data/olah/.venv/lib/python3.10/site-packages/fastapi/routing.py", line 278, in app
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |     raw_response = await run_endpoint_function(
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |   File "/data/olah/.venv/lib/python3.10/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |     return await dependant.call(**values)
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |   File "/data/olah/olah/olah/server.py", line 402, in lfs_head
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |     status_code = await generator.__anext__()
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |   File "/data/olah/olah/olah/proxy/files.py", line 257, in _file_realtime_stream
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |     status_code, head_info, content = await _file_full_header(
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |   File "/data/olah/olah/olah/proxy/files.py", line 89, in _file_full_header
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr |     raise Exception(f"Unexpected HTTP status code {response.status_code}")
Aug 06 14:39:16 node1 python[2932916]: 2024-08-06 14:39:16 | ERROR | stderr | Exception: Unexpected HTTP status code 403

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions