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
Update README.md
Browse files
README.md
CHANGED
|
@@ -13,82 +13,14 @@ tags:
|
|
| 13 |
|
| 14 |
# Trail Delighter — FLUX.2 Klein 4B LoRA
|
| 15 |
|
| 16 |
-
This is a
|
| 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 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 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
|
| 94 |
-
outputs.
|
|
|
|
| 13 |
|
| 14 |
# Trail Delighter — FLUX.2 Klein 4B LoRA
|
| 15 |
|
| 16 |
+
This is a LoRA for **FLUX.2 Klein 4B** specifically for the task of giving natural light to mountain bike trail photographs.
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
+
The process was as follows:
|
| 19 |
+
- Photos are taken of a mountain bike trail (often sunny, cast shadows, lens flare, glare)
|
| 20 |
+
- A selection of these were de-lighted using https://fal.ai/models/fal-ai/qwen-image-edit-2509-lora-gallery/lighting-restoration - This creates a "teacher set"
|
| 21 |
+
- This teacher set was then used to train a new LoRA, but with a base of **FLUX.2 Klein 4B** (instead of Qwen) - overall making the model smaller and easier to run.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
## License
|
| 24 |
|
| 25 |
The adapter is provided under Apache-2.0, subject to the terms of the base
|
| 26 |
+
FLUX.2 Klein model.
|
|
|