← Open Source
AMAP-ML

FluxText

Implementation of "FLUX-Text: A Simple and Advanced Diffusion Transformer Baseline for Scene Text Editing".

ModelsVision modelsDomain-specific modelsPython
Open on GitHub
Momentum
+0stars in 24 hours0.0%
924
Stars
33
Forks
+1
This week
0
Contributors
Created 2025-06-20 · Updated 2026-10-11 · #12602 today

AMAP-ML/FluxText is ranked 12,602 with 924 stars.

Same-category comparison

AMAP-ML/FluxText is ranked 12,602 among these 8 peers; instadeepai/nucleotide-transformer is ranked 12,594.

Same-category comparison
NameRankMetrics
nathanrs/tiny-diffusion12,582
Language:
Python
Stars:
929
Forks:
90
Description:
A character-level language diffusion model trained on Tiny Shakespeare.
facebookresearch/spiritlm12,587
Language:
Python
Stars:
928
Forks:
63
Description:
Inference code for the paper "Spirit-LM Interleaved Spoken and Written Language Model".
NVlabs/FasterViT12,592
Language:
Python
Stars:
926
Forks:
72
Description:
[ICLR 2024] Official PyTorch implementation of FasterViT: Fast Vision Transformers with Hierarchical Attention.
instadeepai/nucleotide-transformer12,594
Language:
Jupyter Notebook
Stars:
926
Forks:
103
Description:
Foundation Models for Genomics & Transcriptomics.
facebookresearch/mobile-vision12,613
Language:
Python
Stars:
922
Forks:
168
Description:
Mobile vision models and code.
Vchitect/Vchitect-2.012,621
Language:
Python
Stars:
921
Forks:
22
Description:
Vchitect-2.0: Parallel Transformer for Scaling Up Video Diffusion Models.
360CVGroup/FancyVideo12,628
Language:
Python
Stars:
920
Forks:
51
Description:
Video generation from text&image, 1st-gen.
huggingface/torchMoji12,636
Language:
Python
Stars:
920
Forks:
185
Description:
😇A pyTorch implementation of the DeepMoji model: state-of-the-art deep learning model for analyzing sentiment, emotion, sarcasm etc.
Key parameters and specifications
Key parameters and specifications
ParameterValue
LanguagePython
CategoryModels
SubcategoryVision models, Domain-specific models
KeywordsImage production, Multimodal, OCR
Stars924
Forks33
Contributors0
Created date2025-06-20
Updated date2026-10-11
Stars in 1 day0
Stars in 7 days1
Rank12,602
Previous rank12,519
Rank change-83
7-day stars rank10,433
Previous 7-day stars rank10,484
7-day stars rank change51
Total stars rank11,821
Previous total stars rank11,799
Total stars rank change-22
CountryChina
README summary

Implementation of FLUX-Text FLUX-Text: A Simple and Advanced Diffusion Transformer Baseline for Scene Text Editing *Rui Lan 1 , Yancheng Bai 1 , Xu Duan 1 , Mingxing Li 1 , Dongyang Jin 1 , Ryan Xu 1 , Dong Nie 2 , Lei Sun 1 , Xiangxiang Chu 1 * 1 ALibaba Group 2 University of North Carolina at Chapel Hill 📖 Overview **Motivation:** Scene text editing is a challenging task that aims to modify or add text in images while maintaining the fidelity of newly generated

text and visual coherence with the background. The main challenge of this task is that we need to edit multiple line texts with diverse language attributes (e. , fonts, sizes, and styles), language types (e. , English, Chinese), and visual scenarios (e. **Contribution:** We propose FLUX-Text, a novel text editing framework for editing multi-line texts in complex visual scenes. By incorporating a lightweight Condition Injection LoRA module, Regional text perceptual loss, and two-stage training strategy, we significantly significant improvements

on both Chinese and English benchmarks. News **2025-07-16**: 🔥 Update comfyui node. We have decoupled the FLUX-Text node to support the use of more basic nodes. Due to differences in node computation in ComfyUI, if you need more consistent results, you should set min_length to 512 in the code. **2025-07-13**: 🔥 The training code has been updated. The code now supports multi-scale training. **2025-07-13**: 🔥 Update the low-VRAM version of the Gradio demo

, which It currently requires 25GB of VRAM to run. Looking forward to more efficient, lower-memory solutions from the community. **2025-07-08**: 🔥 ComfyUI Node is supported! You can now build an workflow based on FLUX-Text for editing posters. It is definitely worth trying to set up a workflow to automatically enhance product image service information and service scope. Meanwhile, utilizing the first and last frames enables the creation of video data with text effects. Thanks to the community

work, FLUX-Text was run on 8GB VRAM. **2025-07-04**: 🔥 We have released gradio demo! **2025-07-03**: 🔥 We have released our pre-trained checkpoints on Hugging Face! You can now try out FLUX-Text with the official weights. **2025-06-26**: ⭐️ Inference and evaluate code are released. Once we have ensured that everything is functioning correctly, the new model will be merged into this repository. - [x] Training code 🛠️ Installation We recommend using Python 3. To set up the

environment: 🤗 Model Introduction FLUX-Text is an open-source version of the scene text editing model. FLUX-Text can be used for editing posters, emotions, and more. The table below displays the list of text editing models we currently offer, along with their foundational information. 🔥 ComfyUI Installing via GitHub First, install and set up ComfyUI, and then follow these steps: 1. **Integrate FluxText Comfy Nodes with ComfyUI**: **Symbolic Link (Recommended)**: **Copy Directory**: 🔥 Quick Start Here's a basic example of using

FLUX-Text: 🤗 gradio You can upload the glyph image and mask image to edit text region. Or you can use

Frequently asked questions

How many stars and forks are recorded?

AMAP-ML/FluxText has 924 stars and 33 forks.

What is the repository rank?

AMAP-ML/FluxText is ranked 12,602.

What language and category are recorded?

AMAP-ML/FluxText has 924 stars, uses Python and belongs to Models.

Which repository is closest in rank?

AMAP-ML/FluxText is compared with instadeepai/nucleotide-transformer, ranked 12,594 with 926 stars.

README

Implementation of FLUX-Text

FLUX-Text: A Simple and Advanced Diffusion Transformer Baseline for Scene Text Editing

Rui Lan1, Yancheng Bai1, Xu Duan1, Mingxing Li1, Dongyang Jin1, Ryan Xu1, Dong Nie2, Lei Sun1, Xiangxiang Chu1

1ALibaba Group 2University of North Carolina at Chapel Hill

📖 Overview

  • Motivation: Scene text editing is a challenging task that aims to modify or add text in images while maintaining the fidelity of newly generated text and visual coherence with the background. The main challenge of this task is that we need to edit multiple line texts with diverse language attributes (e.g., fonts, sizes, and styles), language types (e.g., English, Chinese), and visual scenarios (e.g., poster, advertising, gaming).
  • Contribution: We propose FLUX-Text, a novel text editing framework for editing multi-line texts in complex visual scenes. By incorporating a lightweight Condition Injection LoRA module, Regional text perceptual loss, and two-stage training strategy, we significantly significant improvements on both Chinese and English benchmarks.

News

  • 2025-07-16: 🔥 Update comfyui node. We have decoupled the FLUX-Text node to support the use of more basic nodes. Due to differences in node computation in ComfyUI, if you need more consistent results, you should set min_length to 512 in the code.

workflow/FLUX-Text-Basic-Workflow.json

  • 2025-07-13: 🔥 The training code has been updated. The code now supports multi-scale training.

  • 2025-07-13: 🔥 Update the low-VRAM version of the Gradio demo, which It currently requires 25GB of VRAM to run. Looking forward to more efficient, lower-memory solutions from the community.

  • 2025-07-08: 🔥 ComfyUI Node is supported! You can now build an workflow based on FLUX-Text for editing posters. It is definitely worth trying to set up a workflow to automatically enhance product image service information and service scope. Meanwhile, utilizing the first and last frames enables the creation of video data with text effects. Thanks to the community work, FLUX-Text was run on 8GB VRAM.

workflow/FLUX-Text-Workflow.json

original image

edited image

original image

edited image

last frame

video

  • 2025-07-04: 🔥 We have released gradio demo! You can now try out FLUX-Text.

Example 1

Example 2

  • 2025-07-03: 🔥 We have released our pre-trained checkpoints on Hugging Face! You can now try out FLUX-Text with the official weights.

  • 2025-06-26: ⭐️ Inference and evaluate code are released. Once we have ensured that everything is functioning correctly, the new model will be merged into this repository.

Todo List

    • [x] Inference code
    • [x] Pre-trained weights
    • [x] Gradio demo
    • [x] ComfyUI
    • [x] Training code

🛠️ Installation

We recommend using Python 3.10 and PyTorch with CUDA support. To set up the environment:

# Create a new conda environment
conda create -n flux_text python=3.10
conda activate flux_text

# Install other dependencies
pip install -r requirements.txt
pip install flash_attn --no-build-isolation
pip install Pillow==9.5.0

🤗 Model Introduction

FLUX-Text is an open-source version of the scene text editing model. FLUX-Text can be used for editing posters, emotions, and more. The table below displays the list of text editing models we currently offer, along with their foundational information.

Model Name

Image Resolution

Memory Usage

English Sen.Acc

Chinese Sen.Acc

Download Link

FLUX-Text-512

512*512

34G

0.8419

0.7132

🤗 HuggingFace

FLUX-Text

Multi Resolution

34G for (512*512)

0.8228

0.7161

🤗 HuggingFace

🔥 ComfyUI

Installing via GitHub

First, install and set up ComfyUI, and then follow these steps:

  1. Clone FLUXText Repository:

    git clone https://github.com/AMAP-ML/FluxText.git
    
  2. Install FluxText:

    cd FluxText && pip install -r requirements.txt
    
  3. Integrate FluxText Comfy Nodes with ComfyUI:

    • Symbolic Link (Recommended):
      ln -s $(pwd)/ComfyUI-fluxtext path/to/ComfyUI/custom_nodes/
      
    • Copy Directory:
      cp -r ComfyUI-fluxtext path/to/ComfyUI/custom_nodes/
      

🔥 Quick Start

Here's a basic example of using FLUX-Text:

import numpy as np
from PIL import Image
import torch
import yaml

from src.flux.condition import Condition
from src.flux.generate_fill import generate_fill
from src.train.model import OminiModelFIll
from safetensors.torch import load_file

config_path = ""
lora_path = ""
with open(config_path, "r") as f:
    config = yaml.safe_load(f)
model = OminiModelFIll(
        flux_pipe_id=config["flux_path"],
        lora_config=config["train"]["lora_config"],
        device=f"cuda",
        dtype=getattr(torch, config["dtype"]),
        optimizer_config=config["train"]["optimizer"],
        model_config=config.get("model", {}),
        gradient_checkpointing=True,
        byt5_encoder_config=None,
    )

state_dict = load_file(lora_path)
state_dict_new = {x.replace('lora_A', 'lora_A.default').replace('lora_B', 'lora_B.default').replace('transformer.', ''): v for x, v in state_dict.items()}
model.transformer.load_state_dict(state_dict_new, strict=False)
pipe = model.flux_pipe

prompt = "lepto college of education, the written materials on the picture: LESOTHO , COLLEGE OF , RE BONA LESELI LESEL , EDUCATION ."
hint = Image.open("assets/hint.png").resize((512, 512)).convert('RGB')
img = Image.open("assets/hint_imgs.jpg").resize((512, 512))
condition_img = Image.open("assets/hint_imgs_word.png").resize((512, 512)).convert('RGB')
hint = np.array(hint) / 255
condition_img = np.array(condition_img)
condition_img = (255 - condition_img) / 255
condition_img = [condition_img, hint, img]
position_delta = [0, 0]
condition = Condition(
                condition_type='word_fill',
                condition=condition_img,
                position_delta=position_delta,
            )
generator = torch.Generator(device="cuda")
res = generate_fill(
    pipe,
    prompt=prompt,
    conditions=[condition],
    height=512,
    width=512,
    generator=generator,
    model_config=config.get("model", {}),
    default_lora=True,
)
res.images[0].save('flux_fill.png')

🤗 gradio

You can upload the glyph image and mask image to edit text region. Or you can use manual edit to obtain glyph image and mask image.

first, download the model weight and config in HuggingFace

python app.py --model_path xx.safetensors --config_path config.yaml

💪🏻 Training

  1. Download training dataset AnyWord-3M from ModelScope, unzip all *.zip files in each subfolder, then open *.json and modify the data_root with your own path of imgs folder for each sub dataset.

  2. Replace the old annotations in AnyWord with the new annotations. Change the dataset annotations path and image_root in src/train/data_word.py.

json_paths = [
        ['dataset/Anyword/data_text_recog_glyph/Art/data-info.json', 'AnyWord-3M/ocr_data/Art/imgs/'],
        ['dataset/Anyword/data_text_recog_glyph/COCO_Text/data-info.json', 'AnyWord-3M/ocr_data/COCO_Text/imgs/'],
        ['dataset/Anyword/data_text_recog_glyph/icdar2017rctw/data-info.json', 'AnyWord-3M/ocr_data/icdar2017rctw/imgs'],
        ['dataset/Anyword/data_text_recog_glyph/LSVT/data-info.json', 'AnyWord-3M/ocr_data/LSVT/imgs'],
        ['dataset/Anyword/data_text_recog_glyph/mlt2019/data-info.json', 'AnyWord-3M/ocr_data/mlt2019/imgs/'],
        ['dataset/Anyword/data_text_recog_glyph/MTWI2018/data-info.json', 'AnyWord-3M/ocr_data/MTWI2018/imgs'],
        ['dataset/Anyword/data_text_recog_glyph/ReCTS/data-info.json', 'AnyWord-3M/ocr_data/ReCTS/imgs'],
        ['dataset/Anyword/data_text_recog_glyph/laion/data_v1.1-info.json', 'AnyWord-3M/laion/imgs'],
        ['dataset/Anyword/data_text_recog_glyph/wukong_1of5/data_v1.1-info.json', 'AnyWord-3M/wukong_1of5/imgs'],
        ['dataset/Anyword/data_text_recog_glyph/wukong_2of5/data_v1.1-info.json', 'AnyWord-3M/wukong_2of5/imgs'],
        ['dataset/Anyword/data_text_recog_glyph/wukong_3of5/data_v1.1-info.json', 'AnyWord-3M/wukong_3of5/imgs'],
        ['dataset/Anyword/data_text_recog_glyph/wukong_4of5/data_v1.1-info.json', 'AnyWord-3M/wukong_4of5/imgs'],
        ['dataset/Anyword/data_text_recog_glyph/wukong_5of5/data_v1.1-info.json', 'AnyWord-3M/wukong_5of5/imgs'],
        ]
  1. Download the ODM weights in HuggingFace and change odm_loss/modelpath in the config file.

  2. (Optional) Download the pretrained weight in HuggingFace and change reuse_lora_path in the config file.

  3. Run the training scripts. With 48GB of VRAM, you can train at 512×512 resolution with a batch size of 2 in LoRA rank 8.

bash train/script/train_word.sh

📊 Evaluation

For Anytext-benchmark, please set the config_path, model_path, json_path, output_dir in the eval/gen_imgs_anytext.sh and generate the text editing results.

bash eval/gen_imgs_anytext.sh

For Sen.ACC, NED, FID and LPIPS evaluation, use the scripts in the eval folder.

bash eval/eval_ocr.sh
bash eval/eval_fid.sh
bash eval/eval_lpips.sh

📈 Results

🌹 Acknowledgement

Our work is primarily based on OminiControl, AnyText, Open-Sora, Phantom. We are sincerely grateful for their excellent works.

📚 Citation

If you find our paper and code helpful for your research, please consider starring our repository ⭐ and citing our work ✏️.

@article{lan2025flux,
  title={Flux-text: A simple and advanced diffusion transformer baseline for scene text editing},
  author={Lan, Rui and Bai, Yancheng and Duan, Xu and Li, Mingxing and Jin, Dongyang and Xu, Ryan and Nie, Dong and Sun, Lei and Chu, Xiangxiang},
  journal={arXiv preprint arXiv:2505.03329},
  year={2025}
}
Nearby in the ranking
Similar items