[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-72543":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":8,"htmlUrl":8,"language":9,"languages":8,"totalLinesOfCode":8,"stars":10,"forks":11,"watchers":12,"openIssues":13,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":14,"stars7d":14,"stars30d":14,"stars90d":14,"forks30d":14,"starsTrendScore":14,"compositeScore":15,"rankGlobal":8,"rankLanguage":8,"license":16,"archived":17,"fork":17,"defaultBranch":18,"hasWiki":19,"hasPages":17,"topics":20,"createdAt":8,"pushedAt":8,"updatedAt":21,"readmeContent":22,"aiSummary":23,"trendingCount":14,"starSnapshotCount":14,"syncStatus":24,"lastSyncTime":25,"discoverSource":26},72543,"x-flux","XLabs-AI\u002Fx-flux","XLabs-AI",null,"Python",2232,160,31,106,0,28.62,"Apache License 2.0",false,"main",true,[],"2026-06-12 02:03:04","![FLUX Finetuning scripts](.\u002Fassets\u002Freadme\u002Fdark\u002Fheader-rev1.png)\n\n\u003Ca href='https:\u002F\u002Freplicate.com\u002Flucataco\u002Fflux-controlnet'>\u003Cimg src='https:\u002F\u002Freplicate.com\u002Flucataco\u002Fflux-controlnet\u002Fbadge'>\u003C\u002Fa>\n\nThis repository provides training scripts for [Flux model](https:\u002F\u002Fgithub.com\u002Fblack-forest-labs\u002Fflux) by Black Forest Labs. \u003Cbr\u002F>\n[XLabs AI](https:\u002F\u002Fgithub.com\u002FXLabs-AI) team is happy to publish fune-tuning Flux scripts, including:\n\n- **LoRA** 🔥\n- **ControlNet** 🔥\n[\u003Cimg src=\"https:\u002F\u002Fgithub.com\u002FXLabs-AI\u002Fx-flux\u002Fblob\u002Fmain\u002Fassets\u002Freadme\u002Flight\u002Fjoin-our-discord-rev1.png?raw=true\">](https:\u002F\u002Fdiscord.gg\u002FFHY2guThfy)\n\n# ComfyUI\n\n[See our github](https:\u002F\u002Fgithub.com\u002FXLabs-AI\u002Fx-flux-comfyui) for comfy ui workflows.\n![Example Picture 1](https:\u002F\u002Fgithub.com\u002FXLabs-AI\u002Fx-flux-comfyui\u002Fblob\u002Fmain\u002Fassets\u002Fimage1.png?raw=true)\n\n## Requirements\n1. Python >= 3.10\n2. PyTorch >= 2.1\n3. HuggingFace CLI is required to download our models: ```huggingface-cli login```\n# Installation Guide\n1. Clone our repo:\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002FXLabs-AI\u002Fx-flux.git\n```\n2. Create new virtual environment:\n```bash\npython3 -m venv xflux_env\nsource xflux_env\u002Fbin\u002Factivate\n```\n3. Install our dependencies by running the following command:\n```bash\npip install -r requirements.txt\n```\n\n# Training\n\nWe trained LoRA and ControlNet models using [DeepSpeed](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FDeepSpeed)! \u003Cbr\u002F>\nIt's available for 1024x1024 resolution!\n\n## Models\n\nWe trained **IP-Adapter**, **Canny ControlNet**, **Depth ControlNet**, **HED ControlNet** and **LoRA** checkpoints for [`FLUX.1 [dev]`](https:\u002F\u002Fgithub.com\u002Fblack-forest-labs\u002Fflux) \u003Cbr\u002F>\nYou can download them on HuggingFace:\n\n- [flux-ip-adapter](https:\u002F\u002Fhuggingface.co\u002FXLabs-AI\u002Fflux-ip-adapter)\n- [flux-controlnet-collections](https:\u002F\u002Fhuggingface.co\u002FXLabs-AI\u002Fflux-controlnet-collections)\n- [flux-controlnet-canny](https:\u002F\u002Fhuggingface.co\u002FXLabs-AI\u002Fflux-controlnet-canny)\n- [flux-RealismLora](https:\u002F\u002Fhuggingface.co\u002FXLabs-AI\u002Fflux-RealismLora)\n- [flux-lora-collections](https:\u002F\u002Fhuggingface.co\u002FXLabs-AI\u002Fflux-lora-collection)\n- [flux-furry-lora](https:\u002F\u002Fhuggingface.co\u002FXLabs-AI\u002Fflux-furry-lora)\n\nAlso, our models are avaiable at [civit.ai](https:\u002F\u002Fcivitai.com\u002Fuser\u002Fxlabs_ai)\n### LoRA\n\n```bash\naccelerate launch train_flux_lora_deepspeed.py --config \"train_configs\u002Ftest_lora.yaml\"\n```\n\n### ControlNet\n\n```bash\naccelerate launch train_flux_deepspeed_controlnet.py --config \"train_configs\u002Ftest_canny_controlnet.yaml\"\n```\n\n## Training Dataset\n\nDataset has the following format for the training process:\n\n```text\n├── images\u002F\n│    ├── 1.png\n│    ├── 1.json\n│    ├── 2.png\n│    ├── 2.json\n│    ├── ...\n```\n\n### Example `images\u002F*.json` file\n\nA `.json` file contains \"caption\" field with a text prompt.\n\n```json\n{\n    \"caption\": \"A figure stands in a misty landscape, wearing a mask with antlers and dark, embellished attire, exuding mystery and otherworldlines\"\n}\n```\n\n## Inference\n\nTo test our checkpoints, you can use several options:\n1. Launch adapters in ComfyUI with our workflows, [see our repo](https:\u002F\u002Fgithub.com\u002FXLabs-AI\u002Fx-flux-comfyui) for more details\n2. Use main.py script with CLI commands\n3. Use Gradio demo with simple UI\n\n### Gradio\nLaunch gradio as follows:\n```\npython3 gradio_demo.py --ckpt_dir model_weights\n```\nDefine `--ckpt_dir` as the folder location with the downloaded XLabs AI adapter weights (LoRAs, IP-adapter, ControlNets)\n### IP-Adapter\n```bash\npython3 main.py \\\n --prompt \"wearing glasses\" \\\n --ip_repo_id XLabs-AI\u002Fflux-ip-adapter --ip_name flux-ip-adapter.safetensors --device cuda --use_ip \\\n --width 1024 --height 1024 \\\n --timestep_to_start_cfg 1 --num_steps 25 \\\n --true_gs 3.5 --guidance 4 \\\n --img_prompt assets\u002Fexample_images\u002Fstatue.jpg\n```\n\n### LoRA\n![Example Picture 1](.\u002Fassets\u002Freadme\u002Fexamples\u002Fpicture-5-rev1.png)\nprompt: \"A girl in a suit covered with bold tattoos and holding a vest pistol, beautiful woman, 25 years old, cool, future fantasy, turquoise & light orange ping curl hair\"\n![Example Picture 2](.\u002Fassets\u002Freadme\u002Fexamples\u002Fpicture-6-rev1.png)\nprompt: \"A handsome man in a suit, 25 years old, cool, futuristic\"\n\n```bash\npython3 main.py \\\n --prompt \"A cute corgi lives in a house made out of sushi, anime\" \\\n --lora_repo_id XLabs-AI\u002Fflux-lora-collection \\\n --lora_name anime_lora.safetensors \\\n --use_lora --width 1024 --height 1024\n```\n![Example Picture 3](.\u002Fassets\u002Freadme\u002Fexamples\u002Fresult_14.png)\n\n\n```bash\npython3 main.py \\\n --use_lora --lora_weight 0.7 \\\n --width 1024 --height 768 \\\n --lora_repo_id XLabs-AI\u002Fflux-lora-collection \\\n --lora_name realism_lora.safetensors \\\n --guidance 4 \\\n --prompt \"contrast play photography of a black female wearing white suit and albino asian geisha female wearing black suit, solid background, avant garde, high fashion\"\n```\n![Example Picture 3](.\u002Fassets\u002Freadme\u002Fexamples\u002Fpicture-7-rev1.png)\n\n## Canny ControlNet V3\n```bash\npython3 main.py \\\n --prompt \"cyberpank dining room, full hd, cinematic\" \\\n --image input_canny1.png --control_type canny \\\n --repo_id XLabs-AI\u002Fflux-controlnet-canny-v3 \\\n --name flux-canny-controlnet-v3.safetensors \\\n --use_controlnet --model_type flux-dev \\\n --width 1024 --height 1024  --timestep_to_start_cfg 1 \\\n --num_steps 25 --true_gs 4 --guidance 4\n```\n![Example Picture 1](.\u002Fassets\u002Freadme\u002Fexamples\u002Fcanny_result1.png?raw=true)\n```bash\npython3 main.py \\\n --prompt \"handsome korean woman, full hd, cinematic\" \\\n --image input_canny2.png --control_type canny \\\n --repo_id XLabs-AI\u002Fflux-controlnet-canny-v3 \\\n --name flux-canny-controlnet-v3.safetensors \\\n --use_controlnet --model_type flux-dev \\\n --width 1024 --height 1024  --timestep_to_start_cfg 1 \\\n --num_steps 25 --true_gs 4 --guidance 4\n```\n![Example Picture 1](.\u002Fassets\u002Freadme\u002Fexamples\u002Fcanny_result2.png?raw=true)\n\n## Depth ControlNet V3\n```bash\npython3 main.py \\\n --prompt \"handsome man in balenciaga style, fashion\" \\\n --image input_depth1.png --control_type depth \\\n --repo_id XLabs-AI\u002Fflux-controlnet-depth-v3 \\\n --name flux-depth-controlnet-v3.safetensors \\\n --use_controlnet --model_type flux-dev \\\n --width 1024 --height 1024 --timestep_to_start_cfg 1 \\\n --num_steps 25 --true_gs 3.5 --guidance 3\n```\n![Example Picture 2](.\u002Fassets\u002Freadme\u002Fexamples\u002Fdepth_result1.png?raw=true)\n\n```bash\npython3 main.py \\\n --prompt \"a village in minecraft style, 3d, full hd\" \\\n --image input_depth2.png --control_type depth \\\n --repo_id XLabs-AI\u002Fflux-controlnet-depth-v3 \\\n --name flux-depth-controlnet-v3.safetensors \\\n --use_controlnet --model_type flux-dev \\\n --width 1024 --height 1024 --timestep_to_start_cfg 1 \\\n --num_steps 25 --true_gs 3.5 --guidance 3\n```\n![Example Picture 2](.\u002Fassets\u002Freadme\u002Fexamples\u002Fdepth_result2.png?raw=true)\n\n## HED ControlNet V3\n```bash\n python3 main.py \\\n --prompt \"A beautiful woman with white hair and light freckles, her neck area bare and visible\" \\\n --image input_hed1.png --control_type hed \\\n --repo_id XLabs-AI\u002Fflux-controlnet-hed-v3 \\\n --name flux-hed-controlnet-v3.safetensors \\\n --use_controlnet --model_type flux-dev \\\n --width 1024 --height 1024  --timestep_to_start_cfg 1 \\\n --num_steps 25 --true_gs 3.5 --guidance 4\n```\n![Example Picture 2](.\u002Fassets\u002Freadme\u002Fexamples\u002Fhed_result1.png?raw=true)\n\n## Low memory mode\n\nUse quantized version [Flux-dev-F8](https:\u002F\u002Fhuggingface.co\u002FXLabs-AI\u002Fflux-dev-fp8) to achieve lower VRAM usage (22 GB) with `--offload` and `--model_type flux-dev-fp8` settings:\n```bash\npython3 main.py \\\n --offload --model_type flux-dev-fp8 \\\n  --lora_repo_id XLabs-AI\u002Fflux-lora-collection --lora_name realism_lora.safetensors \\\n --guidance 4 \\\n --prompt \"A handsome girl in a suit covered with bold tattoos and holding a pistol\"\n```\n![Example Picture 0](.\u002Fassets\u002Freadme\u002Fexamples\u002Fpicture-0-rev1.png)\n\n## Accelerate Configuration Example\n\n```yaml\ncompute_environment: LOCAL_MACHINE\ndebug: false\ndeepspeed_config:\n  gradient_accumulation_steps: 2\n  gradient_clipping: 1.0\n  offload_optimizer_device: none\n  offload_param_device: none\n  zero3_init_flag: false\n  zero_stage: 2\ndistributed_type: DEEPSPEED\ndowncast_bf16: 'no'\nenable_cpu_affinity: false\nmachine_rank: 0\nmain_training_function: main\nmixed_precision: bf16\nnum_machines: 1\nnum_processes: 8\nrdzv_backend: static\nsame_network: true\ntpu_env: []\ntpu_use_cluster: false\ntpu_use_sudo: false\nuse_cpu: false\n\n```\n## Models Licence\n\nOur models fall under the [FLUX.1 [dev] Non-Commercial License](https:\u002F\u002Fgithub.com\u002Fblack-forest-labs\u002Fflux\u002Fblob\u002Fmain\u002Fmodel_licenses\u002FLICENSE-FLUX1-dev) \u003Cbr\u002F> Our training and infer scripts under the Apache 2 License\n\n## Near Updates\n\nWe are working on releasing new ControlNet weight models for Flux: **OpenPose**, **Depth** and more! \u003Cbr\u002F>\nStay tuned with [XLabs AI](https:\u002F\u002Fgithub.com\u002FXLabs-AI) to see **IP-Adapters** for Flux.\n\n![Follow Our Updates](.\u002Fassets\u002Freadme\u002Fdark\u002Ffollow-cta-rev2.png)\n","x-flux项目提供了由Black Forest Labs开发的Flux模型的微调脚本，支持LoRA和ControlNet等技术。该项目利用DeepSpeed进行训练，能够处理1024x1024分辨率的图像，并已训练了包括IP-Adapter、Canny ControlNet、Depth ControlNet、HED ControlNet以及多种LoRA检查点在内的多个模型。这些模型可通过HuggingFace或civit.ai获取。x-flux适合于需要对图像生成模型进行特定领域定制化训练的研究人员或开发者使用，尤其是在追求高质量图像生成效果的应用场景下表现优异。此外，它还提供了一套完整的安装指南与训练流程说明，便于用户快速上手。",2,"2026-06-11 03:42:29","high_star"]