
Real-ESRGAN x2plus and x4plus in BSHJ
Weights only: the mashbox package, release 0.1.10, has no mashbox run command for this model.
Xintao Wang's Real-ESRGAN image upscaling weights, 2x and 4x, as BSHJ files, the weight format the mashbox TPU engine reads. Float32, converted from the upstream release files (params_ema).
Files
| File | Scale | Size (MB) | Tensors | Converted from |
|---|---|---|---|---|
RealESRGAN_x2plus.bshj |
2x | 68.3 | 702, float32 | RealESRGAN_x2plus.pth, Real-ESRGAN release v0.2.1 |
RealESRGAN_x4plus.bshj |
4x | 68.3 | 702, float32 | RealESRGAN_x4plus.pth, Real-ESRGAN release v0.1.0 |
Tensor names and shapes are the upstream PyTorch state dict's (conv_first.weight, body.0.rdb1.conv1.weight, and so on). Each file's header records the upstream file it came from and that file's sha256.
Load
The mashbox package's BSHJ reader opens the files as NumPy arrays over a memory map, without copying:
pip install mashbox
from huggingface_hub import hf_hub_download
from mashbox import bshj
f = bshj.File(hf_hub_download("mashbox-labs/Real-ESRGAN-TPU", "RealESRGAN_x4plus.bshj"))
print(f.meta()["source"]) # upstream file, its sha256, state dict key
w = f.array("conv_first.weight") # float32, shape (64, 3, 3, 3)
Links
| Original code and weights | xinntao/Real-ESRGAN by Xintao Wang |
| BSHJ reader | src/mashbox/bshj.py |
| Companies | hello@mashbox.gg |
Licence
BSD-3-Clause, the licence of xinntao/Real-ESRGAN, whose GitHub releases publish these weights ("Copyright (c) 2021, Xintao Wang"). LICENSE in this repo is that repo's licence file, unchanged.