NanoDreamer / README.md
utkucoban's picture
Upload README.md
e8086ed verified
|
Raw History Blame Contribute Delete
4.74 kB
---
license: mit
library_name: onnxruntime
pipeline_tag: unconditional-image-generation
tags:
- onnx
- onnxruntime-web
- webgpu
- stylegan2
- unconditional-image-generation
- generative-art
---
<p align="center">
<img src="https://huggingface.co/utkucoban/NanoDreamer/resolve/main/NDlogo.webp" alt="NanoDreamer" width="280">
</p>
# NanoDreamer
NanoDreamer is a compact, unconditional image-generation model trained to
synthesize 256 × 256 images of liminal interior spaces. It is designed for
fully local inference in a web browser with ONNX Runtime Web.
The recommended FP16 model is **47.9 MiB**. WebGPU is used when available, with
WebAssembly CPU inference as a compatibility fallback. After the model has
been downloaded, image generation runs on the user's device without a cloud
inference server.
**[Open the interactive browser demo](https://huggingface.co/spaces/utkucoban/NanoDreamer)**
## Technical overview
| Property | Value |
|---|---|
| Model type | Unconditional GAN |
| Architecture | Custom deployment pipeline using StyleGAN2 components |
| Resolution | 256 × 256 RGB |
| Latent space | 512-dimensional Gaussian vector |
| Conditioning | None |
| Export format | ONNX opset 18 |
| Input batch | Fixed batch size of 1 |
| Deployment weights | Exponential-moving-average generator |
| Preferred runtime | ONNX Runtime WebGPU |
| CPU fallback | ONNX Runtime WebAssembly |
NanoDreamer is not a diffusion model. It generates an image in a single model
forward pass and does not perform iterative denoising. There is no prompt,
caption, text encoder, reference image, mask, or class input.
The exported graph contains the StyleGAN mapping network, truncation,
synthesis network, fixed synthesis noise, RGB conversion, and final output
scaling. A fixed latent vector and truncation value produce a deterministic
result.
The NanoDreamer training, export, and browser deployment pipeline is custom.
The underlying StyleGAN2 generator and discriminator components are based on
OpenMMLab MMagic.
## Model interface
The model has two FP32 inputs:
- `latent`: shape `[1, 512]`, normally sampled from a standard Gaussian
distribution.
- `truncation`: shape `[1]`, controlling movement toward the mean latent.
It returns one FP32 tensor named `image` with shape `[1, 256, 256, 3]`. The
output uses NHWC layout, RGB channel order, and values in the range `[0, 1]`.
## Available files
| File | Size | Recommended use |
|---|---:|---|
| `NanoDreamer-onnx/NanoDreamer-FP16.onnx` | 47.9 MiB | Browser and WebGPU inference |
| `NanoDreamer-onnx/NanoDreamer-FP32.onnx` | 95.4 MiB | Reference, debugging, and CPU inference |
The FP16 graph uses reduced-precision internal weights and tensors while
preserving FP32 model inputs and output. Actual runtime memory consumption is
higher than the download size because the runtime also allocates intermediate
tensors and provider-specific buffers.
## Training
NanoDreamer was trained at 256 × 256 resolution using StyleGAN2 with adaptive
discriminator augmentation. Training also used R1 discriminator
regularization, generator path-length regularization, mixed precision, and an
exponential moving average of the generator weights.
The training dataset contains 20,000 synthetic JPEG images generated with the
Z-Image diffusion model. They depict rooms, corridors, openings, surfaces,
lighting, and architecturally ambiguous liminal spaces. Only the images were
used for training; captions and source prompts were not provided to
NanoDreamer.
The deployed model was exported from the EMA checkpoint at iteration 54,698.
With a training batch size of 64, this represents approximately 3.50 million
real-image presentations, including repeated and augmented views.
## Intended use
NanoDreamer is intended for local generative-art experiments, compact GAN
deployment research, latent-space exploration, and ONNX Runtime WebGPU
testing. It is not a general-purpose image generator, text-to-image model, or
architectural design tool.
## Limitations
- The model only represents its narrow synthetic liminal-interior training
distribution.
- It cannot follow text instructions or control specific image content.
- Generated geometry may contain impossible perspective, fused surfaces,
repeated structures, or inconsistent openings.
- The latent space is not guaranteed to be semantically disentangled.
- Outputs may reproduce biases and artifacts found in the synthetic dataset.
- Browser compatibility and generation speed depend on the device, browser,
GPU driver, and ONNX Runtime version.
## License
NanoDreamer code and model artifacts are released under the MIT License.
Third-party training components and runtimes retain their respective
licenses.