← Open Source
yeungchenwa

FontDiffuser

[AAAI2024] FontDiffuser: One-Shot Font Generation via Denoising Diffusion with Multi-Scale Content Aggregation and Style Contrastive Learning.

Model DevelopmentArchitecturePython
Open on GitHub
Momentum
+1stars in 24 hours+0.2%
572
Stars
59
Forks
+5
This week
1
Contributors
Created 2023-12-09 · Updated 2026-10-15 · #6710 today
Top developers

yeungchenwa/FontDiffuser is ranked 6,710 with 572 stars.

Same-category comparison

yeungchenwa/FontDiffuser is ranked 6,710 among these 8 peers; shootthesound/comfyUI-Realtime-Lora is ranked 6,709.

Same-category comparison
NameRankMetrics
Junjue-Wang/LoveDA6,688
Language:
Python
Stars:
580
Forks:
67
Description:
[NeurIPS 2021] LoveDA: A Remote Sensing Land-Cover Dataset for Domain Adaptive Semantic Segmentation.
facebookresearch/spider6,700
Language:
Python
Stars:
574
Forks:
65
Description:
A general physic-based retargeting framework.
NVlabs/GRAIL6,706
Language:
Python
Stars:
572
Forks:
44
Description:
🤖 GRAIL is a fully digital data-generation pipeline that synthesizes humanoid loco-manipulation data from 3D assets and world models. – 🌟 CoRL 2026 (Oral).
shootthesound/comfyUI-Realtime-Lora6,709
Language:
Python
Stars:
572
Forks:
40
Description:
Train and block edit and save LoRAs directly inside ComfyUI for Z-image, Flux Klein, SDXL, Flux, WAN 2.2, SD 1.5.
TsinghuaC3I/MARTI6,714
Language:
Python
Stars:
570
Forks:
50
Description:
[ICLR 2026] A Framework for LLM-based Multi-Agent Reinforced Training and Inference.
google-deepmind/tracr6,715
Language:
Python
Stars:
570
Forks:
52
albumentations-team/AlbumentationsX6,721
Language:
Python
Stars:
568
Forks:
43
Description:
Image augmentation for computer vision. AGPL-3.0-only or commercial licensing.
young-how/DQN-based-UAV-3D_path_planer6,723
Language:
Python
Stars:
567
Forks:
57
Description:
RLGF is a general training framework suitable for UAV deep reinforcement learning tasks. And integrates multiple mainstream deep reinforcement learning algorithms(SAC, DQN, DDQN, PPO, Dueling DQN, DDPG).
Key parameters and specifications
Key parameters and specifications
ParameterValue
LanguagePython
CategoryModel Development
SubcategoryArchitecture
KeywordsDesign, Diffusion
Stars572
Forks59
Contributors1
Created date2023-12-09
Updated date2026-10-15
Stars in 1 day1
Stars in 7 days5
Rank6,710
Previous rank6,878
Rank change168
7-day stars rank5,782
Previous 7-day stars rank6,467
7-day stars rank change685
Total stars rank17,417
Previous total stars rank17,420
Total stars rank change3
CountryChina
README summary

FontDiffuser: One-Shot Font Generation via Denoising Diffusion with Multi-Scale Content Aggregation and Style Contrastive Learning 🔥 Model Zoo • 🛠️ Installation • 🏋️ Training • 📺 Sampling • 📱 Run WebUI 🌟 Highlights We propose **FontDiffuser**, which can generate unseen characters and styles and can be extended to cross-lingual generation, such as Chinese to Korean. **FontDiffuser** excels in generating complex characters and handling large style variations. And it achieves state-of-the-art performance. The generated results by **FontDiffuser** can be perfectly used for **InstructPix2Pix** for decoration

, as shown in thr above figure. We release the 💻Hugging Face Demo online! 27**: The training of phase 2 is released. 19**: 🔥🎉 The 💻Hugging Face Demo is public! 10**: Release source code with phase 1 training and sampling. 09**: 🎉🎉 Our paper is accepted by AAAI2024. **Previously**: Our Recommendations-of-Diffusion-for-Text-Image repo is public, which contains a paper collection of recent diffusion models for text-image generation tasks. [x] Add phase 2 training script and checkpoint. 🛠️ Installation Prerequisites

(Recommended) Linux Python 3. 7 Environment Setup Clone this repo: **Step 0**: Download and install Miniconda from the official website. **Step 1**: Create a conda environment and activate it. **Step 2**: Install related version Pytorch following here. **Step 3**: Install the required packages. 🏋️ Training Data Construction The training data files tree should be (The data examples are shown in directory ): Training Configuration Before running the training script (including the following three modes), you should set the training configuration, such as

distributed training, through: Training - Pretraining of SCR Training - Phase 1 : The data root, as : The training output logs and checkpoints saving directory. : The resolution of the UNet in our diffusion model. : The resolution of the style image, can be different with . : The resolution of the content image, should be the same as the . : Whether to use the channel attention in the MCA block. : The checkpoint saving interval when training. : The classifier-free guidance training probability. Training - Phase 2 After the

phase 2 training, you should put the trained checkpoint files ( , , and ) to the directory . During phase 2, these parameters will be resumed. : The model checkpoints saving directory after phase 1 training. : The ckpt path of pre-trained SCR module. You can download it from above 🔥Model Zoo. : The coefficient of style contrastive loss for supervision. : The number of negative samples, default to be . 📺 Sampling Step 1 => Prepare the checkpoint Option (1) Download the checkpoint following GoogleDrive / BaiduYun:gexg, then put

the to the root directory, including the files , , and . Option (2) Put your re-training checkpoint folder to the root directory, including the files , , and . Step 2 => Run the script **(1) Sampling image from content image and reference image. ** : The model checkpoints saving directory. : The image saving directory, the saving files including an and an . : The sampling device, recommended GPU acceleration. : The classifier-free sampling guidance scale. **(2) Sampling image from content character. ** **Note** Maybe you need a ttf file

that contains numerous Chinese characters, you can download it from BaiduYun:wrth. : If set , use character string as content/source

Frequently asked questions

How many stars and forks are recorded?

yeungchenwa/FontDiffuser has 572 stars and 59 forks.

What is the repository rank?

yeungchenwa/FontDiffuser is ranked 6,710.

What language and category are recorded?

yeungchenwa/FontDiffuser has 572 stars, uses Python and belongs to Model Development.

Which repository is closest in rank?

yeungchenwa/FontDiffuser is compared with shootthesound/comfyUI-Realtime-Lora, ranked 6,709 with 572 stars.

README

FontDiffuser: One-Shot Font Generation via Denoising Diffusion with Multi-Scale Content Aggregation and Style Contrastive Learning

🔥 Model Zoo • 🛠️ Installation • 🏋️ Training • 📺 Sampling • 📱 Run WebUI

🌟 Highlights

  • We propose FontDiffuser, which can generate unseen characters and styles and can be extended to cross-lingual generation, such as Chinese to Korean.
  • FontDiffuser excels in generating complex characters and handling large style variations. And it achieves state-of-the-art performance.
  • The generated results by FontDiffuser can be perfectly used for InstructPix2Pix for decoration, as shown in thr above figure.
  • We release the 💻Hugging Face Demo online! Welcome to Try it Out!

📅 News

  • 2024.01.27: The training of phase 2 is released.
  • 2023.12.20: Our repository is public! 👏🤗
  • 2023.12.19: 🔥🎉 The 💻Hugging Face Demo is public! Welcome to try it out!
  • 2023.12.16: The gradio app demo is released.
  • 2023.12.10: Release source code with phase 1 training and sampling.
  • 2023.12.09: 🎉🎉 Our paper is accepted by AAAI2024.
  • Previously: Our Recommendations-of-Diffusion-for-Text-Image repo is public, which contains a paper collection of recent diffusion models for text-image generation tasks. Welcome to check it out!

🔥 Model Zoo

Model chekcpoint status
FontDiffuer GoogleDrive / BaiduYun:gexg Released
SCR GoogleDrive / BaiduYun:gexg Released

🚧 TODO List

  • [x] Add phase 1 training and sampling script.
  • [x] Add WebUI demo.
  • [x] Push demo to Hugging Face.
  • [x] Add phase 2 training script and checkpoint.
  • [ ] Add the pre-training of SCR module.
  • [ ] Combined with InstructPix2Pix.

🛠️ Installation

Prerequisites (Recommended)

  • Linux
  • Python 3.9
  • Pytorch 1.13.1
  • CUDA 11.7

Environment Setup

Clone this repo:

git clone https://github.com/yeungchenwa/FontDiffuser.git

Step 0: Download and install Miniconda from the official website.

Step 1: Create a conda environment and activate it.

conda create -n fontdiffuser python=3.9 -y
conda activate fontdiffuser

Step 2: Install related version Pytorch following here.

# Suggested
pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu117

Step 3: Install the required packages.

pip install -r requirements.txt

🏋️ Training

Data Construction

The training data files tree should be (The data examples are shown in directory data_examples/train/):

├──data_examples
│   └── train
│       ├── ContentImage
│       │   ├── char0.png
│       │   ├── char1.png
│       │   ├── char2.png
│       │   └── ...
│       └── TargetImage.png
│           ├── style0
│           │     ├──style0+char0.png
│           │     ├──style0+char1.png
│           │     └── ...
│           ├── style1
│           │     ├──style1+char0.png
│           │     ├──style1+char1.png
│           │     └── ...
│           ├── style2
│           │     ├──style2+char0.png
│           │     ├──style2+char1.png
│           │     └── ...
│           └── ...

Training Configuration

Before running the training script (including the following three modes), you should set the training configuration, such as distributed training, through:

accelerate config

Training - Pretraining of SCR

Coming Soon ...

Training - Phase 1

sh train_phase_1.sh
  • data_root: The data root, as ./data_examples
  • output_dir: The training output logs and checkpoints saving directory.
  • resolution: The resolution of the UNet in our diffusion model.
  • style_image_size: The resolution of the style image, can be different with resolution.
  • content_image_size: The resolution of the content image, should be the same as the resolution.
  • channel_attn: Whether to use the channel attention in the MCA block.
  • train_batch_size: The batch size in the training.
  • max_train_steps: The maximum of the training steps.
  • learning_rate: The learning rate when training.
  • ckpt_interval: The checkpoint saving interval when training.
  • drop_prob: The classifier-free guidance training probability.

Training - Phase 2

After the phase 2 training, you should put the trained checkpoint files (unet.pth, content_encoder.pth, and style_encoder.pth) to the directory phase_1_ckpt. During phase 2, these parameters will be resumed.

sh train_phase_2.sh
  • phase_2: Tag to phase 2 training.
  • phase_1_ckpt_dir: The model checkpoints saving directory after phase 1 training.
  • scr_ckpt_path: The ckpt path of pre-trained SCR module. You can download it from above 🔥Model Zoo.
  • sc_coefficient: The coefficient of style contrastive loss for supervision.
  • num_neg: The number of negative samples, default to be 16.

📺 Sampling

Step 1 => Prepare the checkpoint

Option (1) Download the checkpoint following GoogleDrive / BaiduYun:gexg, then put the ckpt to the root directory, including the files unet.pth, content_encoder.pth, and style_encoder.pth.
Option (2) Put your re-training checkpoint folder ckpt to the root directory, including the files unet.pth, content_encoder.pth, and style_encoder.pth.

Step 2 => Run the script

(1) Sampling image from content image and reference image.

sh script/sample_content_image.sh
  • ckpt_dir: The model checkpoints saving directory.
  • content_image_path: The content/source image path.
  • style_image_path: The style/reference image path.
  • save_image: set True if saving as images.
  • save_image_dir: The image saving directory, the saving files including an out_single.png and an out_with_cs.png.
  • device: The sampling device, recommended GPU acceleration.
  • guidance_scale: The classifier-free sampling guidance scale.
  • num_inference_steps: The inference step by DPM-Solver++.

(2) Sampling image from content character.
Note Maybe you need a ttf file that contains numerous Chinese characters, you can download it from BaiduYun:wrth.

sh script/sample_content_character.sh
  • character_input: If set True, use character string as content/source input.
  • content_character: The content/source content character string.
  • The other parameters are the same as the above option (1).

📱 Run WebUI

(1) Sampling by FontDiffuser

gradio gradio_app.py

Example:

(2) Sampling by FontDiffuser and Rendering by InstructPix2Pix

Coming Soon ...

🌄 Gallery

Characters of hard level of complexity

Characters of medium level of complexity

Characters of easy level of complexity

Cross-Lingual Generation (Chinese to Korean)

💙 Acknowledgement

Copyright

Citation

@inproceedings{yang2024fontdiffuser,
  title={FontDiffuser: One-Shot Font Generation via Denoising Diffusion with Multi-Scale Content Aggregation and Style Contrastive Learning},
  author={Yang, Zhenhua and Peng, Dezhi and Kong, Yuxin and Zhang, Yuyi and Yao, Cong and Jin, Lianwen},
  booktitle={Proceedings of the AAAI conference on artificial intelligence},
  year={2024}
}

⭐ Star Rising

Nearby in the ranking
Similar items