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.

目录

解决问题

解决思路

解决方法

解决问题

'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(, '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

│ │

│ 22 │ │ # print("\n") │

│ 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.

解决思路

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

解决方法

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

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

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

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

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

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

推荐文章

评论可见,请评论后查看内容,谢谢!!!
 您阅读本篇文章共花了: