Instructions to use mlboydaisuke/real-esrgan-x4v3-litert with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT
How to use mlboydaisuke/real-esrgan-x4v3-litert with LiteRT:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Real-ESRGAN General x4v3 β LiteRT (CompiledModel GPU)
Real-ESRGAN realesr-general-x4v3 (SRVGGNetCompact, ~1.2M params, BSD-3-Clause) re-authored to a
GPU-native LiteRT .tflite via the official litert_torch path. Γ4 real-world super-resolution.
FP16, 3.5 MB, input 128Γ128 β output 512Γ512 (NHWC, RGB, 0β1).
Verified on a Pixel 8a: the whole graph runs on the GPU delegate (full LITERT_CL residency, 211/211 nodes, 1 partition) in ~1 ms, and the GPU output matches the CPU/PyTorch reference (corr β 0.995).
Why this is GPU-clean
A pure CNN, but the stock conversion isn't GPU-clean: PReLU lowers to GREATER+SELECT+MUL
and PixelShuffle lowers to a >4-D reshape β both GPU-rejected. Here:
- PReLU β
relu(x) β aΒ·relu(βx)(per-channela): exact, only RELU/MUL/SUB. - PixelShuffle(4) β a one-hot ConvTranspose(stride 4) β ZeroStuffConvT (zero-stuff nearest +
Conv2d): exact, no
TRANSPOSE_CONV, no >4-D tensors.
Result: zero GATHER/SELECT/TopK/Cast, no >4-D tensors β full GPU residency. Re-authored vs original: corr 1.000000.
I/O
- Input
[1, 128, 128, 3]NHWC, RGB, 0β1 float (no mean/std). Tile larger images into 128Γ128 patches. - Output
[1, 512, 512, 3]NHWC, RGB, 0β1 (clamp to [0,1]). Γ4 upscale.
Training data & PII
realesr-general-x4v3 was trained by the Real-ESRGAN authors on public super-resolution datasets
(DIV2K / Flickr2K / OST and a synthetic high-order degradation pipeline). The model upscales image
pixels only β no faces, identities, or other personal attributes are detected, recognized, or
output. No additional or private data was used; weights are the official release, only the op graph
was re-authored for GPU.
Sample app + conversion script
Android sample (CompiledModel GPU, before/after compare) and the litert_torch conversion script:
https://github.com/google-ai-edge/litert-samples (compiled_model_api/super_resolution)
- Downloads last month
- 30