adithya-s-k / omniparse

Ingest, parse, and optimize any data format ➡️ from documents to multimedia ➡️ for enhanced compatibility with GenAI frameworks
https://docs.cognitivelab.in
GNU General Public License v3.0
4.37k stars 350 forks source link

OSError: We couldn't connect to 'https://huggingface.co' to load this file, couldn't find it in the cached files and it looks like vikp/surya_det2 is not the path to a directory containing a file named config.json. #6

Open enryteam opened 3 weeks ago

enryteam commented 3 weeks ago

How do I manually download which specific models from https://huggingface.co/ and in which directory of the specific project

error: ######################################### conda activate /home/tom/miniconda3/envs/omniparse-venv (omniparse-venv) root@UBANTU:/home/tom/tomAI/omniparse# python server.py --host 0.0.0.0 --port 8666 --documents --web

   .88888.                      oo  888888ba                                      
  d8'   `8b                         88    `8b                                     
  88     88 88d8b.d8b. 88d888b. dP a88aaaa8P' .d8888b. 88d888b. .d8888b. .d8888b. 
  88     88 88'`88'`88 88'  `88 88  88        88'  `88 88'  `88 Y8ooooo. 88ooood8 
  Y8.   .8P 88  88  88 88    88 88  88        88.  .88 88             88 88.  ... 
   `8888P'  dP  dP  dP dP    dP dP  dP        `88888P8 dP       `88888P' `88888P' 

Created by Adithya S K : https://twitter.com/adithya_s_k

[LOG] ✅ Loading OCR Model Traceback (most recent call last): File "/home/tom/miniconda3/envs/omniparse-venv/lib/python3.10/site-packages/urllib3/connection.py", line 196, in _new_conn sock = connection.create_connection( File "/home/tom/miniconda3/envs/omniparse-venv/lib/python3.10/site-packages/urllib3/util/connection.py", line 85, in create_connection raise err File "/home/tom/miniconda3/envs/omniparse-venv/lib/python3.10/site-packages/urllib3/util/connection.py", line 73, in create_connection sock.connect(sa) OSError: [Errno 101] Network is unreachable

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

Traceback (most recent call last): File "/home/tom/miniconda3/envs/omniparse-venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 789, in urlopen response = self._make_request( File "/home/tom/miniconda3/envs/omniparse-venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 490, in _make_request raise new_e File "/home/tom/miniconda3/envs/omniparse-venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 466, in _make_request self._validate_conn(conn) File "/home/tom/miniconda3/envs/omniparse-venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 1095, in _validate_conn conn.connect() File "/home/tom/miniconda3/envs/omniparse-venv/lib/python3.10/site-packages/urllib3/connection.py", line 615, in connect self.sock = sock = self._new_conn() File "/home/tom/miniconda3/envs/omniparse-venv/lib/python3.10/site-packages/urllib3/connection.py", line 211, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f03e82ce740>: Failed to establish a new connection: [Errno 101] Network is unreachable

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

Traceback (most recent call last): File "/home/tom/miniconda3/envs/omniparse-venv/lib/python3.10/site-packages/requests/adapters.py", line 667, in send resp = conn.urlopen( File "/home/tom/miniconda3/envs/omniparse-venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 843, in urlopen retries = retries.increment( File "/home/tom/miniconda3/envs/omniparse-venv/lib/python3.10/site-packages/urllib3/util/retry.py", line 519, in increment raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /vikp/surya_det2/resolve/main/config.json (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f03e82ce740>: Failed to establish a new connection: [Errno 101] Network is unreachable'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/tom/miniconda3/envs/omniparse-venv/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 1722, in _get_metadata_or_catch_error metadata = get_hf_file_metadata(url=url, proxies=proxies, timeout=etag_timeout, headers=headers) File "/home/tom/miniconda3/envs/omniparse-venv/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn return fn(args, kwargs) File "/home/tom/miniconda3/envs/omniparse-venv/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 1645, in get_hf_file_metadata r = _request_wrapper( File "/home/tom/miniconda3/envs/omniparse-venv/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 372, in _request_wrapper response = _request_wrapper( File "/home/tom/miniconda3/envs/omniparse-venv/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 395, in _request_wrapper response = get_session().request(method=method, url=url, params) File "/home/tom/miniconda3/envs/omniparse-venv/lib/python3.10/site-packages/requests/sessions.py", line 589, in request resp = self.send(prep, send_kwargs) File "/home/tom/miniconda3/envs/omniparse-venv/lib/python3.10/site-packages/requests/sessions.py", line 703, in send r = adapter.send(request, kwargs) File "/home/tom/miniconda3/envs/omniparse-venv/lib/python3.10/site-packages/huggingface_hub/utils/_http.py", line 66, in send return super().send(request, args, **kwargs) File "/home/tom/miniconda3/envs/omniparse-venv/lib/python3.10/site-packages/requests/adapters.py", line 700, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: (MaxRetryError("HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /vikp/surya_det2/resolve/main/config.json (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f03e82ce740>: Failed to establish a new connection: [Errno 101] Network is unreachable'))"), '(Request ID: ebf677d7-1daa-4c61-9ce8-52e6c6aaa017)')

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

Traceback (most recent call last): File "/home/tom/miniconda3/envs/omniparse-venv/lib/python3.10/site-packages/transformers/utils/hub.py", line 402, in cached_file resolved_file = hf_hub_download( File "/home/tom/miniconda3/envs/omniparse-venv/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn return fn(*args, **kwargs) File "/home/tom/miniconda3/envs/omniparse-venv/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 1221, in hf_hub_download return _hf_hub_download_to_cache_dir( File "/home/tom/miniconda3/envs/omniparse-venv/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 1325, in _hf_hub_download_to_cache_dir _raise_on_head_call_error(head_call_error, force_download, local_files_only) File "/home/tom/miniconda3/envs/omniparse-venv/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 1826, in _raise_on_head_call_error raise LocalEntryNotFoundError( huggingface_hub.utils._errors.LocalEntryNotFoundError: An error happened while trying to locate the file on the Hub and we cannot find the requested files in the local cache. Please check your connection and try again or make sure your Internet connection is on.

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

Traceback (most recent call last): File "/home/tom/tomAI/omniparse/server.py", line 60, in main() File "/home/tom/tomAI/omniparse/server.py", line 46, in main load_omnimodel(args.documents, args.media, args.web) File "/home/tom/tomAI/omniparse/omniparse/init.py", line 26, in load_omnimodel shared_state.model_list = load_all_models() File "/home/tom/tomAI/omniparse/omniparse/documents/models.py", line 68, in load_all_models detection = setup_detection_model(device, dtype) File "/home/tom/tomAI/omniparse/omniparse/documents/models.py", line 26, in setup_detection_model model = segformer.load_model() File "/home/tom/miniconda3/envs/omniparse-venv/lib/python3.10/site-packages/surya/model/detection/segformer.py", line 23, in load_model config = SegformerConfig.from_pretrained(checkpoint) File "/home/tom/miniconda3/envs/omniparse-venv/lib/python3.10/site-packages/transformers/configuration_utils.py", line 603, in from_pretrained config_dict, kwargs = cls.get_config_dict(pretrained_model_name_or_path, kwargs) File "/home/tom/miniconda3/envs/omniparse-venv/lib/python3.10/site-packages/transformers/configuration_utils.py", line 632, in get_config_dict config_dict, kwargs = cls._get_config_dict(pretrained_model_name_or_path, kwargs) File "/home/tom/miniconda3/envs/omniparse-venv/lib/python3.10/site-packages/transformers/configuration_utils.py", line 689, in _get_config_dict resolved_config_file = cached_file( File "/home/tom/miniconda3/envs/omniparse-venv/lib/python3.10/site-packages/transformers/utils/hub.py", line 445, in cached_file raise EnvironmentError( OSError: We couldn't connect to 'https://huggingface.co' to load this file, couldn't find it in the cached files and it looks like vikp/surya_det2 is not the path to a directory containing a file named config.json. Checkout your internet connection or see how to run the library in offline mode at 'https://huggingface.co/docs/transformers/installation#offline-mode'.

qyou commented 3 weeks ago

@enryteam You can set hf mirror to fix the huggingface.co internet connection problem. Try this:

export HF_ENDPOINT=https://hf-mirror.com
seasoncool commented 3 weeks ago

or run with docker like this : docker run --gpus all -e HF_ENDPOINT=https://hf-mirror.com -p 8000:8000 savatar101/omniparse:0.1

adithya-s-k commented 3 weeks ago

I personally haven't faced this issue.

@seasoncool @qyou Thank you for your assistance.

@enryteam, let me know if you were able to fix the issue or if it still persists.