Successfully solved HTTPSConnectionPool(host=huggingface.co, port=443): Max retries exceeded with url:LocalEntryNo

HTTPSConnectionPool(host=’huggingface.co’, port=443): Max retries exceeded with url:LocalEntryNotFoundError: Connection error, and we cannot find the requested
files in the disk cache. Please try again or make sure your Internet connection is on.

Table of Contents

Solve the problem

Solutions

Solution


Solve the problem

'HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /unstructuredio/yolo_x_layout/resolve/main/yolox_l0.05_quantized.onnx (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x00000229605069A0>, 'Connection to huggingface.co timed out. (connect timeout=10)'))' thrown while requesting HEAD https://huggingface.co/unstructuredio/yolo_x_layout/resolve/main/yolox_l0.05_quantized .onnx
┌──────────────────── Traceback (most recent call last) ──────────────────── ┐
│ E:\File_Python\Python_daydayup\20230516.py:25 in <module> │
│ │
│ 22 │ │ # print("\\
") │
│ 23 │
│ 24 from unstructured.partition.pdf import partition_pdf │
│ > 25 elements = partition_pdf(filename=filename, infer_table_structure=True │
│ 26 tables = [el for el in elements if el.category == "Table"] │
│ 27 print(tables[0].text) │
│ 28 print(tables[0].metadata.text_as_html) │
│ │
│ D:\ProgramData\Anaconda3\Lib\site-packages\unstructured\documents\elements. │
│ py:306 in wrapper │
│ │
│ 303 │ │ │
│ 304 │ │ @functools.wraps(func) │
│ 305 │ │ def wrapper(*args: _P.args, **kwargs: _P.kwargs) -> List[Elem │
│ > 306 │ │ │ elements = func(*args, **kwargs) │
│ 307 │ │ │ sig = inspect.signature(func) │
│ 308 │ │ │ params: Dict[str, Any] = dict(**dict(zip(sig.parameters, │
│ 309 │ │ │ for param in sig.parameters.values(): │
│ │
│ D:\ProgramData\Anaconda3\Lib\site-packages\unstructured\file_utils\filetype │
│ .py:551 in wrapper │
│ │
│ 548 │ def decorator(func: Callable[_P, List[Element]]) -> Callable[_P, │
│ 549 │ │ @functools.wraps(func) │
│ 550 │ │ def wrapper(*args: _P.args, **kwargs: _P.kwargs) -> List[Elem │
│ > 551 │ │ │ elements = func(*args, **kwargs) │
│ 552 │ │ │ sig = inspect.signature(func) │
│ 553 │ │ │ params: Dict[str, Any] = dict(**dict(zip(sig.parameters, │
│ 554 │ │ │ for param in sig.parameters.values(): │
│ │
│ D:\ProgramData\Anaconda3\Lib\site-packages\unstructured\chunking\title.py:2 │
│ 77 in wrapper │
│ │
│ 274 │ │ │
│ 275 │ │ @functools.wraps(func) │
│ 276 │ │ def wrapper(*args: _P.args, **kwargs: _P.kwargs) -> List[Elem │
│ > 277 │ │ │ elements = func(*args, **kwargs) │
│ 278 │ │ │ sig = inspect.signature(func) │
│ 279 │ │ │ params: Dict[str, Any] = dict(**dict(zip(sig.parameters, │
│ 280 │ │ │ for param in sig.parameters.values(): │
│ │
│ D:\ProgramData\Anaconda3\Lib\site-packages\unstructured\partition\pdf.py:15 │
│ 7 in partition_pdf │
│ │
│ 154 │ │ │ │ "Please use languages instead.", │
│ 155 │ │ │ ) │
│ 156 │ │
│ > 157 │ return partition_pdf_or_image( │
│ 158 │ │ filename=filename, │
│ 159 │ │ file=file, │
│ 160 │ │ include_page_breaks=include_page_breaks, │
│ │
│ D:\ProgramData\Anaconda3\Lib\site-packages\unstructured\partition\pdf.py:28 │
│ 7 in partition_pdf_or_image │
│ │
│ 284 │ │ # NOTE(robinson): Catches a UserWarning that occurs when det │
│ 285 │ │ with warnings.catch_warnings(): │
│ 286 │ │ │ warnings.simplefilter("ignore") │
│ > 287 │ │ │ _layout_elements = _partition_pdf_or_image_local( │
│ 288 │ │ │ │ filename=filename, │
│ 289 │ │ │ │ file=spooled_to_bytes_io_if_needed(file), │
│ 290 │ │ │ │ is_image=is_image, │
│ │
│ D:\ProgramData\Anaconda3\Lib\site-packages\unstructured\utils.py:178 in │
│ wrapper │
│ │
│ 175 │ │ │ │ │ │ else f"Please install them using `pip install │
│ 176 │ │ │ │ │ ), │
│ 177 │ │ │ │ ) │
│ > 178 │ │ │ return func(*args, **kwargs) │
│ 179 │ │ │
│ 180 │ │ return wrapper │
│ 181 │
│ │
│ D:\ProgramData\Anaconda3\Lib\site-packages\unstructured\partition\pdf.py:37 │
│ 7 in _partition_pdf_or_image_local │
│ │
│ 374 │ │
│ 375 │ if file is None: │
│ 376 │ │ # NOTE(christine): out_layout = extracted_layout + inferred_ │
│ > 377 │ │ out_layout = process_file_with_model( │
│ 378 │ │ │ filename, │
│ 379 │ │ │ is_image=is_image, │
│ 380 │ │ │ extract_tables=infer_table_structure, │
│ │
│ D:\ProgramData\Anaconda3\Lib\site-packages\unstructured_inference\inference │
│ \layout.py:481 in process_file_with_model │
│ │
│ 478 │ """Processes pdf file with name filename into a DocumentLayout by │
│ 479 │ model_name.""" │
│ 480 │ │
│ > 481 │ model = get_model(model_name, **kwargs) │
│ 482 │ if isinstance(model, UnstructuredObjectDetectionModel): │
│ 483 │ │ detection_model = model │
│ 484 │ │ element_extraction_model = None │
│ │
│ D:\ProgramData\Anaconda3\Lib\site-packages\unstructured_inference\models\ba │
│ se.py:55 in get_model │
│ │
│ 52 │ │ initialize_params = {**DETECTRON2_ONNX_MODEL_TYPES[model_name] │
│ 53 │ elif model_name in YOLOX_MODEL_TYPES: │
│ 54 │ │ model = UnstructuredYoloXModel() │
│ > 55 │ │ initialize_params = {**YOLOX_MODEL_TYPES[model_name], **kwargs │
│ 56 │ elif model_name in CHIPPER_MODEL_TYPES: │
│ 57 │ │ logger.warning( │
│ 58 │ │ │ "The Chipper model is currently in Beta and is not yet rea │
│ │
│ D:\ProgramData\Anaconda3\Lib\site-packages\unstructured_inference\utils.py: │
│ 44 in __getitem__ │
│ │
│ 41 │ │ if isinstance(value, LazyEvaluateInfo): │
│ 42 │ │ │ evaluate = value.evaluate │
│ 43 │ │ │ args, kwargs = value.info │
│ > 44 │ │ │ value = evaluate(*args, **kwargs) │
│ 45 │ │ │ if self.cache: │
│ 46 │ │ │ │ self._raw_dict[key] = value │
│ 47 │ │ return value │
│ │
│ D:\ProgramData\Anaconda3\Lib\site-packages\huggingface_hub\utils\_validator │
│ s.py:118 in _inner_fn │
│ │
│ 115 │ │ if check_use_auth_token: │
│ 116 │ │ │ kwargs = smoothly_deprecate_use_auth_token(fn_name=fn.__n │
│ 117 │ │ │
│ > 118 │ │ return fn(*args, **kwargs) │
│ 119 │ │
│ 120 │ return _inner_fn # type: ignore │
│ 121 │
│ │
│ D:\ProgramData\Anaconda3\Lib\site-packages\huggingface_hub\file_download.py │
│ :1291 in hf_hub_download │
│ │
│ 1288 │ │ │ │ " and downloads online, set 'local_files_only' to Fa │
│ 1289 │ │ │ ) │
│ 1290 │ │ else: │
│ > 1291 │ │ │ raise LocalEntryNotFoundError( │
│ 1292 │ │ │ │ "Connection error, and we cannot find the requested │
│ 1293 │ │ │ │ " the disk cache. Please try again or make sure your │
│ 1294 │ │ │ │ " connection is on." │
└────────────────────────────────────────────── ─────────────────────────────┘
LocalEntryNotFoundError: Connection error, and we cannot find the requested
files in the disk cache. Please try again or make sure your Internet connection
is on.

Solution idea

This error indicates that your code attempted to download the model files from “huggingface.co” but a connection timeout occurred, preventing the required files from being downloaded.

Solution

This error indicates that your code attempted to download the model files from “huggingface.co” but a connection timeout occurred, preventing the required files from being downloaded. Specifically, the error message mentions “Connection to huggingface.co timed out”, which means that the connection to “huggingface.co” timed out.

>> Make sure your network connection is normal and you can access “huggingface.co”. Sometimes, network connection issues can cause downloads to fail.

>> Check your download speed, if your internet speed is slow, it may take more time to complete the download. You can wait for a while and try again.

>> If you use a proxy server, please make sure that the proxy server settings are correct and will not cause connection problems.

>> Make sure the relevant libraries and dependencies in your Python environment are up to date. You can try updating related libraries such as “huggingface/transformers” to make sure they don’t have known issues.

>> If you use a VPN, make sure it is working properly and does not affect your connection to “huggingface.co”.

The knowledge points of the article match the official knowledge files, and you can further learn relevant knowledge. Python entry skill treeHomepageOverview 382212 people are learning the system