Rename to Halide Preview
Browse filesFiles changed (3)
- README.md+12-12
- config.json+1-1
- mica_modeling.py → halide_modeling.pyRenamed+12-12
4 unmodified lines5678910113 unmodified lines15161718192021222324251 unmodified line2728293031323312 unmodified lines4647484950515211 unmodified lines6465666768697071727374752 unmodified lines7879808182838485868788898 unmodified lines98991001011021034 unmodified linespipeline_tag: text-to-imagelibrary_name: pytorchtags:- mica- text-to-image- flow-matching- fcdm3 unmodified lines- preview---<img src="banner.png" alt="Halide Preview" width="100%">**Mica Preview** is a small, experimental 194M-parameter English text-to-image flow-matching model trained from scratch at 768×768 resolution. It is our first working research preview from the Mica image-generation family — built to test whether a recurrent Perceiver "thinker" paired with a pure-ConvNeXt V2 renderer can produce coherent high-resolution imagery at a fraction of the parameter count of standard diffusion Transformers.It is still early. Trained to step 291,000 (~4.66M image-caption samples seen), Mica Preview is not meant to rival large billion-parameter image models yet — it is a transparent, self-contained checkpoint and a starting point for what comes next.---1 unmodified lineAll samples below were generated directly from the released EMA weights at **768×768** (`50` Euler steps, CFG `4.0`, resolution shift `2.5`, uncurated single seed per prompt):| Sample | Prompt ||---|---|12 unmodified lines## Architecture & TrainingMica Preview separates global semantic planning from local spatial rendering in plain PyTorch (`mica_modeling.py`, no custom CUDA extensions required):- **Parameters:** 194,328,196 total (`192,230,532` generator + `2,097,664` text adapter, released as EMA weights `decay = 0.9995`)- **Thinker (Global Planner):** Perceiver-style Transformer operating on a 24×24 spatial plan grid + 16 global tokens (`p_dim = 256`, `dim = 640`, 4 perceiver blocks, 3 prelude + 3 recurrent core × 4 loops + 2 coda blocks, 2D RoPE, QK-RMSNorm, multi-resolution ConvRead branch)11 unmodified linesfrom diffusers import AutoencoderKLfrom huggingface_hub import hf_hub_downloadfrom safetensors.torch import load_filefrom mica_modeling import DistillT5TextEncoder, MicaConfig, MicaGenerator, VAE_REPO, sample_micarepo_id = "Emergent-Knowledge/mica-preview"device = "cuda" if torch.cuda.is_available() else "cpu"model = MicaGenerator(MicaConfig())model.load_state_dict(load_file(hf_hub_download(repo_id, "generator.safetensors")), strict=True)model = model.to(device).eval()2 unmodified linesvae = AutoencoderKL.from_pretrained(VAE_REPO, torch_dtype=torch.bfloat16 if device == "cuda" else torch.float32).to(device).eval()images = sample_mica(model, text_enc, vae,prompts=["A breathtaking sunrise over snow-capped Alpine peaks reflected in a calm turquoise glacial lake"],steps=50, cfg=4.0, shift=2.5, resolution=768, seed=42, device=device,)images[0].save("mica_sample.png")```---8 unmodified lines## Acknowledgements & LicenseMica Preview builds on open research and open weights from the community — including FCDM (`arXiv:2603.09408`), Agate Thinker-Renderer architectures, [`LifuWang/DistillT5`](https://huggingface.co/LifuWang/DistillT5), [`google-t5/t5-base`](https://huggingface.co/google-t5/t5-base), and [`stabilityai/sd-vae-ft-mse`](https://huggingface.co/stabilityai/sd-vae-ft-mse).Released under the **Apache-2.0** license.4 unmodified lines5678910113 unmodified lines15161718192021222324251 unmodified line2728293031323312 unmodified lines4647484950515211 unmodified lines6465666768697071727374752 unmodified lines7879808182838485868788898 unmodified lines98991001011021034 unmodified linespipeline_tag: text-to-imagelibrary_name: pytorchtags:- halide- text-to-image- flow-matching- fcdm3 unmodified lines- preview---# Halide Preview**Halide Preview** is a small, experimental 194M-parameter English text-to-image flow-matching model trained from scratch at 768×768 resolution. It is our first working research preview from the Halide image-generation family — built to test whether a recurrent Perceiver "thinker" paired with a pure-ConvNeXt V2 renderer can produce coherent high-resolution imagery at a fraction of the parameter count of standard diffusion Transformers.It is still early. Trained to step 291,000 (~4.66M image-caption samples seen), Halide Preview is not meant to rival large billion-parameter image models yet — it is a transparent, self-contained checkpoint and a starting point for what comes next.---1 unmodified lineAll samples below were generated directly from the released EMA weights at **768×768** (`50` Euler steps, CFG `4.0`, resolution shift `2.5`, uncurated single seed per prompt):| Sample | Prompt ||---|---|12 unmodified lines## Architecture & TrainingHalide Preview separates global semantic planning from local spatial rendering in plain PyTorch (`halide_modeling.py`, no custom CUDA extensions required):- **Parameters:** 194,328,196 total (`192,230,532` generator + `2,097,664` text adapter, released as EMA weights `decay = 0.9995`)- **Thinker (Global Planner):** Perceiver-style Transformer operating on a 24×24 spatial plan grid + 16 global tokens (`p_dim = 256`, `dim = 640`, 4 perceiver blocks, 3 prelude + 3 recurrent core × 4 loops + 2 coda blocks, 2D RoPE, QK-RMSNorm, multi-resolution ConvRead branch)11 unmodified linesfrom diffusers import AutoencoderKLfrom huggingface_hub import hf_hub_downloadfrom safetensors.torch import load_filefrom halide_modeling import DistillT5TextEncoder, HalideConfig, HalideGenerator, VAE_REPO, sample_haliderepo_id = "Emergent-Knowledge/halide-preview"device = "cuda" if torch.cuda.is_available() else "cpu"model = HalideGenerator(HalideConfig())model.load_state_dict(load_file(hf_hub_download(repo_id, "generator.safetensors")), strict=True)model = model.to(device).eval()2 unmodified linesvae = AutoencoderKL.from_pretrained(VAE_REPO, torch_dtype=torch.bfloat16 if device == "cuda" else torch.float32).to(device).eval()images = sample_halide(model, text_enc, vae,prompts=["A breathtaking sunrise over snow-capped Alpine peaks reflected in a calm turquoise glacial lake"],steps=50, cfg=4.0, shift=2.5, resolution=768, seed=42, device=device,)images[0].save("halide_sample.png")```---8 unmodified lines## Acknowledgements & LicenseHalide Preview builds on open research and open weights from the community — including FCDM (`arXiv:2603.09408`), Agate Thinker-Renderer architectures, [`LifuWang/DistillT5`](https://huggingface.co/LifuWang/DistillT5), [`google-t5/t5-base`](https://huggingface.co/google-t5/t5-base), and [`stabilityai/sd-vae-ft-mse`](https://huggingface.co/stabilityai/sd-vae-ft-mse).Released under the **Apache-2.0** license.
12345{"model_type": "mica_v5_fcdm_thinker2","step": 291000,"samples_seen": 4656000,"ema": true,12345{"model_type": "halide_v5_fcdm_thinker2","step": 291000,"samples_seen": 4656000,"ema": true,
123422 unmodified lines27282930313233343536373839287 unmodified lines32732832933033133233333477 unmodified lines41241341441541641741841942042142242342442562 unmodified lines4884894904914924934941 unmodified line49649749849950050150249 unmodified lines552553554555556557558"""Mica Preview (v5, 768px): Portable PyTorch inference model & pipeline.Architecture:- 192.2M-param FCDM-Thinker2-MR (flat 768px mode, 96x96 SD-VAE latent grid)22 unmodified linesDISTILLT5_TOKENIZER_REPO = "google-t5/t5-base"DISTILLT5_D_MODEL = 768DISTILLT5_OUT_DIM = 4096MICA_CTX_DIM = 512VAE_REPO = "stabilityai/sd-vae-ft-mse"VAE_SCALE = 0.18215@dataclassclass MicaConfig:latent_ch: int = 4widths: list[int] = field(default_factory=lambda: [288, 832, 1664])depths: list[int] = field(default_factory=lambda: [4, 6, 2])287 unmodified linesreturn ctx + on * self.gate.to(ctx.dtype) * (code - ctx)class MicaThinker(nn.Module):def __init__(self, cfg: MicaConfig):super().__init__()self.grid, self.n_global, self.n_freq, self.rope = cfg.grid, cfg.n_global, cfg.n_freq, cfg.ropeself.loops = cfg.loops77 unmodified linesreturn out[:, :g * g].transpose(1, 2).reshape(B, -1, g, g)class MicaGenerator(nn.Module):def __init__(self, cfg: MicaConfig | None = None):super().__init__()cfg = cfg or MicaConfig()self.cfg = cfgself.native = 2 * cfg.gridself.loops = cfg.loopsself.thinker = MicaThinker(cfg)self.mr_count = CountCode(cfg.ctx_dim)w0, w1, w2 = cfg.widths62 unmodified linesclass DistillT5TextEncoder:"""LifuWang/DistillT5 (with explicit key remap) + google-t5/t5-base tokenizer + Mica ctx_proj."""def __init__(self, device: str = "cuda", max_len: int = 512):self.device = device1 unmodified lineself.tokenizer = Noneself.encoder = Noneself.final_projection = Noneself.ctx_proj = nn.Linear(DISTILLT5_OUT_DIM, MICA_CTX_DIM)def load(self):from huggingface_hub import hf_hub_download49 unmodified lines@torch.no_grad()def sample_mica(model: MicaGenerator, text_enc: DistillT5TextEncoder, vae,prompts: list[str], steps: int = 50, cfg: float = 4.0,shift: float = 2.0, resolution: int = 768, seed: int = 42,device: str = "cuda"):123422 unmodified lines27282930313233343536373839287 unmodified lines32732832933033133233333477 unmodified lines41241341441541641741841942042142242342442562 unmodified lines4884894904914924934941 unmodified line49649749849950050150249 unmodified lines552553554555556557558"""Halide Preview (v5, 768px): Portable PyTorch inference model & pipeline.Architecture:- 192.2M-param FCDM-Thinker2-MR (flat 768px mode, 96x96 SD-VAE latent grid)22 unmodified linesDISTILLT5_TOKENIZER_REPO = "google-t5/t5-base"DISTILLT5_D_MODEL = 768DISTILLT5_OUT_DIM = 4096HALIDE_CTX_DIM = 512VAE_REPO = "stabilityai/sd-vae-ft-mse"VAE_SCALE = 0.18215@dataclassclass HalideConfig:latent_ch: int = 4widths: list[int] = field(default_factory=lambda: [288, 832, 1664])depths: list[int] = field(default_factory=lambda: [4, 6, 2])287 unmodified linesreturn ctx + on * self.gate.to(ctx.dtype) * (code - ctx)class HalideThinker(nn.Module):def __init__(self, cfg: HalideConfig):super().__init__()self.grid, self.n_global, self.n_freq, self.rope = cfg.grid, cfg.n_global, cfg.n_freq, cfg.ropeself.loops = cfg.loops77 unmodified linesreturn out[:, :g * g].transpose(1, 2).reshape(B, -1, g, g)class HalideGenerator(nn.Module):def __init__(self, cfg: HalideConfig | None = None):super().__init__()cfg = cfg or HalideConfig()self.cfg = cfgself.native = 2 * cfg.gridself.loops = cfg.loopsself.thinker = HalideThinker(cfg)self.mr_count = CountCode(cfg.ctx_dim)w0, w1, w2 = cfg.widths62 unmodified linesclass DistillT5TextEncoder:"""LifuWang/DistillT5 (with explicit key remap) + google-t5/t5-base tokenizer + Halide ctx_proj."""def __init__(self, device: str = "cuda", max_len: int = 512):self.device = device1 unmodified lineself.tokenizer = Noneself.encoder = Noneself.final_projection = Noneself.ctx_proj = nn.Linear(DISTILLT5_OUT_DIM, HALIDE_CTX_DIM)def load(self):from huggingface_hub import hf_hub_download49 unmodified lines@torch.no_grad()def sample_halide(model: HalideGenerator, text_enc: DistillT5TextEncoder, vae,prompts: list[str], steps: int = 50, cfg: float = 4.0,shift: float = 2.0, resolution: int = 768, seed: int = 42,device: str = "cuda"):
README.md+12-12
config.json+1-1
mica_modeling.py → halide_modeling.pyRenamed+12-12