Instructions to use nhathoangfoto/Flux.2-Klein-9B-SmartCharacterSwap with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use nhathoangfoto/Flux.2-Klein-9B-SmartCharacterSwap with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.2-klein-base-9B", dtype=torch.bfloat16, device_map="cuda") pipe.load_lora_weights("nhathoangfoto/Flux.2-Klein-9B-SmartCharacterSwap") prompt = "jhuangswap, masterpiece, high-end photography, realistic portrait, matching target lighting, highly detailed skin texture, 8k resolution" input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png") image = pipe(image=input_image, prompt=prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
π Flux.2-Klein-9B Smart Character Swap
The ultimate LoRA for high-end, occlusion-aware character and face swapping.
Designed specifically for commercial imaging workflows, this adapter for FLUX.2 Klein 9B excels at handling complex occlusions (hands, veils, foreground objects) while seamlessly matching the exact color grading and directional lighting of your target scene.
π MASTER COMFYUI & COMMERCIAL AI WORKFLOWS
Want to build production-ready AI pipelines? Subscribe to the channel for upcoming in-depth tutorials on how to maximize this LoRA, advanced ComfyUI node setups, GPU optimization, and building real-world AI applications (like automated AI photobooths).
@JettHuangAI β Hit π so you don't miss the deep-dive workflow tutorial for this model!
β¨ Why Choose This LoRA?
Standard face-swap methods often fail in professional environments by pasting faces over objects or introducing uncanny, plastic looks. SmartCharcterswap solves this by acting as an intelligent compositor:
- Strictly High-End Realism: Engineered exclusively for practical photography and portrait retouching. It aggressively preserves realistic skin textures and structural anatomy while completely rejecting any cartoonish, illustrative, or overly-smoothed AI aesthetics.
- Masterful Occlusion Handling: Understands depth perfectly. It seamlessly integrates the new identity behind occluding elements like fingers, hair, or microphones without breaking the image.
- Perfect Lighting & Color Sync: Automatically adapts to the target's environment. If your base image is a high-contrast B&W portrait, the swapped identity will perfectly adopt those exact tonal values and shadows.
- Identity Preservation: Maintains the distinct bone structure and unique micro-features of the source subject across diverse angles.
πΌοΈ Visual Proof
Case 1 β B&W Color Matching & Hand Occlusion
| Identity Source | Target Scene | Final Output |
|---|---|---|
![]() |
![]() |
![]() |
Case 2 β Complex Occlusion Handling (Veil)
| Identity Source | Target Scene | Final Output |
|---|---|---|
![]() |
![]() |
![]() |
π οΈ Usage & Cfg Settings
This LoRA is optimized for node-based workflows, providing maximum stability for both standard and lightning-fast inference pipelines.
Trigger Word: jhuangswap
π Recommended Settings
1. Standard Base Model (High-Detail Inference)
- Inference Steps:
20 β 30 - Guidance Scale (CFG):
2.0 β 4.0 - LoRA Strength:
0.75 β 1.0
2. Distilled / Lightning Model (Ultra-Fast Inference)
- Inference Steps:
4 steps(Highly optimized) - Guidance Scale (CFG):
1.0(Strictly required for distilled/schnell base models) - LoRA Strength:
0.85 β 1.0
π» Integration Guide
ComfyUI Setup
- Download the
.safetensorsfile. - Place it in your
ComfyUI/models/loras/directory. - Add the LoraLoader node into your workflow and use the trigger word
jhuangswapat the beginning of your positive prompt.
Diffusers (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])
# For Distilled Model usage:
# result = pipe(prompt="jhuangswap, realistic portrait...", num_inference_steps=4, guidance_scale=1.0)
- Downloads last month
- 108
Model tree for nhathoangfoto/Flux.2-Klein-9B-SmartCharacterSwap
Base model
black-forest-labs/FLUX.2-klein-base-9B




