xocialize commited on
Commit
2f02be6
·
verified ·
1 Parent(s): 8aad4e2

Add NAFNet MLX weights (faithful port of megvii-research/NAFNet)

Browse files
Files changed (4) hide show
  1. NOTICE +13 -0
  2. README.md +30 -0
  3. config.json +24 -0
  4. model.safetensors +3 -0
NOTICE ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ nafnet-mlx
2
+ Apple MLX port of NAFNet (Simple Baselines for Image Restoration).
3
+
4
+ This work is licensed under the MIT License.
5
+
6
+ Derived from:
7
+ - megvii-research/NAFNet (MIT) — official PyTorch implementation and pretrained weights.
8
+ Chen et al., "Simple Baselines for Image Restoration", ECCV 2022 (arXiv:2204.04676).
9
+ TLC (test-time local converter) from Chu et al., arXiv:2112.04491.
10
+ - Built on the BasicSR framework conventions (Apache-2.0).
11
+
12
+ Pretrained weights (REDS / SIDD / GoPro width64) are the official megvii-research releases,
13
+ converted to MLX safetensors. Original weights are MIT-licensed.
README.md ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ library_name: mlx
4
+ pipeline_tag: image-to-image
5
+ tags: [mlx, image-restoration, deblurring, denoising, nafnet]
6
+ base_model: megvii-research/NAFNet
7
+ ---
8
+
9
+ # NAFNet width64 (MLX) — Image deblurring
10
+
11
+ Apple MLX port of **[NAFNet](https://github.com/megvii-research/NAFNet)** (Simple Baselines for
12
+ Image Restoration, ECCV 2022). Runs on Apple Silicon via [MLX](https://github.com/ml-explore/mlx).
13
+
14
+ This checkpoint: **REDS** (Image deblurring). width64.
15
+
16
+ ## Usage
17
+ ```python
18
+ from nafnet_mlx import NAFNetConfig
19
+ from nafnet_mlx.pipeline import load_model, restore_to_file
20
+ m = load_model("model.safetensors", NAFNetConfig.reds_width64())
21
+ restore_to_file(m, "input.png", "output.png")
22
+ ```
23
+
24
+ ## Validation
25
+ Faithful NHWC port (SimpleGate, Simplified Channel Attention, channel-axis LayerNorm2d,
26
+ UNet + PixelShuffle). PT-vs-MLX full-model parity on a real image ~1e-6.
27
+ Uses NAFNetLocal (TLC) local pooling.
28
+
29
+ ## License & attribution
30
+ MIT. Derived from megvii-research/NAFNet (MIT). See `NOTICE`.
config.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "img_channel": 3,
3
+ "width": 64,
4
+ "middle_blk_num": 1,
5
+ "enc_blk_nums": [
6
+ 1,
7
+ 1,
8
+ 1,
9
+ 28
10
+ ],
11
+ "dec_blk_nums": [
12
+ 1,
13
+ 1,
14
+ 1,
15
+ 1
16
+ ],
17
+ "local": true,
18
+ "train_size": [
19
+ 1,
20
+ 3,
21
+ 256,
22
+ 256
23
+ ]
24
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e8064ab91ca21a5741ac162a6e896ac98b447af4095ae56701ebfb2325500786
3
+ size 271619077