install monkeyOcr - zhongguogu/Linux GitHub Wiki
o create a public link, set share=True
in launch()
.
Traceback (most recent call last):
File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/pdf2image/pdf2image.py", line 581, in pdfinfo_from_path
proc = Popen(command, env=env, stdout=PIPE, stderr=PIPE)
File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/subprocess.py", line 971, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/subprocess.py", line 1863, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'pdfinfo'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/gradio/queueing.py", line 625, in process_events response = await route_utils.call_process_api( File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/gradio/route_utils.py", line 322, in call_process_api output = await app.get_blocks().process_api( File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/gradio/blocks.py", line 2137, in process_api result = await self.call_function( File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/gradio/blocks.py", line 1663, in call_function prediction = await anyio.to_thread.run_sync( # type: ignore File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync return await get_async_backend().run_sync_in_worker_thread( File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2470, in run_sync_in_worker_thread return await future File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 967, in run result = context.run(func, *args) File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/gradio/utils.py", line 890, in wrapper response = f(*args, **kwargs) File "/home/ubuntu/project/monkeyOcr/MonkeyOCR-main/demo/demo_gradio.py", line 256, in load_file pages = convert_from_path(file, dpi=150) File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/pdf2image/pdf2image.py", line 127, in convert_from_path page_count = pdfinfo_from_path( File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/pdf2image/pdf2image.py", line 607, in pdfinfo_from_path raise PDFInfoNotInstalledError( pdf2image.exceptions.PDFInfoNotInstalledError: Unable to get page count. Is poppler installed and in PATH?
你遇到的错误是因为缺少 poppler 库,这是一个处理 PDF 文件的工具集,pdf2image 库依赖它来将 PDF 转换为图像。错误信息显示系统找不到 pdfinfo 命令,这是 poppler 库的一部分。 **## **
To create a public link, set
share=Truein
launch(). 2025-06-10 15:47:52.054 | INFO | magic_pdf.model.doc_analyze_by_custom_model_llm:doc_analyze_llm:52 - gpu_memory: 32 GB, batch_ratio: 32 2025-06-10 15:47:55.938 | INFO | magic_pdf.model.batch_analyze_llm:__call__:56 - layout time: 3.87, image num: 1 2025-06-10 15:47:55.939 | INFO | magic_pdf.model.batch_analyze_llm:__call__:80 - VLM OCR start... 2025-06-10 15:47:55,958 - lmdeploy - WARNING - messages.py:92 -
temperatureis 0, set top_k=1. 2025-06-10 15:47:56,252 - lmdeploy - ERROR - model_agent.py:498 - Task <ModelAgentLoop> failed Traceback (most recent call last): File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/lmdeploy/pytorch/engine/model_agent.py", line 493, in _on_finish_callback task.result() File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/lmdeploy/pytorch/engine/model_agent.py", line 484, in _async_loop_background await self._async_step_background(**forward_inputs, ) File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/lmdeploy/pytorch/engine/model_agent.py", line 421, in _async_step_background output = await self._async_model_forward( File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/lmdeploy/pytorch/engine/model_agent.py", line 289, in _async_model_forward ret = await __forward(inputs) File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/lmdeploy/pytorch/engine/model_agent.py", line 249, in __forward return await self.async_forward(inputs, swap_in_map=swap_in_map, swap_out_map=swap_out_map) File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/lmdeploy/pytorch/engine/model_agent.py", line 660, in async_forward output = self._forward_impl(inputs, swap_in_map=swap_in_map, swap_out_map=swap_out_map) File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/lmdeploy/pytorch/engine/model_agent.py", line 644, in _forward_impl output = model_forward( File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context return func(*args, **kwargs) File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/lmdeploy/pytorch/engine/model_agent.py", line 73, in model_forward output = model(**input_dict) File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/lmdeploy/pytorch/backends/cuda/graph_runner.py", line 161, in __call__ return self.model(**kwargs) File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1736, in _wrapped_call_impl return self._call_impl(*args, **kwargs) File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1747, in _call_impl return forward_call(*args, **kwargs) File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/lmdeploy/pytorch/models/qwen2_5_vl.py", line 439, in forward hidden_states = self.model( File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1736, in _wrapped_call_impl return self._call_impl(*args, **kwargs) File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1747, in _call_impl return forward_call(*args, **kwargs) File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/lmdeploy/pytorch/models/qwen2_vl.py", line 295, in forward hidden_states, residual = decoder_layer( File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1736, in _wrapped_call_impl return self._call_impl(*args, **kwargs) File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1747, in _call_impl return forward_call(*args, **kwargs) File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/lmdeploy/pytorch/models/qwen2_vl.py", line 214, in forward hidden_states = self.self_attn( File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1736, in _wrapped_call_impl return self._call_impl(*args, **kwargs) File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1747, in _call_impl return forward_call(*args, **kwargs) File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/lmdeploy/pytorch/models/qwen2_vl.py", line 112, in forward attn_output = self.attn_fwd( File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1736, in _wrapped_call_impl return self._call_impl(*args, **kwargs) File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1747, in _call_impl return forward_call(*args, **kwargs) File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/lmdeploy/pytorch/nn/attention.py", line 78, in forward return self.impl.forward( File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/lmdeploy/pytorch/backends/cuda/attention.py", line 166, in forward self.flash_attention_fwd( File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/lmdeploy/pytorch/kernels/cuda/flashattention.py", line 449, in flash_attention_fwd _flash_prefill_fwd_kernel[grid]( File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/triton/runtime/jit.py", line 345, in <lambda> return lambda *args, **kwargs: self.run(grid=grid, warmup=False, *args, **kwargs) File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/triton/runtime/jit.py", line 691, in run kernel.run(grid_0, grid_1, grid_2, stream, kernel.function, kernel.packed_metadata, launch_metadata, File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/triton/compiler/compiler.py", line 381, in __getattribute__ self._init_handles() File "/home/ubuntu/anaconda3/envs/MonkeyOCR/lib/python3.10/site-packages/triton/compiler/compiler.py", line 374, in _init_handles raise OutOfResources(self.metadata.shared, max_shared, "shared memory") triton.runtime.errors.OutOfResources: out of resource: shared memory, Required: 100352, Hardware limit: 98304. Reducing block sizes or
num_stagesmay help.
pip3 install flash-attn==2.7.4.post1 --no-build-isolation -i https://pypi.tuna.tsinghua.edu.cn/simple -v (通过加-v可以展示为什么卡住)
DEPRECATION: Building 'flash-attn' using the legacy setup.py bdist_wheel mechanism, which will be removed in a future version. pip 25.3 will enforce this behaviour change. A possible replacement is to use the standardized build interface by setting the
--use-pep517option, (possibly combined with
--no-build-isolation), or adding a
pyproject.toml` file to the source tree of 'flash-attn'. Discussion can be found at https://github.com/pypa/pip/issues/6334
Running command python setup.py bdist_wheel
通过-v
self._finalize_license_expression()
running bdist_wheel
Guessing wheel URL: https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiFALSE-cp310-cp310-linux_x86_64.whl
` 原因是由于 这一台linux服务器,下载github失败,可以提前下载好, 若官网提供预编译的 .whl 文件,直接下载安装可跳过编译步骤,例如: bash pip3 install https://download.pytorch.org/whl/cu121/flash_attn-2.7.4.post1-cp310-cp310-linux_x86_64.whl