Instructions to use DirtScan/trail-delighter with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use DirtScan/trail-delighter 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-4B", dtype=torch.bfloat16, device_map="cuda") pipe.load_lora_weights("DirtScan/trail-delighter") prompt = "Turn this cat into a dog" 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] - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
Add model card and usage documentation
Browse files
README.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
library_name: diffusers
|
| 4 |
+
base_model: black-forest-labs/FLUX.2-klein-4B
|
| 5 |
+
tags:
|
| 6 |
+
- lora
|
| 7 |
+
- image-editing
|
| 8 |
+
- image-to-image
|
| 9 |
+
- relighting
|
| 10 |
+
- shadow-removal
|
| 11 |
+
- trail-photography
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# Trail Delighter — FLUX.2 Klein 4B LoRA
|
| 15 |
+
|
| 16 |
+
This is a source-conditioned LoRA for **FLUX.2 Klein 4B**. It was trained for
|
| 17 |
+
one narrow task: reducing cast shadows, glare, and uneven illumination in
|
| 18 |
+
trail-surface photographs while preserving the camera viewpoint and physical
|
| 19 |
+
scene structure.
|
| 20 |
+
|
| 21 |
+
It is not a general-purpose shadow-removal model. The training set consists of
|
| 22 |
+
real Chunk 0 trail photographs paired with Qwen/Fal lighting-restoration
|
| 23 |
+
outputs. The model is intended for texture-capture imagery and may perform
|
| 24 |
+
poorly on unrelated photographs.
|
| 25 |
+
|
| 26 |
+
## Files
|
| 27 |
+
|
| 28 |
+
- `training/trail_delight_klein4b_highres15.safetensors` — final LoRA
|
| 29 |
+
- `training/checkpoints/` — 125, 250, and 375 step checkpoints
|
| 30 |
+
- `examples/teacher_pairs/original/` — original trail photos
|
| 31 |
+
- `examples/teacher_pairs/qwen_delighted/` — Qwen/Fal teacher outputs
|
| 32 |
+
- `examples/teacher_pairs/klein_lora/` — corresponding Klein LoRA outputs
|
| 33 |
+
|
| 34 |
+
The base FLUX.2 Klein weights are not included. Download them from the
|
| 35 |
+
upstream model repository separately.
|
| 36 |
+
|
| 37 |
+
## Inference with Diffusers
|
| 38 |
+
|
| 39 |
+
```python
|
| 40 |
+
import torch
|
| 41 |
+
from diffusers import Flux2KleinPipeline
|
| 42 |
+
from diffusers.utils import load_image
|
| 43 |
+
|
| 44 |
+
base = "black-forest-labs/FLUX.2-klein-4B"
|
| 45 |
+
lora = "DirtScan/trail-delighter"
|
| 46 |
+
|
| 47 |
+
pipe = Flux2KleinPipeline.from_pretrained(base, torch_dtype=torch.float16)
|
| 48 |
+
pipe.load_lora_weights(lora, subfolder="training", adapter_name="trail_delight")
|
| 49 |
+
pipe.set_adapters(["trail_delight"], adapter_weights=[1.0])
|
| 50 |
+
pipe.enable_sequential_cpu_offload(device="cuda")
|
| 51 |
+
pipe.vae.enable_tiling()
|
| 52 |
+
pipe.vae.enable_slicing()
|
| 53 |
+
|
| 54 |
+
image = load_image("input-trail-photo.png").convert("RGB").resize((768, 448))
|
| 55 |
+
result = pipe(
|
| 56 |
+
image=image,
|
| 57 |
+
prompt=(
|
| 58 |
+
"Edit this trail-surface photograph under neutral soft overcast illumination. "
|
| 59 |
+
"Remove cast shadows and glare while preserving the exact trail geometry, "
|
| 60 |
+
"rocks, leaves, markings, materials, and camera viewpoint."
|
| 61 |
+
),
|
| 62 |
+
width=768,
|
| 63 |
+
height=448,
|
| 64 |
+
num_inference_steps=4,
|
| 65 |
+
guidance_scale=1.0,
|
| 66 |
+
).images[0]
|
| 67 |
+
result.save("trail-delighted.png")
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
For local inference, the final LoRA is small, but the unquantized base model
|
| 71 |
+
is substantially larger than an 8 GB GPU. Sequential CPU offload or a
|
| 72 |
+
compatible quantized runtime may be required.
|
| 73 |
+
|
| 74 |
+
## Training summary
|
| 75 |
+
|
| 76 |
+
- Base: FLUX.2 Klein 4B
|
| 77 |
+
- Adapter: LoRA, rank 16
|
| 78 |
+
- Teacher: Qwen Image Edit lighting-restoration via Fal
|
| 79 |
+
- Teacher pairs: 15 real Chunk 0 trail-photo pairs
|
| 80 |
+
- Resolution used for the student run: 768 × 448
|
| 81 |
+
- Final checkpoint: 500 training steps
|
| 82 |
+
|
| 83 |
+
## Limitations
|
| 84 |
+
|
| 85 |
+
The adapter can still produce image-to-image hue variation, local texture
|
| 86 |
+
changes, or residual seams when many independently processed views are merged
|
| 87 |
+
into a texture atlas. It should therefore be followed by atlas-level colour
|
| 88 |
+
harmonization and seam-aware blending for 3D texturing.
|
| 89 |
+
|
| 90 |
+
## License
|
| 91 |
+
|
| 92 |
+
The adapter is provided under Apache-2.0, subject to the terms of the base
|
| 93 |
+
FLUX.2 Klein model and the rights to the training photographs and teacher
|
| 94 |
+
outputs.
|