canter / README.md
data-archetype's picture
Publish Canter 0.5.0 contrastive PDG support
13490a2 verified
|
Raw
History Blame Contribute Delete
8.1 kB
---
license: other
license_name: mg-by-sa-2.0
license_link: https://ids.nus.edu.sg/docs/modelgo/v2/MG-BY-SA/LICENSE
library_name: canter
pipeline_tag: text-to-image
tags:
- flow-matching
- text-to-image
- photography
- pytorch
base_model:
- HuggingFaceTB/SmolLM2-360M
---
# Canter
## An efficient, photography-oriented text-to-image model
> **Preview release**
>
> The model is still training. Checkpoints and behavior may change during
> the preview period, and generation quality is still quite variable.
**Current checkpoint:** [`v0002`](RELEASES.md#v0002)
[Example gallery](GALLERY.md) · [Getting started](#getting-started) ·
[API and inference parameters](API.md) ·
[Technical report](TECHNICAL_REPORT.md) · [Releases](RELEASES.md)
ComfyUI custom nodes are available in
[`ComfyUI-Canter`](https://github.com/JTriggerFish/ComfyUI-Canter). They use
the package's conditioning, guidance, schedule, solver, preview-projection,
and VAE APIs.
This is a 2 billion parameter indie model trained on a single GPU. It is
designed for efficient text-to-image generation with a strong focus on
photography, natural scenes, people, objects, and places.
The repository bundles the flow-matching denoiser, text tokenizer with a copy
of the required
[`SmolLM2-360M`](https://huggingface.co/HuggingFaceTB/SmolLM2-360M) weights,
Python package, and Gradio interface. Image decoding uses
[`data-archetype/dinac_ae_d2`](https://huggingface.co/data-archetype/dinac_ae_d2)
VAE, which is downloaded automatically.
## Getting started
### Requirements
The release requires:
- Python 3.10 to 3.13
- PyTorch 2.13 (`>=2.13,<2.14`) with a compatible CUDA build
- an NVIDIA GPU with CUDA and bfloat16 support
- 8 GB VRAM for 1024 by 1024 generation with the default bfloat16 release
- Linux or Windows
Install a CUDA-enabled PyTorch build for your system first. The
[PyTorch installation selector](https://pytorch.org/get-started/locally/)
provides the appropriate command.
### Install the latest code and checkpoint
Install the Hugging Face CLI, download the moving `main` revision, and install
the package in editable mode:
```bash
python -m pip install "huggingface-hub>=1.15,<2"
hf download data-archetype/canter --revision main --local-dir canter
cd canter
python -m pip install -e ".[webui]"
```
`main` contains the latest Canter code and the current default checkpoint.
Editable installation means that refreshing the same directory updates the
code used by the installed `canter-web` command.
For Python API use without the Gradio interface, install with
`python -m pip install -e .` instead.
The default checkpoint stores most weights in bfloat16. Numerically sensitive
parameters remain in float32.
### Update an existing download
Refresh a directory created with `hf download` by running:
```bash
hf download data-archetype/canter --revision main --local-dir canter
```
If the package was installed without `-e`, reinstall it afterwards with
`python -m pip install --upgrade "./canter[webui]"`. A Git clone on the `main`
branch can instead be updated with `git pull`; an editable installation
immediately uses the updated checkout.
### Start the Gradio interface
Run the application from the downloaded repository:
```bash
python app.py --in-browser
```
`app.py` loads the weights from its own repository directory and
downloads the latest compatible DINAC-AE-D2 VAE.
The interface appears immediately and reports model loading and pytorch dynamo compilation
progress.
During sampling, each output slot receives asynchronous previews from the
bundled one-eighth-scale latent-RGB projection. Busy preview work is skipped,
so the sampler never waits for browser publication. The native one-eighth-size
preview is sent directly and scaled for display by the browser. The UI checkbox
below the size preset disables previews.
The negative prompt field appears when CFG or a contrastive-text PDG mode is
active. Blank negative text uses Canter's learned unconditional conditioning.
Downloaded PNG files contain the prompt, optional negative prompt, effective
per-image settings, Canter code version, and numbered checkpoint release as
JSON metadata.
The server listens on port 7860. To select the bind address explicitly:
```bash
python app.py --server-name 0.0.0.0 --server-port 7860
```
Use `--server-name 127.0.0.1` to restrict access to the local machine.
After package installation, the interface can also download and run the model
directly from Hugging Face:
```bash
canter-web --model data-archetype/canter --in-browser
```
Run `python app.py --help` or `canter-web --help` for model revision, weight
dtype, text backend, device, cache, and server options.
### Generate an image with Python
```python
from canter import CanterPipeline
pipe = CanterPipeline.from_pretrained("data-archetype/canter")
result = pipe(
"A weathered wooden boardwalk descending toward a rugged coastline "
"under a stormy sky"
)
result.image.save("canter.png")
```
The default configuration generates a 1216 by 832 image with seed 42, 50 ABM2
updates, a Beta(0.6, 0.6) schedule, PDG 2.5, and image self-attention gain
-0.03. The selected text backend is compiled during model loading.
See [API and inference parameters](API.md) for configuration examples,
guidance modes, solvers, schedules, output types, and loading options.
## Example gallery
See the [example gallery](GALLERY.md).
## Limitations
The model has more limited knowledge than larger models. Some concepts may be
unknown or undertrained, especially uncommon subjects and specialist domains.
Text rendering is currently undertrained and unreliable.
The model has been trained almost exclusively on photographs. It has seen
limited artwork outside a few thousand classical paintings, so results for
illustration and other non-photographic styles may be weak or inconsistent.
## Responsible use
The model and its outputs are provided without guarantees of accuracy,
suitability, or safety. Users are responsible for reviewing generated content
and complying with applicable laws, privacy obligations, and third-party
rights.
## Releases
The installed package supplies the inference code. Remote loading without a
revision uses the checkpoint pinned by that package:
```python
pipe = CanterPipeline.from_pretrained("data-archetype/canter")
```
Select an immutable older checkpoint while retaining the installed code:
```python
pipe = CanterPipeline.from_pretrained(
"data-archetype/canter",
revision="v0001",
)
```
The web interface supports the same separation:
```bash
canter-web \
--model data-archetype/canter \
--revision v0001 \
--in-browser
```
Running `app.py` from a tagged standalone download intentionally uses the code
bundled with that historical snapshot. Use the installed `canter-web` command
as above when testing old weights with current code.
Release tags follow the `v0001`, `v0002`, and later numbering scheme. Optional
full-float32 releases use tags such as `v0001-fp32`.
See the [release table and update instructions](RELEASES.md).
## Documentation
- [Example gallery](GALLERY.md)
- [API and inference parameters](API.md)
- [Technical report](TECHNICAL_REPORT.md)
- [Releases](RELEASES.md)
- [Attribution](ATTRIBUTION.md)
## Citation
```bibtex
@misc{canter,
title = {Canter: An Efficient, Photography-Oriented Text-to-Image Model},
author = {data-archetype},
email = {data-archetype@proton.me},
year = {2026},
month = jul,
url = {https://huggingface.co/data-archetype/canter},
}
```
## License
The original weights, architecture, model-specific code, and
documentation are licensed under the ModelGo Attribution-ShareAlike License
2.0 (`MG-BY-SA-2.0`). Commercial use, modification, redistribution, and hosted
use are permitted subject to its attribution, source-disclosure, and
share-alike conditions. Distributions must retain `NOTICE`.
The bundled SmolLM2 subset remains under Apache License 2.0. See
`LICENSE-APACHE-2.0` and [Attribution](ATTRIBUTION.md). DINAC-AE-D2 remains
under the license published in its own repository.