Spaces:
Running
Running
MinerU RunPod Serverless Deployment
Overview
This deployment includes MinerU models directly in the Docker image for fast cold starts on RunPod Serverless.
Build and Deploy
1. Build Docker Image
./build_runpod.sh
This will:
- Build the Docker image with all MinerU models included
- Download models during build (this takes ~10-15 minutes)
- Result in a Docker image of approximately 5-10GB
2. Push to Docker Hub
docker login
docker push marcosremar2/mineru-runpod:latest
3. Deploy on RunPod
- Go to RunPod Serverless
- Click "New Template"
- Configure:
- Container Image:
marcosremar2/mineru-runpod:latest
- Container Disk: 20 GB (to be safe)
- Volume Size: 0 GB (not needed, models in image)
- GPU: Any GPU with 8GB+ VRAM
- Max Workers: Based on your needs
- Idle Timeout: 5 seconds
- Execution Timeout: 120 seconds
- Container Image:
4. Test the Deployment
python test_runpod.py test.pdf https://api.runpod.ai/v2/YOUR_ENDPOINT_ID YOUR_API_KEY
API Usage
Request Format
{
"input": {
"pdf_base64": "base64_encoded_pdf_content",
"filename": "document.pdf"
}
}
Response Format
{
"output": {
"markdown": "# Converted Document\n\nContent here...",
"filename": "document.pdf",
"status": "success",
"pages": 5
}
}
Cost Estimation
- Cold Start: ~5-10 seconds (models already in image)
- Processing: ~10-30 seconds per PDF
- GPU Cost: ~$0.00024/second
- Total per PDF: ~$0.01-0.02
Optimization Tips
- Reduce Image Size: Remove unnecessary models from Dockerfile
- Use Active Workers: For consistent load, keep 1-2 active workers
- Adjust Timeout: Increase for larger PDFs
- Monitor Usage: Use RunPod dashboard to track costs
Troubleshooting
- Out of Memory: Use larger GPU (16GB+ VRAM)
- Timeout: Increase execution timeout in template
- Model Loading: Check MINERU_MODEL_PATH environment variable