当前位置:   article > 正文

成功解决HTTPSConnectionPool(host=‘huggingface.co‘, port=443): Max retries exceeded with url:LocalEntryNo_localentrynotfounderror

localentrynotfounderror

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.

目录

解决问题

解决思路

解决方法


解决问题

  1. '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
  2. ┌───────────────────── Traceback (most recent call last) ─────────────────────┐
  3. │ E:\File_Python\Python_daydayup\20230516.py:25 in <module>
  4. │ │
  5. 22 │ │ # print("\n") │
  6. 23
  7. 24 from unstructured.partition.pdf import partition_pdf │
  8. > 25 elements = partition_pdf(filename=filename, infer_table_structure=True
  9. 26 tables = [el for el in elements if el.category == "Table"] │
  10. 27 print(tables[0].text) │
  11. 28 print(tables[0].metadata.text_as_html) │
  12. │ │
  13. │ D:\ProgramData\Anaconda3\Lib\site-packages\unstructured\documents\elements. │
  14. │ py:306 in wrapper │
  15. │ │
  16. 303 │ │ │
  17. 304 │ │ @functools.wraps(func) │
  18. 305 │ │ def wrapper(*args: _P.args, **kwargs: _P.kwargs) -> List[Elem │
  19. > 306 │ │ │ elements = func(*args, **kwargs) │
  20. 307 │ │ │ sig = inspect.signature(func) │
  21. 308 │ │ │ params: Dict[str, Any] = dict(**dict(zip(sig.parameters, │
  22. 309 │ │ │ for param in sig.parameters.values(): │
  23. │ │
  24. │ D:\ProgramData\Anaconda3\Lib\site-packages\unstructured\file_utils\filetype │
  25. │ .py:551 in wrapper │
  26. │ │
  27. 548 │ def decorator(func: Callable[_P, List[Element]]) -> Callable[_P, │
  28. 549 │ │ @functools.wraps(func) │
  29. 550 │ │ def wrapper(*args: _P.args, **kwargs: _P.kwargs) -> List[Elem │
  30. > 551 │ │ │ elements = func(*args, **kwargs) │
  31. 552 │ │ │ sig = inspect.signature(func) │
  32. 553 │ │ │ params: Dict[str, Any] = dict(**dict(zip(sig.parameters, │
  33. 554 │ │ │ for param in sig.parameters.values(): │
  34. │ │
  35. │ D:\ProgramData\Anaconda3\Lib\site-packages\unstructured\chunking\title.py:2
  36. 77 in wrapper │
  37. │ │
  38. 274 │ │ │
  39. 275 │ │ @functools.wraps(func) │
  40. 276 │ │ def wrapper(*args: _P.args, **kwargs: _P.kwargs) -> List[Elem │
  41. > 277 │ │ │ elements = func(*args, **kwargs) │
  42. 278 │ │ │ sig = inspect.signature(func) │
  43. 279 │ │ │ params: Dict[str, Any] = dict(**dict(zip(sig.parameters, │
  44. 280 │ │ │ for param in sig.parameters.values(): │
  45. │ │
  46. │ D:\ProgramData\Anaconda3\Lib\site-packages\unstructured\partition\pdf.py:15
  47. 7 in partition_pdf │
  48. │ │
  49. 154 │ │ │ │ "Please use languages instead.", │
  50. 155 │ │ │ ) │
  51. 156 │ │
  52. > 157return partition_pdf_or_image( │
  53. 158 │ │ filename=filename, │
  54. 159 │ │ file=file, │
  55. 160 │ │ include_page_breaks=include_page_breaks, │
  56. │ │
  57. │ D:\ProgramData\Anaconda3\Lib\site-packages\unstructured\partition\pdf.py:28
  58. 7 in partition_pdf_or_image │
  59. │ │
  60. 284 │ │ # NOTE(robinson): Catches a UserWarning that occurs when det │
  61. 285 │ │ with warnings.catch_warnings(): │
  62. 286 │ │ │ warnings.simplefilter("ignore") │
  63. > 287 │ │ │ _layout_elements = _partition_pdf_or_image_local( │
  64. 288 │ │ │ │ filename=filename, │
  65. 289 │ │ │ │ file=spooled_to_bytes_io_if_needed(file), │
  66. 290 │ │ │ │ is_image=is_image, │
  67. │ │
  68. │ D:\ProgramData\Anaconda3\Lib\site-packages\unstructured\utils.py:178 in
  69. │ wrapper │
  70. │ │
  71. 175 │ │ │ │ │ │ else f"Please install them using `pip install │
  72. │ 176 │ │ │ │ │ ), │
  73. │ 177 │ │ │ │ ) │
  74. │ > 178 │ │ │ return func(*args, **kwargs) │
  75. │ 179 │ │ │
  76. │ 180 │ │ return wrapper │
  77. │ 181 │
  78. │ │
  79. │ D:\ProgramData\Anaconda3\Lib\site-packages\unstructured\partition\pdf.py:37 │
  80. │ 7 in _partition_pdf_or_image_local │
  81. │ │
  82. │ 374 │ │
  83. │ 375 │ if file is None: │
  84. │ 376 │ │ # NOTE(christine): out_layout = extracted_layout + inferred_ │
  85. │ > 377 │ │ out_layout = process_file_with_model( │
  86. │ 378 │ │ │ filename, │
  87. │ 379 │ │ │ is_image=is_image, │
  88. │ 380 │ │ │ extract_tables=infer_table_structure, │
  89. │ │
  90. │ D:\ProgramData\Anaconda3\Lib\site-packages\unstructured_inference\inference │
  91. │ \layout.py:481 in process_file_with_model │
  92. │ │
  93. │ 478 │ """Processes pdf file with name filename into a DocumentLayout by
  94. 479 │ model_name.""" │
  95. │ 480 │ │
  96. │ > 481 │ model = get_model(model_name, **kwargs) │
  97. │ 482 │ if isinstance(model, UnstructuredObjectDetectionModel): │
  98. │ 483 │ │ detection_model = model │
  99. │ 484 │ │ element_extraction_model = None │
  100. │ │
  101. │ D:\ProgramData\Anaconda3\Lib\site-packages\unstructured_inference\models\ba │
  102. │ se.py:55 in get_model │
  103. │ │
  104. │ 52 │ │ initialize_params = {**DETECTRON2_ONNX_MODEL_TYPES[model_name] │
  105. │ 53 │ elif model_name in YOLOX_MODEL_TYPES: │
  106. │ 54 │ │ model = UnstructuredYoloXModel() │
  107. │ > 55 │ │ initialize_params = {**YOLOX_MODEL_TYPES[model_name], **kwargs │
  108. │ 56 │ elif model_name in CHIPPER_MODEL_TYPES: │
  109. │ 57 │ │ logger.warning( │
  110. │ 58 │ │ │ "The Chipper model is currently in Beta and is not yet rea │
  111. │ │
  112. │ D:\ProgramData\Anaconda3\Lib\site-packages\unstructured_inference\utils.py: │
  113. 44 in __getitem__ │
  114. │ │
  115. 41 │ │ if isinstance(value, LazyEvaluateInfo): │
  116. 42 │ │ │ evaluate = value.evaluate
  117. 43 │ │ │ args, kwargs = value.info │
  118. > 44 │ │ │ value = evaluate(*args, **kwargs) │
  119. 45 │ │ │ if self.cache: │
  120. 46 │ │ │ │ self._raw_dict[key] = value
  121. 47 │ │ return value
  122. │ │
  123. │ D:\ProgramData\Anaconda3\Lib\site-packages\huggingface_hub\utils\_validator │
  124. │ s.py:118 in _inner_fn │
  125. │ │
  126. 115 │ │ if check_use_auth_token: │
  127. 116 │ │ │ kwargs = smoothly_deprecate_use_auth_token(fn_name=fn.__n │
  128. 117 │ │ │
  129. > 118 │ │ return fn(*args, **kwargs) │
  130. 119 │ │
  131. 120return _inner_fn # type: ignore │
  132. 121
  133. │ │
  134. │ D:\ProgramData\Anaconda3\Lib\site-packages\huggingface_hub\file_download.py │
  135. │ :1291 in hf_hub_download │
  136. │ │
  137. 1288 │ │ │ │ " and downloads online, set 'local_files_only' to Fa │
  138. │ 1289 │ │ │ ) │
  139. │ 1290 │ │ else: │
  140. │ > 1291 │ │ │ raise LocalEntryNotFoundError( │
  141. │ 1292 │ │ │ │ "Connection error, and we cannot find the requested │
  142. 1293 │ │ │ │ " the disk cache. Please try again or make sure your │
  143. │ 1294 │ │ │ │ " connection is on." │
  144. └─────────────────────────────────────────────────────────────────────────────┘
  145. LocalEntryNotFoundError: Connection error, and we cannot find the requested
  146. files in the disk cache. Please try again or make sure your Internet connection
  147. is on.

解决思路

这个错误表明您的代码尝试从"huggingface.co"下载模型文件,但出现了连接超时的问题,导致无法下载所需的文件。

解决方法

这个错误表明您的代码尝试从"huggingface.co"下载模型文件,但出现了连接超时的问题,导致无法下载所需的文件。具体来说,错误消息中提到了"Connection to huggingface.co timed out",意味着连接到"huggingface.co"的操作超时了。

>> 确保您的网络连接正常,可以访问"huggingface.co"。有时候,网络连接问题可能导致下载失败。

>> 检查您的下载速度,如果您的网络速度很慢,可能需要更多时间来完成下载。您可以等待一段时间再尝试。

>> 如果您使用代理服务器,请确保代理服务器设置正确,不会导致连接问题。

>> 确保您的Python环境中的相关库和依赖项是最新版本。您可以尝试更新相关库,例如"huggingface/transformers",以确保它们没有已知的问题。

>> 如果您使用了VPN,请确保它正常运行,并且不会影响到连接"huggingface.co"。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小丑西瓜9/article/detail/478699
推荐阅读
相关标签
  

闽ICP备14008679号