I wired an image-generation helper to lemonade-server’s /api/v1/images/upscale endpoint. A 256² test image upscaled x4 in six seconds. The first real image, 512², came back as HTTP 500 {"error":{"message":"Upscale failed","type":"server_error"}} after nine seconds, twice in a row. Nothing in the response said why.
TL;DR — On an AMD iGPU sharing 14 GiB with the system, the x4 ESRGAN model (Remacri-4x-TheNoise) runs out of GPU memory on inputs larger than about 384²: the journal shows torch.OutOfMemoryError: Tried to allocate 9.00 GiB. The x2 model (RealESRGAN-2xplus-TheNoise) handles 1024² inputs, producing a 2048² image in 10 s. Generate at 512–768, upscale x2, and keep x4 for small sprites.
The setup
Lemonade is a local AI server from AMD. Since version 11.6 it ships an image backend called TheNoise, a ROCm engine tuned for the integrated GPUs of Ryzen AI laptops. It exposes OpenAI-style HTTP endpoints; for upscaling, POST /api/v1/images/upscale takes a base64 PNG and the name of an ESRGAN model, and returns the upscaled PNG. The factor is fixed by the model, x2 or x4. My machine is a laptop with a Radeon 860M: no dedicated VRAM, the GPU carves its memory out of the 28 GB of system RAM, and the driver reports a capacity of 14.32 GiB. A 5 GB diffusion model (Anima-Base) was loaded at the same time, as it would be in normal use.

What I expected
An ESRGAN upscale is a small convolutional network with tiled inference. I expected it to scale with output size, and a 2048² output to be fine either way, since the same GPU had just produced a 1024² image with a 5 GB diffusion model.
What actually happens
$ curl -s -X POST http://127.0.0.1:13305/api/v1/images/upscale \
-H 'Content-Type: application/json' \
-d '{"image": "<base64 of a 512x512 png>", "model": "Remacri-4x-TheNoise"}'
{"error":{"message":"Upscale failed","type":"server_error"}}
The response is the same for any cause. The real error is in the journal of the snap daemon:
journalctl --no-pager -S -20min | grep -iE 'thenoise|lemon' | grep -iE 'error|memory'
thenoise/upscale/esrgan.py, line 155, in forward
torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 9.00 GiB. GPU 0 has a total capacity of 14.32 GiB of which 5.61 GiB is free.
[Warn] (TheNoise) Upscale failed (exit code: 1, model: .../esrgan/4x-remacri.safetensors ...)
[Error] (Server) Error 500: POST /api/v1/images/upscale
The error says CUDA because ROCm aliases it; there is no NVIDIA card in this laptop. The numbers that matter: the x4 network wants a 9 GiB tensor for a 512² input, and with the diffusion model resident only 5.6 GiB were free.
Measured, same session, same loaded model:
| Input | x2 (RealESRGAN-2xplus-TheNoise) |
x4 (Remacri-4x-TheNoise) |
|---|---|---|
| 256² | not measured | 1024² in 6 s |
| 384² | not measured | 1536² in 8 s |
| 512² | 1024² in 4 s | HTTP 500, OOM |
| 768×512 | 1536×1024 in 5 s | not tried |
| 1024² | 2048² in 10 s | not tried |
So the same 2048² output is reachable with x2 from 1024² and not with x4 from 512². The limit is the x4 model’s memory per tile, not the size of the result.
The fix
Pick the upscaler by input size, and keep the generic 500 from hiding the cause:
import base64, json, urllib.request
def upscale(png: bytes, model: str) -> bytes:
body = json.dumps({"image": base64.b64encode(png).decode(), "model": model}).encode()
req = urllib.request.Request("http://127.0.0.1:13305/api/v1/images/upscale",
data=body, headers={"Content-Type": "application/json"})
with urllib.request.urlopen(req, timeout=600) as r:
return base64.b64decode(json.load(r)["data"][0]["b64_json"])
def upscale_auto(png: bytes, w: int, h: int) -> bytes:
# x4 only for small sprites; x2 for anything a diffusion model actually outputs
model = "Remacri-4x-TheNoise" if max(w, h) <= 384 else "RealESRGAN-2xplus-TheNoise"
try:
return upscale(png, model)
except urllib.error.HTTPError as e:
raise SystemExit(f"upscale failed ({e.code}); read the cause with: "
"journalctl -S -10min | grep -i thenoise") from e
Both models are 70 MB pulls: lemonade-server pull RealESRGAN-2xplus-TheNoise. For a set of game assets I now generate at 512–768 (under a minute per image on this GPU), then upscale x2, and only use x4 on icons below 384². A 256² draft upscaled x4 stays a blurry draft, so this is not a shortcut around rendering at a decent size.
Why it works
ESRGAN upscalers grow their feature maps with the input, and the x4 architectures used here are heavier per pixel than the x2 one. TheNoise runs them through PyTorch on ROCm; the traceback stops in esrgan.py: forward inside forward_tile, so tiling exists but the tile for a 512² input still asks for one 9 GiB allocation. On an iGPU that budget competes with the loaded diffusion model, which is why 384² fits and 512² does not. I did not read the tiling code to find the tile size, and I could not test with the diffusion model unloaded, so I cannot say whether an empty GPU would make 512² pass.
What I did not test
- The other x4 models in the catalog (
LSDIR-4x-TheNoise,NMKD-Siax-CX-200k-TheNoise,RealESRGAN-4xplus-TheNoise). Same recipe, probably the same limit, not verified. - A discrete GPU with real VRAM, or a Strix Halo with more shared memory. The 384² threshold is specific to a 14 GiB budget shared with a 5 GB model.
- The x2 model above 1024² inputs, and x4 between 384² and 512².
- Whether unloading every model first changes the outcome.
Facts
context: lemonade-server 11.9.0 snap with the TheNoise 0.4.1 ROCm image backend on an AMD Radeon 860M iGPU (14.32 GiB shared), Anima-Base loaded
problem: POST /api/v1/images/upscale with Remacri-4x-TheNoise returns HTTP 500 "Upscale failed" for a 512x512 input; the journal shows torch.OutOfMemoryError trying to allocate 9.00 GiB
solution: use RealESRGAN-2xplus-TheNoise for inputs above ~384px (1024x1024 -> 2048x2048 in 10 s); keep the x4 model for inputs up to 384px; read the real cause in journalctl, the HTTP body never carries it
verified_on: 2026-09-12
applies_to: [lemonade 11.9.0, thenoise 0.4.1-rocm7.14.0, gfx1152 iGPU]
does_not_apply_to: [discrete GPUs with enough VRAM, inputs of 384px or less]
Ping : PyTorch ROCm on a Radeon 860M iGPU: use HSA_OVERRIDE_GFX_VERSION=11.0.0, not 11.5.1, and cap RAM with systemd-run