Skip to content

Add daemon mode (-d) to keep model loaded for multiple batch processing#10

Open
ollm wants to merge 3 commits intoupscayl:masterfrom
ollm:daemon-mode
Open

Add daemon mode (-d) to keep model loaded for multiple batch processing#10
ollm wants to merge 3 commits intoupscayl:masterfrom
ollm:daemon-mode

Conversation

@ollm
Copy link
Copy Markdown

@ollm ollm commented Jan 12, 2026

I have added a daemon mode that allows the model to remain loaded in memory so images can be processed faster.

To make these changes, I had to rely on Copilot, since my knowledge of C++ is limited. I reviewed the parts of the code generated by and I fixed all issues. I also tested it on both Linux and Windows, and it works correctly (both the new daemon mode and the normal mode). I haven't been able to test it on macOS because I don't have a Mac.

With daemon mode, the model can be loaded at startup so that when the user interacts (for example, in Upscayl), the image is processed much faster. At least on my graphics card (AMD RX 6700, on both Linux and Windows), the model loading time is considerably high (several seconds), and with this mode that cost can be avoided for each image. For some models, the loading time is even slower than the actual image processing time.

You can also see my implementation of process spawning in Node in this other repository:
https://github.com/ollm/opencomic-ai-bin
https://github.com/ollm/opencomic-ai-bin/blob/b348e3754245cb633d02937d35a7270e53670c3a/index.mts#L1221

Example usage

./upscayl-bin -d -m /path/to/models -n realesrgan-x4plus -z 4
🚀 Starting Upscayl - Copyright © 2024
✨ Detected scale x4
✨ Using the default scale x4
[0 AMD Radeon Graphics (RADV NAVI22)]  queueC=1[4]  queueG=0[1]  queueT=0[1]
[0 AMD Radeon Graphics (RADV NAVI22)]  bugsbn1=0  bugbilz=0  bugcopc=0  bugihfa=0
[0 AMD Radeon Graphics (RADV NAVI22)]  fp16-p/s/a=1/1/1  int8-p/s/a=1/1/1
[0 AMD Radeon Graphics (RADV NAVI22)]  subgroup=64  basic=1  vote=1  ballot=1  shuffle=1
[1 llvmpipe (LLVM 20.1.2, 256 bits)]  queueC=0[1]  queueG=0[1]  queueT=0[1]
[1 llvmpipe (LLVM 20.1.2, 256 bits)]  bugsbn1=0  bugbilz=0  bugcopc=0  bugihfa=0
[1 llvmpipe (LLVM 20.1.2, 256 bits)]  fp16-p/s/a=1/1/1  int8-p/s/a=1/1/1
[1 llvmpipe (LLVM 20.1.2, 256 bits)]  subgroup=8  basic=1  vote=1  ballot=1  shuffle=1

📡 Daemon Mode Started
🔧 Loading model...
✅ Model loaded successfully!
Model: realesrgan-x4plus (scale: 4x)
Type 'help' for usage or 'quit' to exit

📡 Ready> -i input.jpg -o output.jpg -s 4

Daemon comparative performance

Table (10 images 512x512px)

Model Disabled Enabled Disabled vs Enabled
OpenComic AI Upscale Lite 52.087s 7.646s 6.81x
RealESRGAN x4 Plus 73.273s 23.199s 3.16x

OpenComic AI Upscale Lite

Disabled

Processing image 1/10 for model: OpenComic AI Upscale Lite: 2.931s
Processing image 2/10 for model: OpenComic AI Upscale Lite: 4.464s
Processing image 3/10 for model: OpenComic AI Upscale Lite: 5.594s
Processing image 4/10 for model: OpenComic AI Upscale Lite: 5.561s
Processing image 5/10 for model: OpenComic AI Upscale Lite: 5.521s
Processing image 6/10 for model: OpenComic AI Upscale Lite: 5.531s
Processing image 7/10 for model: OpenComic AI Upscale Lite: 5.534s
Processing image 8/10 for model: OpenComic AI Upscale Lite: 5.555s
Processing image 9/10 for model: OpenComic AI Upscale Lite: 5.496s
Processing image 10/10 for model: OpenComic AI Upscale Lite: 5.898s
Model: OpenComic AI Upscale Lite, Latency: 52.087s

Enabled

Preloading model... OpenComic AI Upscale Lite
Preload model: OpenComic AI Upscale Lite: 473.897ms
Processing image 1/10 for model: OpenComic AI Upscale Lite: 725.474ms
Processing image 2/10 for model: OpenComic AI Upscale Lite: 716.566ms
Processing image 3/10 for model: OpenComic AI Upscale Lite: 716.221ms
Processing image 4/10 for model: OpenComic AI Upscale Lite: 715.214ms
Processing image 5/10 for model: OpenComic AI Upscale Lite: 717.894ms
Processing image 6/10 for model: OpenComic AI Upscale Lite: 715.236ms
Processing image 7/10 for model: OpenComic AI Upscale Lite: 716.296ms
Processing image 8/10 for model: OpenComic AI Upscale Lite: 714.025ms
Processing image 9/10 for model: OpenComic AI Upscale Lite: 718.653ms
Processing image 10/10 for model: OpenComic AI Upscale Lite: 714.792ms
Model: OpenComic AI Upscale Lite, Latency: 7.646s

RealESRGAN x4 Plus

Disabled

Processing image 1/10 for model: RealESRGAN x4 Plus: 6.473s
Processing image 2/10 for model: RealESRGAN x4 Plus: 7.809s
Processing image 3/10 for model: RealESRGAN x4 Plus: 7.690s
Processing image 4/10 for model: RealESRGAN x4 Plus: 7.470s
Processing image 5/10 for model: RealESRGAN x4 Plus: 6.620s
Processing image 6/10 for model: RealESRGAN x4 Plus: 7.390s
Processing image 7/10 for model: RealESRGAN x4 Plus: 7.423s
Processing image 8/10 for model: RealESRGAN x4 Plus: 7.541s
Processing image 9/10 for model: RealESRGAN x4 Plus: 7.536s
Processing image 10/10 for model: RealESRGAN x4 Plus: 7.321s
Model: RealESRGAN x4 Plus, Latency: 73.273s

Enabled

Preloading model... RealESRGAN x4 Plus
Preload model: RealESRGAN x4 Plus: 1.165s
Processing image 1/10 for model: RealESRGAN x4 Plus: 2.217s
Processing image 2/10 for model: RealESRGAN x4 Plus: 2.196s
Processing image 3/10 for model: RealESRGAN x4 Plus: 2.203s
Processing image 4/10 for model: RealESRGAN x4 Plus: 2.191s
Processing image 5/10 for model: RealESRGAN x4 Plus: 2.200s
Processing image 6/10 for model: RealESRGAN x4 Plus: 2.203s
Processing image 7/10 for model: RealESRGAN x4 Plus: 2.216s
Processing image 8/10 for model: RealESRGAN x4 Plus: 2.222s
Processing image 9/10 for model: RealESRGAN x4 Plus: 2.188s
Processing image 10/10 for model: RealESRGAN x4 Plus: 2.194s
Model: RealESRGAN x4 Plus, Latency: 23.199s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant