breezedeus / CnOCR

CnOCR: Awesome Chinese/English OCR Python toolkits based on PyTorch. It comes with 20+ well-trained models for different application scenarios and can be used directly after installation. 【基于 PyTorch/MXNet 的中文/英文 OCR Python 包。】
https://www.breezedeus.com/article/cnocr
Apache License 2.0
3.28k stars 507 forks source link

docker镜像服务启动失败 #333

Closed znzn007007 closed 4 months ago

znzn007007 commented 4 months ago

环境:win11 镜像版本 :latest 问题表现:

  1. 直接启动container接口无法使用
  2. 进入容器后按照文档重启服务
  3. 输出nohup.out
[WARNING 2024-07-17 10:26:48,084 _assert_and_prepare_model_files:177] no onnx file is found in /root/.cnocr/2.3/densenet_lite_136-gru
[INFO 2024-07-17 10:26:48,084 download:175] Downloading /root/.cnocr/2.3/densenet_lite_136-gru-onnx.zip from https://sg-models.oss-cn-beijing.aliyuncs.com/cnocr/2.3/densenet_lite_136-gru-onnx.zip...
[DEBUG 2024-07-17 10:26:48,086 _new_conn:1055] Starting new HTTPS connection (1): sg-models.oss-cn-beijing.aliyuncs.com:443
[DEBUG 2024-07-17 10:26:48,372 _make_request:549] https://sg-models.oss-cn-beijing.aliyuncs.com:443 "GET /cnocr/2.3/densenet_lite_136-gru-onnx.zip HTTP/1.1" 404 394
[ERROR 2024-07-17 10:26:48,373 get_model_file:251] Failed downloading url https://sg-models.oss-cn-beijing.aliyuncs.com/cnocr/2.3/densenet_lite_136-gru-onnx.zip
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/cnstd/utils/utils.py", line 249, in get_model_file
    download(url, path=zip_file_path, download_source=download_source, overwrite=True)
  File "/usr/local/lib/python3.9/site-packages/cnstd/utils/utils.py", line 178, in download
    raise RuntimeError("Failed downloading url %s" % oss_url)
RuntimeError: Failed downloading url https://sg-models.oss-cn-beijing.aliyuncs.com/cnocr/2.3/densenet_lite_136-gru-onnx.zip

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/uvicorn", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/uvicorn/main.py", line 418, in main
    run(
  File "/usr/local/lib/python3.9/site-packages/uvicorn/main.py", line 587, in run
    server.run()
  File "/usr/local/lib/python3.9/site-packages/uvicorn/server.py", line 62, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "/usr/local/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
  File "/usr/local/lib/python3.9/site-packages/uvicorn/server.py", line 69, in serve
    config.load()
  File "/usr/local/lib/python3.9/site-packages/uvicorn/config.py", line 458, in load
    self.loaded_app = import_from_string(self.app)
  File "/usr/local/lib/python3.9/site-packages/uvicorn/importer.py", line 21, in import_from_string
    module = importlib.import_module(module_str)
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/usr/local/lib/python3.9/site-packages/cnocr/serve.py", line 33, in <module>
    OCR_MODEL = CnOcr()
  File "/usr/local/lib/python3.9/site-packages/cnocr/cn_ocr.py", line 155, in __init__
    self.rec_model = rec_cls(
  File "/usr/local/lib/python3.9/site-packages/cnocr/recognizer.py", line 119, in __init__
    self._assert_and_prepare_model_files(model_fp, root)
  File "/usr/local/lib/python3.9/site-packages/cnocr/recognizer.py", line 184, in _assert_and_prepare_model_files
    get_model_file(
  File "/usr/local/lib/python3.9/site-packages/cnstd/utils/utils.py", line 256, in get_model_file
    raise ModelDownloadingError(message)
cnstd.utils.utils.ModelDownloadingError: Failed to download model: densenet_lite_136-gru-onnx.zip.
        Please open your VPN and try again.
        If this error persists, please follow the instruction at [CnSTD/CnOCR Doc](https://www.breezedeus.com/cnocr) to manually download the model files.
[WARNING 2024-07-17 10:27:17,529 _assert_and_prepare_model_files:177] no onnx file is found in /root/.cnocr/2.3/densenet_lite_136-gru
[INFO 2024-07-17 10:27:17,529 download:175] Downloading /root/.cnocr/2.3/densenet_lite_136-gru-onnx.zip from https://sg-models.oss-cn-beijing.aliyuncs.com/cnocr/2.3/densenet_lite_136-gru-onnx.zip...
[DEBUG 2024-07-17 10:27:17,530 _new_conn:1055] Starting new HTTPS connection (1): sg-models.oss-cn-beijing.aliyuncs.com:443
[DEBUG 2024-07-17 10:27:17,844 _make_request:549] https://sg-models.oss-cn-beijing.aliyuncs.com:443 "GET /cnocr/2.3/densenet_lite_136-gru-onnx.zip HTTP/1.1" 404 394
[ERROR 2024-07-17 10:27:17,844 get_model_file:251] Failed downloading url https://sg-models.oss-cn-beijing.aliyuncs.com/cnocr/2.3/densenet_lite_136-gru-onnx.zip
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/cnstd/utils/utils.py", line 249, in get_model_file
    download(url, path=zip_file_path, download_source=download_source, overwrite=True)
  File "/usr/local/lib/python3.9/site-packages/cnstd/utils/utils.py", line 178, in download
    raise RuntimeError("Failed downloading url %s" % oss_url)
RuntimeError: Failed downloading url https://sg-models.oss-cn-beijing.aliyuncs.com/cnocr/2.3/densenet_lite_136-gru-onnx.zip

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/uvicorn", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/uvicorn/main.py", line 418, in main
    run(
  File "/usr/local/lib/python3.9/site-packages/uvicorn/main.py", line 587, in run
    server.run()
  File "/usr/local/lib/python3.9/site-packages/uvicorn/server.py", line 62, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "/usr/local/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
  File "/usr/local/lib/python3.9/site-packages/uvicorn/server.py", line 69, in serve
    config.load()
  File "/usr/local/lib/python3.9/site-packages/uvicorn/config.py", line 458, in load
    self.loaded_app = import_from_string(self.app)
  File "/usr/local/lib/python3.9/site-packages/uvicorn/importer.py", line 21, in import_from_string
    module = importlib.import_module(module_str)
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/usr/local/lib/python3.9/site-packages/cnocr/serve.py", line 33, in <module>
    OCR_MODEL = CnOcr()
  File "/usr/local/lib/python3.9/site-packages/cnocr/cn_ocr.py", line 155, in __init__
    self.rec_model = rec_cls(
  File "/usr/local/lib/python3.9/site-packages/cnocr/recognizer.py", line 119, in __init__
    self._assert_and_prepare_model_files(model_fp, root)
  File "/usr/local/lib/python3.9/site-packages/cnocr/recognizer.py", line 184, in _assert_and_prepare_model_files
    get_model_file(
  File "/usr/local/lib/python3.9/site-packages/cnstd/utils/utils.py", line 256, in get_model_file
    raise ModelDownloadingError(message)
cnstd.utils.utils.ModelDownloadingError: Failed to download model: densenet_lite_136-gru-onnx.zip.
        Please open your VPN and try again.
        If this error persists, please follow the instruction at [CnSTD/CnOCR Doc](https://www.breezedeus.com/cnocr) to manually download the model files.
znzn007007 commented 4 months ago

我看了一下需要是需要开启VPN么

breezedeus commented 4 months ago

容器里更新下 cnocr 的版本。这个容器近期没更新