Djoyne's picture
Duplicate from nhathoangfoto/Flux.2-Klein-9B-Mannequin
b902776
|
Raw
History Blame Contribute Delete
9.67 kB
---
license: apache-2.0
base_model: black-forest-labs/FLUX.2-klein-base-9B
base_model_relation: adapter
tags:
- lora
- flux
- flux.2
- flux.2-klein
- character-swap
- face-swap
- occlusion-handling
- diffusers
- image-to-image
- photorealistic
language:
- en
pipeline_tag: image-to-image
library_name: diffusers
instance_prompt: jhuangswap
widget:
- text: "jhuangswap — cycle through: character source → target body → final output"
output:
url: examples/A3.jpg
---
# 🎭 Flux.2-Klein-9B-SmartCharcterswap
**A specialized LoRA adapter for FLUX.2 Klein 9B designed for high-end, highly accurate character and face swapping. It excels at handling complex occlusions (like hands, veils, and foreground objects) and seamlessly matching the color grading and lighting of the target image.**
Built specifically for practical, high-end portrait editing and commercial imaging workflows, ensuring photorealistic results without unwanted cartoon or stylized aesthetics.
---
<div align="center">
## 🔴 TUTORIALS COMING SOON — SUBSCRIBE NOW
**I'll be dropping in-depth tutorials on AI models, ComfyUI workflows, image & video generation, 3D tools and more.**
[![YouTube](https://img.shields.io/badge/▶️_Subscribe-@JettHuangAI-FF0000?style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/@JettHuangAI)
**[@JettHuangAI](https://www.youtube.com/@JettHuangAI) — Hit 🔔 so you don't miss it!**
</div>
---
<div align="center">
### ☕ Support My Work
If this LoRA helps your projects, please consider supporting continued development and new model releases.
[![PayPal](https://img.shields.io/badge/Donate_via-PayPal-00457C?style=for-the-badge&logo=paypal&logoColor=white)](https://paypal.me/nhathoangfoto)
**→ [paypal.me/nhathoangfoto](https://paypal.me/nhathoangfoto) ←**
*Every contribution directly funds training compute, dataset curation, and the release of new open-source LoRAs.*
</div>
---
For custom LoRA training, advanced ComfyUI workflow development, or collaboration:
🌐 Website: [jetthuang.com](https://jetthuang.com)
📱 WhatsApp: +84947397868
💬 Telegram/Discord: nhathoangfoto
🐦 X: https://x.com/NhatPhoto
📘 Facebook: https://www.facebook.com/nhathoangfoto
Powerful local hardware, ready for any complex project: 🚀 **RTX 5090** | **RTX Pro 6000** 🛠️
---
## 🖼️ Examples
### Case 1 — B&W Color Matching & Hand Occlusion
| Character Source (Identity) | Target Body (Base Image) | → Final Output |
|:---:|:---:|:---:|
| ![Source 1](https://huggingface.co/nhathoangfoto/Flux.2-Klein-9B-SmartCharcterswap/resolve/main/examples/B1.jpg) | ![Target 1](https://huggingface.co/nhathoangfoto/Flux.2-Klein-9B-SmartCharcterswap/resolve/main/examples/B2.jpg) | ![Result 1](https://huggingface.co/nhathoangfoto/Flux.2-Klein-9B-SmartCharcterswap/resolve/main/examples/B3.jpg) |
### Case 2 — Complex Occlusion Handling (Veil)
| Character Source (Identity) | Target Body (Base Image) | → Final Output |
|:---:|:---:|:---:|
| ![Source 2](https://huggingface.co/nhathoangfoto/Flux.2-Klein-9B-SmartCharcterswap/resolve/main/examples/A1.jpg) | ![Target 2](https://huggingface.co/nhathoangfoto/Flux.2-Klein-9B-SmartCharcterswap/resolve/main/examples/A2.jpg) | ![Result 2](https://huggingface.co/nhathoangfoto/Flux.2-Klein-9B-SmartCharcterswap/resolve/main/examples/A3.jpg) |
*Left: Character reference (identity). Middle: Target body/scene. Right: Final output — the character seamlessly integrated with perfect occlusion and lighting matching.*
---
## ✨ What this LoRA does
- **Masterful Occlusion Handling:** Unlike standard swap tools that break when hands, hair, or objects cover the face, this LoRA understands depth and seamlessly integrates the new identity *behind* occluding elements.
- **Perfect Lighting & Color Sync:** Automatically adapts the source identity to the target's environment. If the target is a dramatic B&W portrait, the swapped face will perfectly match the B&W tones, contrast, and directional shadows.
- **Strictly High-End Realism:** Finely tuned for practical photography and portrait retouching. It aggressively preserves realistic skin textures and structural anatomy while completely avoiding cartoonish or overly-smoothed AI artifacts.
- **Identity Preservation:** Maintains the bone structure, distinct facial features, and unique characteristics of the source subject across diverse angles and expressions.
## 🎯 Why use it
Standard face-swap methods often fail in professional environments because they:
- Paste faces *over* foreground objects (like hands or microphones).
- Fail to adjust skin tone and lighting to match the background.
- Introduce an uncanny, plastic, or illustrative look.
**SmartCharcterswap LoRA solves this** by acting as a highly intelligent compositor, making it an essential tool for commercial photography, automated AI photobooths, and advanced ComfyUI pipelines.
---
## 🔗 Complete Workflow
This LoRA is optimized for node-based workflows in ComfyUI, providing maximum stability and near-perfect accuracy after rigorous testing.
### 📋 Example Workflow
![Example Workflow](https://huggingface.co/nhathoangfoto/Flux.2-Klein-9B-SmartCharcterswap/resolve/main/examples/screenshot.jpg)
*Screenshot of the highly efficient ComfyUI workflow utilized for testing and executing the Smart Character Swap.*
---
> [!IMPORTANT]
> ## 💡 Get the Most Out of This LoRA
>
> This LoRA performs at its **absolute best** when paired with a **custom workflow tailored to your specific use case**, combined with additional control LoRAs for precise, production-ready results.
>
> A generic workflow will only scratch the surface of what this model can do. For commercial shoots, AI photobooths, or advanced portrait pipelines — a purpose-built workflow makes all the difference.
>
> **📩 For a custom workflow, please contact me directly:**
> - 📱 WhatsApp: **+84947397868**
> - 💬 Telegram/Discord: **nhathoangfoto**
> - 🌐 [jetthuang.com](https://jetthuang.com)
---
## 🎯 Trigger Word
```
jhuangswap
```
Place this trigger at the beginning of your positive prompt to activate the character swapping behavior effectively.
### Example Prompt Structure
```
jhuangswap, masterpiece, high-end photography, realistic portrait of a young man, matching target lighting, highly detailed skin texture, 8k resolution
```
---
## 💡 Tips & Prompting Guide
### 1. Focus on Photographic Quality
To maintain the high-end practical feel, always use prompts that steer the base model toward realism.
**Good:** `jhuangswap, editorial photography, studio lighting, raw photo, realistic skin...`
**Avoid:** Prompts containing words like `illustration, 3d render, anime, stylized...`
### 2. Let the Target Image Dictate the Scene
You do not need to heavily describe the pose or the background if you are using an image-to-image/ControlNet workflow. Let the Target Body image drive the composition, and use the prompt to reinforce the identity and photographic quality.
### 3. Recommended Settings
- **LoRA Strength**: `0.75 – 1.0` (Adjust based on how aggressively the target image deviates from the source identity).
- **Inference Steps**: 20–30 steps for Base Model.
- **Guidance Scale**: `2.0 – 4.0`
---
## 🚀 Usage
### ComfyUI
```
1. Download the .safetensors file.
2. Place it in: ComfyUI/models/loras/
3. Build your image-to-image or character swap workflow (refer to the Screenshot.jpg).
4. Use the trigger word "jhuangswap" in your positive prompt.
```
### Diffusers (Python)
```python
from diffusers import Flux2Pipeline
import torch
pipe = Flux2Pipeline.from_pretrained(
"black-forest-labs/FLUX.2-klein-base-9B",
torch_dtype=torch.bfloat16
).to("cuda")
pipe.load_lora_weights(
"nhathoangfoto/Flux.2-Klein-9B-SmartCharcterswap",
adapter_name="smartcharswap"
)
pipe.set_adapters(["smartcharswap"], adapter_weights=[0.85])
# Example usage (integration with image-to-image pipelines required for full swap functionality)
```
---
## ⚠️ Limitations
- **Extreme Angles:** While highly robust, extreme profile shots (full 90-degree side profiles) may still experience slight identity degradation depending on the source image quality.
- **Resolution:** Designed for high-end outputs; providing extremely low-resolution source images will limit the detail recovery in the final output.
---
## 📄 License
Released under **Apache 2.0**. You are free to use this LoRA for personal, research, and commercial purposes.
The base model (FLUX.2 Klein Base 9B) has its own license — please review the [FLUX.2 Klein Base 9B license terms](https://huggingface.co/black-forest-labs/FLUX.2-klein-base-9B) for base-model usage conditions.
---
## 🙏 Credits
- **Base Model**: [FLUX.2 Klein Base 9B](https://huggingface.co/black-forest-labs/FLUX.2-klein-base-9B) by Black Forest Labs
- **Author**: Jett Huang (Nhật Hoàng) — [Nhật Hoàng AI / jetthuang.com](https://jetthuang.com)
- *Workflow developer ComfyUI, Automation Workflow AI.*
---
<div align="center">
## ☕ Enjoying this LoRA?
Your support keeps new models coming. Even a small tip makes a real difference for independent open-source AI work.
### [**💖 Donate via PayPal**](https://paypal.me/nhathoangfoto)
[![PayPal Donate](https://img.shields.io/badge/PayPal-paypal.me%2Fnhathoangfoto-00457C?style=for-the-badge&logo=paypal&logoColor=white&labelColor=003087)](https://paypal.me/nhathoangfoto)
*Thank you for supporting independent AI research! 🙏*
---
**If you find this LoRA useful, please ❤️ like the model and share your creations in the Community tab!**
</div>