"""PatchSVAE configuration for HuggingFace AutoModel.""" from transformers import PretrainedConfig class PatchSVAEConfig(PretrainedConfig): """Configuration for PatchSVAE — Fresnel geometric compression lens. Args: matrix_v: Number of rows per patch matrix (vocabulary size) D: Embedding dimension (number of singular values per patch) patch_size: Spatial patch size in pixels hidden: MLP hidden width for encoder/decoder depth: Number of residual blocks in encoder and decoder n_cross_layers: Number of spectral cross-attention layers max_alpha: Maximum coordination strength per spectral mode alpha_init: Initial alpha logit (sigmoid(alpha_init) * max_alpha) target_cv: Soft hand CV target for training image_size: Expected input image size (H=W) """ model_type = "patchsvae" def __init__( self, matrix_v=256, D=16, patch_size=16, hidden=768, depth=4, n_cross_layers=2, max_alpha=0.2, alpha_init=-2.0, target_cv=0.125, image_size=128, **kwargs, ): self.matrix_v = matrix_v self.D = D self.patch_size = patch_size self.hidden = hidden self.depth = depth self.n_cross_layers = n_cross_layers self.max_alpha = max_alpha self.alpha_init = alpha_init self.target_cv = target_cv self.image_size = image_size # Derived properties self.n_patches = (image_size // patch_size) ** 2 self.patch_dim = 3 * patch_size * patch_size self.mat_dim = matrix_v * D self.latent_channels = D self.latent_size = image_size // patch_size super().__init__(**kwargs)