Instructions to use mlx-community/NAFNet-SIDD-width64 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use mlx-community/NAFNet-SIDD-width64 with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] huggingface-cli download --local-dir NAFNet-SIDD-width64 mlx-community/NAFNet-SIDD-width64
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
Add NAFNet MLX weights (faithful port of megvii-research/NAFNet)
Browse files- NOTICE +13 -0
- README.md +30 -0
- config.json +24 -0
- 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 denoising
|
| 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: **SIDD** (Image denoising). 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.sidd_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 |
+
|
| 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": 12,
|
| 5 |
+
"enc_blk_nums": [
|
| 6 |
+
2,
|
| 7 |
+
2,
|
| 8 |
+
4,
|
| 9 |
+
8
|
| 10 |
+
],
|
| 11 |
+
"dec_blk_nums": [
|
| 12 |
+
2,
|
| 13 |
+
2,
|
| 14 |
+
2,
|
| 15 |
+
2
|
| 16 |
+
],
|
| 17 |
+
"local": false,
|
| 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:62c6825ef8224e81a89e3c2ff35e9cde2367815ef12648dd4837006b5b86a44c
|
| 3 |
+
size 463995842
|