Practical overview
When it fits
Use TokenCompose when you want to investigate or prototype token-level supervision during diffusion-model training, particularly for multi-category instance composition.
Who it is for
- Researchers studying token-level objectives for text-to-image diffusion.
- Developers prototyping diffusion-model training workflows using the repository's code and example data.
Documented uses
- Set up an environment for the TokenCompose training code.
- Prepare COCO images and token-wise grounded segmentation maps for the example workflow.
- Train a diffusion model using token-level objectives and save results locally.
Requirements & limits
- The documented example uses Python 3.8.5, PyTorch 1.13.1 and CUDA 11.7.
- Training with the example data requires both COCO train2017 images and token-wise grounded segmentation maps.
- The README instructs users to log in to Weights & Biases before training to record curves and visualizations.
- The repository is licensed under Apache-2.0.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Set up the documented COCO training data
Prepare COCO train2017 images and token-wise grounded segmentation maps in the repository's training data directory.
Before you start
- A local checkout of the TokenCompose repository.
- COCO train2017 image archive.
- The project's COCO segmentation data archive from the linked Google Drive file.
Steps
From train/data, download and unzip COCO train2017, then run bash coco_data_setup.sh.
Place the downloaded COCO segmentation archive under train/data.
From train/data, extract it with tar -xvf coco_gsam_seg.tar.
Expected outcome
The README describes image files under train/data/coco_gsam_img/train and token-wise segmentation masks under train/data/coco_gsam_seg.
Guide limitations
- This guide covers only the example COCO data setup, not model training.
- For custom data, the README directs users to the separate preprocess_data guide.
Set up the TokenCompose training environment
Create the Python and PyTorch environment specified by the repository before proceeding to its data and training instructions.
Before you start
- Conda.
- The TokenCompose repository and its requirements.txt file.
Steps
Create and activate a Conda environment using Python 3.8.5.
Install PyTorch 1.13.1, torchvision 0.14.1, torchaudio 0.13.1 and pytorch-cuda 11.7 from the PyTorch and NVIDIA channels.
Install the packages listed in requirements.txt.
Expected outcome
The README provides a project environment specification for continuing to the separate dataset setup and training stages.
Guide limitations
- The documented versions are the specific versions used to verify environment setup; the README says newer versions are expected to work, but does not specify them.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 17 October 2026
- Original website title
- mlpc-ucsd/TokenCompose · Official homepage title · retained in its source language

