xocialize commited on
Commit
5e9a419
·
verified ·
1 Parent(s): 4e8e106

Nacre v1 (full-v1 @110k EMA): weights, VQ-f4 (MIT), config, card, attribution

Browse files
Files changed (8) hide show
  1. .gitattributes +1 -0
  2. ATTRIBUTION.csv +3 -0
  3. LICENSE +202 -0
  4. NOTICE +10 -0
  5. README.md +76 -0
  6. config.json +65 -0
  7. nacre_v1.safetensors +3 -0
  8. vq_f4.safetensors +3 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ ATTRIBUTION.csv filter=lfs diff=lfs merge=lfs -text
ATTRIBUTION.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:86bf8696746bcf14d5a5c410fb5d6ce2d4fb3dc97e803d0866eb2e978b5638b3
3
+ size 12143947
LICENSE ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
NOTICE ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ Nacre v1
2
+ Copyright 2026 Xocialize. Licensed under the Apache License, Version 2.0 (see LICENSE).
3
+
4
+ This distribution includes the VQ-f4 autoencoder weights from CompVis latent-diffusion
5
+ (https://github.com/CompVis/latent-diffusion), released under the MIT License:
6
+ Copyright (c) 2022 Machine Vision and Learning Group, LMU Munich
7
+
8
+ The denoiser was trained on images from Wikimedia Commons under CC0, public-domain and
9
+ Creative Commons Attribution licences. Each training image, its licence and its author are
10
+ listed in ATTRIBUTION.csv.
README.md ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ tags:
4
+ - super-resolution
5
+ - image-restoration
6
+ - diffusion
7
+ - resshift
8
+ pipeline_tag: image-to-image
9
+ ---
10
+
11
+ # Nacre v1 — provenance-clean 4× real-world super-resolution
12
+
13
+ A clean-room, ResShift-class generative upscaler: a 118.6M-parameter SwinUNet denoiser driving a
14
+ **4-step residual-shift diffusion** in the latent space of the CompVis VQ-f4 autoencoder. It takes a
15
+ degraded low-resolution photo (blur, noise, JPEG, resize — the Real-ESRGAN two-stage family) and returns
16
+ a 4× restoration with plausible fine detail.
17
+
18
+ **Why it exists:** every comparable generative SR model is blocked somewhere in its stack — non-commercial
19
+ weights (ResShift, StableSR, SUPIR), a use-restricted base (SD2.1-based PiSA-SR / OSEDiff / SeeSR), or an
20
+ undisclosed training corpus. Nacre is permissive **all the way down**:
21
+
22
+ | Component | Licence | Provenance |
23
+ |---|---|---|
24
+ | Code (architecture + trainer) | Apache-2.0 | written from the papers; no reference code copied |
25
+ | Denoiser weights (`nacre_v1.safetensors`) | Apache-2.0 | trained from scratch by Xocialize |
26
+ | Autoencoder (`vq_f4.safetensors`) | MIT | CompVis latent-diffusion VQ-f4, unmodified (training head removed) |
27
+ | Training images | CC0 / Public domain / CC BY family | 51,759 Wikimedia Commons images, per-file licences in `ATTRIBUTION.csv` |
28
+
29
+ ## Results — neutral benchmarks, vs the released ResShift v3
30
+
31
+ Same inputs, same degradation draws and same chain noise for both models; each run through its own
32
+ autoencoder. Real-image sets are centre-cropped to 256 px LQ (→ 1024 px output).
33
+
34
+ | Set | PSNR-Y ↑ | SSIM-Y ↑ | LPIPS ↓ ¹ | CLIPIQA ↑ | MUSIQ ↑ |
35
+ |---|---|---|---|---|---|
36
+ | RealSR V3 ×4 (100 real camera pairs) | **23.98** vs 23.93 | **0.705** vs 0.687 | **0.318** vs 0.364 | 0.572 vs 0.574 | **63.5** vs 59.3 |
37
+ | DIV2K-val (200 crops, synthetic damage) | 22.85 vs 22.86 | **0.579** vs 0.571 | **0.347** vs 0.356 | 0.517 vs **0.549** | **58.2** vs 56.8 |
38
+ | RealSet80 (no ground truth) | — | — | — | 0.606 vs **0.648** | **66.3** vs 64.1 |
39
+
40
+ At or above ResShift on fidelity everywhere and on MUSIQ everywhere; behind on CLIPIQA on DIV2K and
41
+ RealSet by 0.03–0.04. ¹ LPIPS is part of Nacre's training loss, so its lead there is not independent evidence.
42
+
43
+ ## Usage
44
+
45
+ Inputs are RGB in [0, 1]. The network is conditioned on the **LQ image in pixel space** (scaled to [-1, 1]);
46
+ the LQ's *latent* — `AE.encode(bicubic_x4(lq))` — is only the endpoint of the residual-shift chain.
47
+ Pad LQ sides to a multiple of 64 (four U-Net levels, then 8-wide shifted windows) and crop the output.
48
+ `config.json` carries the full model, diffusion and preprocessing parameters. Reference implementation:
49
+ `nacre/` (PyTorch, Apache-2.0); a Swift/MLX port is in progress.
50
+
51
+ ## Training
52
+
53
+ - **Data:** 122,021 lossless 512² tiles from 51,759 Wikimedia Commons photos (CC0/PD/CC BY), filtered
54
+ with blockiness / HyperIQA / bytes-per-pixel floors (worst 10/5/5 % removed), ≤ 4 tiles per image.
55
+ Every source image was **downscaled by a per-image factor in [0.15, 0.45]** before tiling: native-resolution
56
+ camera frames are soft at the pixel level, and a model trained on them learns to produce soft output.
57
+ - **Degradations:** Real-ESRGAN two-stage (blur, resize, noise, JPEG, sinc), synthesised on the fly.
58
+ - **Schedule:** batch 96, AdamW 5e-5 → 2e-5 cosine, EMA 0.999, latent MSE + LPIPS (weight 2× for the
59
+ first 100k steps, 1× after). Selected checkpoint: step 110k (EMA), by a selection rule fixed before the
60
+ candidates were scored (fidelity floor first, then realism by CLIPIQA + MUSIQ; LPIPS excluded as in-loss).
61
+ - **Compute:** ~300k steps on one H200 (Hugging Face Jobs), ≈ 0.43 it/s.
62
+
63
+ ## Limitations
64
+
65
+ - **Generative detail is invented, not recovered.** On heavily degraded input the model synthesises
66
+ plausible texture; it can differ from the true scene. Do not use it where exact detail matters
67
+ (forensics, measurement, medical).
68
+ - **Small text:** generative SR models are known to substitute letters in already-legible small text.
69
+ Nacre's text behaviour is being measured (SA-Text); until then, route text-heavy regions to a
70
+ fidelity-oriented upscaler.
71
+ - Trained at 4× only; motion blur is not in the degradation set.
72
+
73
+ ## Attribution
74
+
75
+ Training images are listed with title, URL, licence and author in `ATTRIBUTION.csv`. ⚠️ **300 CC BY
76
+ rows still lack a resolved author name** — this repository stays private until they are resolved.
config.json ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architecture": "SwinUNet (ResShift-class), residual-shift diffusion, 4 steps",
3
+ "model": {
4
+ "image_size": 64,
5
+ "in_channels": 3,
6
+ "model_channels": 160,
7
+ "out_channels": 3,
8
+ "num_res_blocks": [
9
+ 2,
10
+ 2,
11
+ 2,
12
+ 2
13
+ ],
14
+ "attention_resolutions": [
15
+ 64,
16
+ 32,
17
+ 16,
18
+ 8
19
+ ],
20
+ "channel_mult": [
21
+ 1,
22
+ 2,
23
+ 2,
24
+ 4
25
+ ],
26
+ "num_head_channels": 32,
27
+ "swin_depth": 2,
28
+ "swin_embed_dim": 192,
29
+ "window_size": 8,
30
+ "mlp_ratio": 4.0,
31
+ "dropout": 0.0,
32
+ "cond_lq": true,
33
+ "lq_size": 64
34
+ },
35
+ "diffusion": {
36
+ "num_timesteps": 4,
37
+ "kappa": 2.0,
38
+ "power": 0.3,
39
+ "min_noise_level": 0.2,
40
+ "etas_end": 0.99,
41
+ "normalize_input": true
42
+ },
43
+ "autoencoder": {
44
+ "file": "vq_f4.safetensors",
45
+ "type": "VQ-f4 (embed_dim 3, n_embed 8192)",
46
+ "scale_factor": 1.0,
47
+ "decode": "force_not_quantize (continuous latents)"
48
+ },
49
+ "scale": 4,
50
+ "conventions": {
51
+ "pixel_range": "[-1,1] for the AE input and the network's lq condition",
52
+ "y0": "AE.encode(bicubic_x4(lq)) \u2014 the chain endpoint",
53
+ "cond": "the LQ image itself in pixel space (64x64 for a 256 output tile), NOT its latent",
54
+ "pad": "LQ sides to a multiple of 64 (4 levels then 8-wide shifted windows)"
55
+ },
56
+ "training": {
57
+ "step": 110000,
58
+ "weights": "EMA 0.999",
59
+ "loss_coef": [
60
+ 1.0,
61
+ 1.0
62
+ ],
63
+ "corpus": "commons-sr tiles_v3"
64
+ }
65
+ }
nacre_v1.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:73e791f8c27fb17760d7c5c372346acb4f60cef53200fedc453ff3a9154c3438
3
+ size 474730492
vq_f4.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:84fb05c37809385440cbf44a0a5491d2d8b7b22dd5698a112f386abefee1424e
3
+ size 221312224