j0no12 commited on
Commit
c0f018c
·
verified ·
1 Parent(s): 8d31176

Name the SolPix transformer and decoder adapter

Browse files

Use SolPixTransformer2D and AutoencoderDCSol in the architecture manifest, source package, and inference helper.

Files changed (2) hide show
  1. README.md +7 -5
  2. solpix/autoencoder.py +39 -0
README.md CHANGED
@@ -73,11 +73,13 @@ this incomplete checkpoint.
73
 
74
  ## Architecture
75
 
76
- SolPix is a 15-block, 512-wide U-shaped joint text/image transformer. It uses
77
- 8 attention heads (64 dimensions each), a 1,152-wide SwiGLU MLP, seven long skip
78
- connections, shared adaptive layer-normalization conditioning, and depthwise
79
- 3×3 local mixing. The text encoder and image autoencoder remain frozen and
80
- outside the approximately 49M-parameter generator.
 
 
81
 
82
  The model accepts precomputed text states and noisy autoencoder latents. Its
83
  sampler follows the training convention `x_t = (1 - t) x_clean + t noise`,
 
73
 
74
  ## Architecture
75
 
76
+ The transformer implementation is `solpix.SolPixTransformer2D`: a 15-block,
77
+ 512-wide U-shaped joint text/image transformer. It uses 8 attention heads
78
+ (64 dimensions each), a 1,152-wide SwiGLU MLP, seven long skip connections,
79
+ shared adaptive layer-normalization conditioning, and depthwise 3×3 local
80
+ mixing. The decoder adapter is `solpix.AutoencoderDCSol`, which loads the
81
+ external SANA `diffusers.AutoencoderDC`. The text encoder and image autoencoder
82
+ remain frozen and outside the approximately 49M-parameter generator.
83
 
84
  The model accepts precomputed text states and noisy autoencoder latents. Its
85
  sampler follows the training convention `x_t = (1 - t) x_clean + t noise`,
solpix/autoencoder.py ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Sol-branded adapter for the matching SANA Diffusers autoencoder."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any
6
+
7
+ from torch import nn
8
+
9
+
10
+ class AutoencoderDCSol(nn.Module):
11
+ """Thin wrapper around the frozen SANA 1.1 ``AutoencoderDC`` decoder.
12
+
13
+ The learned decoder weights stay in the upstream Diffusers repository;
14
+ this adapter gives SolPix a stable, descriptive component name.
15
+ """
16
+
17
+ model_id = "mit-han-lab/dc-ae-f32c32-sana-1.1-diffusers"
18
+ revision = "df0d9d634aea77793c1fb685d4b9db092c99e686"
19
+
20
+ def __init__(self, autoencoder: nn.Module):
21
+ super().__init__()
22
+ self.autoencoder = autoencoder
23
+
24
+ @classmethod
25
+ def from_pretrained(cls, model_id: str | None = None, **kwargs: Any) -> "AutoencoderDCSol":
26
+ from diffusers import AutoencoderDC
27
+
28
+ kwargs.setdefault("revision", cls.revision)
29
+ return cls(AutoencoderDC.from_pretrained(model_id or cls.model_id, **kwargs))
30
+
31
+ @property
32
+ def config(self) -> Any:
33
+ return self.autoencoder.config
34
+
35
+ def decode(self, *args: Any, **kwargs: Any) -> Any:
36
+ return self.autoencoder.decode(*args, **kwargs)
37
+
38
+ def forward(self, *args: Any, **kwargs: Any) -> Any:
39
+ return self.decode(*args, **kwargs)