Image-Text-to-Text
PEFT
Safetensors
English
color-grading
lut
cube-lut
image-editing
instruction-following
qlora
lora
qwen2-vl
vlm
Instructions to use ericrcwu/LUT_SLM_sft_adapters with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use ericrcwu/LUT_SLM_sft_adapters with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
Add repo card explaining Stage-2 generator adapters
Browse files
README.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: Qwen/Qwen2.5-VL-3B-Instruct
|
| 3 |
+
library_name: peft
|
| 4 |
+
pipeline_tag: image-text-to-text
|
| 5 |
+
license: other
|
| 6 |
+
language:
|
| 7 |
+
- en
|
| 8 |
+
tags:
|
| 9 |
+
- color-grading
|
| 10 |
+
- lut
|
| 11 |
+
- cube-lut
|
| 12 |
+
- image-editing
|
| 13 |
+
- instruction-following
|
| 14 |
+
- qlora
|
| 15 |
+
- lora
|
| 16 |
+
- peft
|
| 17 |
+
- qwen2-vl
|
| 18 |
+
- vlm
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
# LUT-SLM β Stage-2 Generator Adapters (QLoRA over Qwen2.5-VL-3B)
|
| 22 |
+
|
| 23 |
+
QLoRA adapters for the **Stage-2 generator** of the LUT-SLM project: a small vision-language model
|
| 24 |
+
that turns *(source image + natural-language photo-editing instruction)* into a single global color
|
| 25 |
+
Look-Up Table (LUT). Given *"make it warmer and lift the shadows"* the model emits the tokens of a
|
| 26 |
+
17Β³ `.cube` LUT that bakes in exactly that look; given a request a single global LUT physically
|
| 27 |
+
**cannot** satisfy (e.g. *"remove the person on the left"*) it emits `<unsupported>` and refuses.
|
| 28 |
+
|
| 29 |
+
These adapters are trained on the companion dataset
|
| 30 |
+
**[`ericrcwu/LUT_SLM`](https://huggingface.co/datasets/ericrcwu/LUT_SLM)** (see that card for the full
|
| 31 |
+
data story). The Stage-1 request router lives in
|
| 32 |
+
**[`ericrcwu/LUT_SLM_interpreter`](https://huggingface.co/ericrcwu/LUT_SLM_interpreter)**.
|
| 33 |
+
|
| 34 |
+
> **Status β research artifacts, work in progress.** These are smoke-scale / bilevel-search run
|
| 35 |
+
> outputs, not a finalized release. Treat them as reproducible checkpoints from the collapse-fix and
|
| 36 |
+
> two-stage experiments.
|
| 37 |
+
|
| 38 |
+
## What's in this repo
|
| 39 |
+
|
| 40 |
+
Each subfolder is a self-contained PEFT adapter (adapter weights + tokenizer + chat template +
|
| 41 |
+
`adapter_manifest.json`), **except** `distill_r1_distilled_corpus/`, which holds a distilled data
|
| 42 |
+
corpus rather than weights.
|
| 43 |
+
|
| 44 |
+
| Subfolder | What it is |
|
| 45 |
+
|---|---|
|
| 46 |
+
| `p6_twostage_d0f9c744_smokefull/` | **Deployed generator.** P6 two-stage run adapter used by the webapp / Modal deploy (`deploy/modal_app.py`). mean train loss β 1.677, 182 steps, lr 2e-4. |
|
| 47 |
+
| `bl_63cd1bf7_smokefull/` | One-stage full-run winner from the bilevel-over-SFT search. mean train loss β 1.747, 162 steps, lr 3e-4. |
|
| 48 |
+
| `bl_a0ccbcff_smokefull/` | Bilevel baseline adapter (full smoke run). |
|
| 49 |
+
| `bl_a0ccbcff_smoke600/` | Bilevel baseline adapter (600-example smoke run). |
|
| 50 |
+
| `distill_r1_smokefull/` | Distillation round-1 adapter. |
|
| 51 |
+
| `distill_r1_distilled_corpus/` | Distilled corpus (`active_rows.jsonl`, `active_manifest.json`, `harvest_cache.jsonl`) β **data, not weights.** |
|
| 52 |
+
|
| 53 |
+
## Shared architecture & training recipe
|
| 54 |
+
|
| 55 |
+
All adapters share the same shape (per `adapter_manifest.json`):
|
| 56 |
+
|
| 57 |
+
- **Base model:** `Qwen/Qwen2.5-VL-3B-Instruct`, with the output embedding **resized to 151,924
|
| 58 |
+
tokens** β the base vocab plus 259 special LUT tokens (`<lut_bos>`, `<lut_eos>`, `<unsupported>`,
|
| 59 |
+
`<lut_000>`β¦`<lut_255>`). Embeddings are **tied**.
|
| 60 |
+
- **LoRA:** `r = 16`, `alpha = 32`, `dropout = 0.05`, targets
|
| 61 |
+
`q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj`.
|
| 62 |
+
- **Quantization:** 4-bit QLoRA β `nf4`, double-quant, bf16 compute dtype.
|
| 63 |
+
- **Optim:** effective batch size 32 (per-device 1 Γ grad-accum 32), cosine schedule, 3% warmup,
|
| 64 |
+
grad-checkpointing, 2 epochs, seed 0.
|
| 65 |
+
- **Frozen VQ tokenizer:** the 64 LUT code tokens decode via
|
| 66 |
+
`tokenizer_version = vq_v2_srgbres_17to4_cb256_t64β¦` (encoder 17Β³ β 4Β³ latent β 64 codes over a
|
| 67 |
+
256-entry codebook; decoder β a residual LUT added to the sRGB identity grid β `.cube`). The
|
| 68 |
+
tokenizer artifacts themselves ship with the [`LUT_SLM`](https://huggingface.co/datasets/ericrcwu/LUT_SLM)
|
| 69 |
+
corpus shards.
|
| 70 |
+
|
| 71 |
+
**Output grammar:** supported β `<lut_bos> <lut_###> Γ64 <lut_eos>`; unsupported β `<unsupported>`.
|
| 72 |
+
|
| 73 |
+
## How to load
|
| 74 |
+
|
| 75 |
+
The adapter targets a **vocab-resized** base, so you must resize the base embeddings to 151,924 and
|
| 76 |
+
add the 259 special tokens *before* attaching the adapter (the `adapter_config.json` `base_model`
|
| 77 |
+
field points at a local `models/base_resized`, i.e. the resized base β not a Hub repo).
|
| 78 |
+
|
| 79 |
+
```python
|
| 80 |
+
from huggingface_hub import snapshot_download
|
| 81 |
+
d = snapshot_download("ericrcwu/LUT_SLM_sft_adapters",
|
| 82 |
+
allow_patterns=["p6_twostage_d0f9c744_smokefull/*"])
|
| 83 |
+
# 1) load Qwen/Qwen2.5-VL-3B-Instruct, 2) add the 259 special tokens + resize embeddings to 151924,
|
| 84 |
+
# 3) PeftModel.from_pretrained(base, f"{d}/p6_twostage_d0f9c744_smokefull").
|
| 85 |
+
# See notebooks/colab_lut_slm_inference.ipynb in the source repo for a runnable end-to-end example
|
| 86 |
+
# (vocab is reconstructed in memory, LUT codes decoded with the frozen tokenizer, image rendered).
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
## Licensing & provenance
|
| 90 |
+
|
| 91 |
+
`license: other`. The base model is governed by its own Qwen license; these adapters are derived from
|
| 92 |
+
the mixed-provenance **[`LUT_SLM`](https://huggingface.co/datasets/ericrcwu/LUT_SLM)** corpus, several
|
| 93 |
+
sources of which are **personal-use / non-redistribution** (see that dataset's licensing section).
|
| 94 |
+
This repository makes **no license claim** over the underlying LUTs or images. Research use;
|
| 95 |
+
verify each source family's original terms before any redistribution or commercial use.
|