MinerU uses huggingface as the default model source. If users cannot access huggingface due to network restrictions, they can conveniently switch the model source to modelscope through environment variables:
export MINERU_MODEL_SOURCE=modelscope
For more information about model source configuration and custom local model paths, please refer to the Model Source Documentation in the documentation.
MinerU has built-in command line tools that allow users to quickly use MinerU for PDF parsing through the command line:
# Default parsing using pipeline backend
mineru -p <input_path> -o <output_path>
[!TIP]
<input_path>: Local PDF/image file or directory<output_path>: Output directoryFor more information about output files, please refer to Output File Documentation.
[!NOTE] The command line tool will automatically attempt cuda/mps acceleration on Linux and macOS systems. Windows users who need cuda acceleration should visit the PyTorch official website to select the appropriate command for their cuda version to install acceleration-enabled
torchandtorchvision.
# Or specify vlm backend for parsing
mineru -p <input_path> -o <output_path> -b vlm-transformers
[!TIP] The vlm backend additionally supports
vllmacceleration. Compared to thetransformersbackend,vllmcan achieve 20-30x speedup. You can check the installation method for the complete package supportingvllmacceleration in the Extension Modules Installation Guide.
If you need to adjust parsing options through custom parameters, you can also check the more detailed Command Line Tools Usage Instructions in the documentation.
FastAPI calls:
mineru-api --host 0.0.0.0 --port 8000
[!TIP] Access
http://127.0.0.1:8000/docsin your browser to view the API documentation.
Start Gradio WebUI visual frontend:
# Using pipeline/vlm-transformers/vlm-http-client backends
mineru-gradio --server-name 0.0.0.0 --server-port 7860
# Or using vlm-vllm-engine/pipeline backends (requires vllm environment)
mineru-gradio --server-name 0.0.0.0 --server-port 7860 --enable-vllm-engine true
[!TIP]
- Access
http://127.0.0.1:7860in your browser to use the Gradio WebUI.
Using http-client/server method:
# Start vllm server (requires vllm environment)
mineru-vllm-server --port 30000
[!TIP] In another terminal, connect to vllm server via http client (only requires CPU and network, no vllm environment needed)
mineru -p <input_path> -o <output_path> -b vlm-http-client -u http://127.0.0.1:30000
[!NOTE] All officially supported vllm parameters can be passed to MinerU through command line arguments, including the following commands:
mineru,mineru-vllm-server,mineru-gradio,mineru-api. We have compiled some commonly used parameters and usage methods forvllm, which can be found in the documentation Advanced Command Line Parameters.
MinerU is now ready to use out of the box, but also supports extending functionality through configuration files. You can edit mineru.json file in your user directory to add custom configurations.
[!IMPORTANT] The
mineru.jsonfile will be automatically generated when you use the built-in model download commandmineru-models-download, or you can create it by copying the configuration template file to your user directory and renaming it tomineru.json.
Here are some available configuration options:
latex-delimiter-config:
$ symbol, can be modified to other symbols or strings as needed.
llm-aided-config:
openai protocol, defaults to using Alibaba Cloud Bailian's qwen3-next-80b-a3b-instruct model.enable to true to enable this feature.enable_thinking parameter, please manually remove it.
models-dir:
pipeline and vlm backends separately.export MINERU_MODEL_SOURCE=local.