Model reference · open weights

CoTyle

Image Kwai-Kolors Text→image 1 build Open weights 21 dl/mo

CoTyle is an open-weight image model from Kwai-Kolors. CoTyle (BF16) weighs 56.6 GB; the smallest configuration that runs it is H100 80 GB.

  • CoTyle is a 20.4B parameter text-to-image model developed by Kwai-Kolors that generates images with consistent visual styles conditioned on numerical style codes.
  • It is the first open-source method for code-to-style image generation, using a discrete style codebook to guide a diffusion model.
  • The model is released under the apache-2.0 license.

Summary of the Kwai-Kolors/CoTyle model card, 2026-10-01

What it is

Released byKwai-Kolors
Released2025-10-15
Parameters20.4B
VRAM56.6 GB for the weights

What it runs on

Memory and cards for CoTyle (BF16)

56.6 GBweights, file size
40.9 GBbiggest part
5.0 GBworking memory, one 1024² image
537 MBruntime overhead
CardOne imageMemory
RTX 3060 12 GB … L40S 48 GBdoes not fit
A100 80 GBfits78.2 GB
H100 80 GBfits78.1 GB
RTX PRO 6000 Blackwell 96 GBfits93.8 GB
DGX Spark (GB10) 128 GB unifiedfits107 GB
H200 141 GBfits138 GB
B200 180 GBfits176 GB

From the model card

What Kwai-Kolors says about CoTyle

Read the model card

This repository offers the official code of the paper "A Style is Worth One Code: Unlocking Code-to-Style Image Generation with Discrete Style Space". We provide both an Open-Source Version (based on Qwen-Image) and a Commercial Version (based on Kolors). If you are a professional developer and interested in further developing the CoTyle Open-Source Version, please follow the tutorial below. The Commercial Version is coming soon.

class="center">

🔥 News

  • [11/18/2025] The demo of CoTyle is released on Hugging Face.
  • [11/18/2025] The weights of CoTyle are released on Hugging Face.
  • [11/18/2025] The code is released!
  • [11/18/2025] The homepage of CoTyle is released.
  • [11/14/2025] The paper of CoTyle is released.

📝 ToDo

  • [x] Publish the paper on Arxiv.
  • [x] Release the homepage of CoTyle.
  • [x] Launch a free demo on Hugging Face Spaces of CoTyle.
  • [x] Open source the code and model weights of CoTyle.
  • [ ] Release the commercial version of CoTyle.

📖 Abstract

Innovative visual stylization is a cornerstone of artistic creation, yet generating novel and consistent visual styles remains a significant challenge. Existing generative approaches typically rely on lengthy textual prompts, reference images, or parameter-efficient fine-tuning to guide style-aware image synthesis, but often struggle with style consistency, limited novelty, and complex style representations. In this paper, we affirm that a style is worth one numerical code by introducing the novel task, code-to-style image generation, which produces images with novel, consistent visual styles conditioned solely on a numerical style code. To date, this field has only been primarily explored by the industry (e.g., Midjourney), with no open-source research from the academic community. To fill this gap, we propose CoTyle, the first open-source method for this task. Specifically, we first train a discrete style codebook from a collection of images to extract style embeddings. These embeddings are used to condition a text-to-image diffusion model (T2I-DM) for style-consistent generation. Subsequently, we train an autoregressive transformer on the quantized style codes to model their distribution, allowing the synthesis of novel style codes. During inference, a numerical code maps to a unique style sequence, which guides the diffusion process to produce images in the corresponding style. Unlike existing methods, our approach offers unparalleled simplicity and diversity, unlocking a vast space of reproducible styles from minimal input. Extensive experiments validate that CoTyle effectively turns a numerical code into a style controller, demonstrating a style is worth one code.

⚡️ Quick Start

🔧 Requirements and Installation

Run the following command to install the requirements.

git clone https://github.com/Kwai-Kolors/CoTyle
cd CoTyle
conda create -n cotyle python=3.10
conda activate cotyle
pip install torch==2.6.0 torchvision==0.21.0
pip install -e git+https://github.com/Lakonik/piFlow.git@b1ef16e5e305251bccdfeac2a0e3d0ef339b974a#egg=lakonlab --no-build-isolation
pip install -r requirements.txt
# After running, some dependency errors may appear (don’t meet lakonlab’s requirements).
# This is normal and can be ignored.

⏬ Download

Please download the checkpoints and put them to the ./pretrained_models directory. You can download them from Hugging Face.

git lfs install
git clone https://huggingface.co/Kwai-Kolors/CoTyle
mv CoTyle pretrained_models

🚄 Code-to-Style Generation

For a quick walkthrough of the inference pipeline, we recommend generating a single image (see Single-Sample Generation). To intuitively experience the powerful capabilities of CoTyle, we recommend generating a batch of images (see Batch-Sample Generation), which by default produces 42 images (7 style codes × 6 prompts).

Batch-Samples Generation

Run the following command to generate a batch of images. By default, 7 rows and 6 columns of images will be generated, where all images in each row are produced using the same style code, and all images in each column are generated using the same prompt. You can adjust the --style_code and the content in ./test_prompts.txt to obtain the desired outputs.

This process may take considerable time. Therefore, we provide an accelerated version based on piFlow, which requires only 4 denoising steps; however, this approach produces lower image quality. Enable --accelerate to activate piFlow.

python inference_batch.py --model_path ./pretrained_models \
  --style_code 1234567 5201314 13415926 886 20010627 996007 2333 \
  --prompt_file_path ./test_prompts.txt \
  --output_path outputs \
  --seed 1024 \
  --accelerate

If time permits, we strongly recommend executing the command below.

python inference_batch.py --model_path ./pretrained_models \
  --style_code 1234567 5201314 13415926 886 20010627 996007 2333 \
  --prompt_file_path ./test_prompts.txt \
  --output_path outputs \
  --seed 1024 \

After successful execution, you will obtain the following results: class="center">

Single-Sample Generation

Execute the following code for single-sample inference. You can generate desired results by adjusting the --style_code and --prompt.

python inference.py --model_path ./pretrained_models \
  --style_code 1234567 \
  --prompt "A lovely crystal snake spirit, slender and nimble, wears an exquisite crystal crown atop its head. Its scales are translucent, shimmering like crystal, its eyes are bright and round, and its expression is lively. Its body coils naturally, its tail gracefully curved, its overall posture harmonious and beautiful

Quoted from the model card on Hugging Face. The full card is behind the Hugging Face link above.

Running it yourself

Run it on a rented GPU

Rent a machine by the hour. Runs as it is with diffusers, on the machine, in Python.

# on your rented machine: pip install diffusers transformers accelerate
import torch
from diffusers import DiffusionPipeline

pipe = DiffusionPipeline.from_pretrained("Kwai-Kolors/CoTyle", torch_dtype=torch.bfloat16).to("cuda")
image = pipe(prompt="a red bicycle on a cobbled street").images[0]
image.save("/workspace/out.png")
Renting a GPU: connect, tunnels, Python
© 2026 AxForge · EU-hosted AI infrastructure Pricing Docs Trust Privacy Terms