File size: 6,169 Bytes
ae01c4b
 
 
 
 
 
 
 
761f47d
ae01c4b
761f47d
ae01c4b
761f47d
ae01c4b
 
 
761f47d
ae01c4b
761f47d
ae01c4b
230ca1b
ae01c4b
 
 
 
 
761f47d
ae01c4b
761f47d
7894832
ae01c4b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
761f47d
 
ae01c4b
761f47d
ae01c4b
761f47d
230ca1b
7894832
 
 
 
ae01c4b
7894832
 
 
 
 
 
 
 
ae01c4b
761f47d
ae01c4b
 
 
 
 
 
230ca1b
761f47d
ae01c4b
761f47d
ae01c4b
7894832
230ca1b
ae01c4b
 
 
230ca1b
761f47d
ae01c4b
761f47d
7894832
ae01c4b
7894832
761f47d
ae01c4b
761f47d
ae01c4b
761f47d
ae01c4b
 
 
 
 
 
761f47d
ae01c4b
761f47d
ae01c4b
 
 
 
761f47d
ae01c4b
230ca1b
ae01c4b
 
 
 
 
7894832
ae01c4b
7894832
ae01c4b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7894832
ae01c4b
7894832
ae01c4b
7894832
ae01c4b
 
 
 
 
761f47d
ae01c4b
761f47d
ae01c4b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
761f47d
7894832
761f47d
ae01c4b
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
---
pretty_name: 0426 CRef/SRef LoRA Triplet Dataset
language:
- en
- zh
task_categories:
- image-to-image
---

# 0426 CRef/SRef LoRA Triplet Dataset

This dataset contains CRef/SRef LoRA triplets exported from the 0426 diffusion training data. Each training example has three images:

- **content**: content reference image, used as `cref_0`
- **style**: style reference image, used as `sref_0`
- **target**: image generated from the combined content + style condition

Use `triplets.csv` as the main entry point. Image-level CSV files are provided only for deduplicated metadata and provenance lookup.

## Sources

| Directory | Base model | Original source | Triplets |
| --- | --- | --- | ---: |
| `cref_sref/qwen/` | `qwen` | `cref_sref_qwen_lora_part1` | 33,582 |
| `cref_sref/flux/` | `flux` | `cref_sref_flux_lora_part1` | 273,682 |
| `cref_sref/illustrious/` | `illustrious` | `cref_sref_illustrious_lora_part1` | 172,589 |

## Layout

```text
<repo-root>/
  README.md
  cref_sref/
    README.md
    qwen/
      triplets.csv
      content_images.csv
      style_images.csv
      target_images.csv
      images/content/...
      images/style/...
      images/target/...
    flux/
      ... same structure ...
    illustrious/
      ... same structure ...
```

## How To Use

Pick one source directory and read its `triplets.csv`:

```python
import csv
from pathlib import Path
from PIL import Image

source_dir = Path("/path/to/FreeStyle_Dataset/cref_sref/qwen")  # qwen / flux / illustrious

with open(source_dir / "triplets.csv", newline="", encoding="utf-8") as f:
    row = next(csv.DictReader(f))

content = Image.open(source_dir / row["content_image_path"]).convert("RGB")
style = Image.open(source_dir / row["style_image_path"]).convert("RGB")
target = Image.open(source_dir / row["target_image_path"]).convert("RGB")

print(row["sequence_id"])

# One training-compatible text pair. The original training samples one of several
# instruction/caption choices; see the next section.
instruction = row["vault_primary_instruction_en_123"]
target_caption = row["vault_captions_scene_3_en"]
print(instruction)
print(target_caption)
```

## Which Prompt Fields Are Used For Training?

The 0426 training config uses the three lora-triplet sources:

```text
cref_sref_qwen_lora_part1
cref_sref_flux_lora_part1
cref_sref_illustrious_lora_part1
```

In the training loader, a sample is not represented by a single prompt string. Each training choice is:

```text
<cref_0 image> <sref_0 image> <instruction text> <target caption text> <target image>
```

Only the final `target` image has `require_loss=True`; the two text fields are conditioning text.

For these lora-triplet sources, the training DB provides 8 text choices per sequence. Each choice uses exactly one instruction field plus one target-caption field:

| Instruction field in this CSV | Vault text index |
| --- | --- |
| `vault_primary_instruction_en_123` | `primary_instruction_en_123` |
| `vault_primary_instruction_cn_123` | `primary_instruction_cn_123` |
| `vault_sample_instruction_en_123` | `sample_instruction_en_123` |
| `vault_sample_instruction_cn_123` | `sample_instruction_cn_123` |

paired with one of:

| Target-caption field in this CSV | Vault text index |
| --- | --- |
| `vault_captions_scene_3_en` | `captions/scene_3_en` |
| `vault_captions_scene_3` | `captions/scene_3` |

So, to reproduce the training text conditioning, use one of these pairs, for example:

```python
instruction = row["vault_primary_instruction_en_123"]
target_caption = row["vault_captions_scene_3_en"]
texts = [instruction, target_caption]
```

or sample uniformly from the 8 combinations:

```python
import random

instruction_key = random.choice([
    "vault_primary_instruction_en_123",
    "vault_primary_instruction_cn_123",
    "vault_sample_instruction_en_123",
    "vault_sample_instruction_cn_123",
])
caption_key = random.choice([
    "vault_captions_scene_3_en",
    "vault_captions_scene_3",
])

texts = [row[instruction_key], row[caption_key]]
```

The columns `content_generation_prompt`, `style_generation_prompt`, and `target_generation_prompt` are provenance fields recovered from the original image-generation pipeline. They are useful for analysis, but they are **not** the primary text fields used by the 0426 VGO training loader.

All image paths in `triplets.csv` are **relative to the source directory**. For example, in `cref_sref/qwen/triplets.csv`:

```text
images/content/xxx.png -> cref_sref/qwen/images/content/xxx.png
images/style/yyy.png   -> cref_sref/qwen/images/style/yyy.png
images/target/zzz.png  -> cref_sref/qwen/images/target/zzz.png
```

## Main Files

| File | Meaning |
| --- | --- |
| `triplets.csv` | One row per training example. This is the file most users should start from. |
| `content_images.csv` | Deduplicated metadata for unique content images. |
| `style_images.csv` | Deduplicated metadata for unique style images. |
| `target_images.csv` | Deduplicated metadata for unique target images. |
| `summary.json` | Per-source counts and match/prompt recovery statistics. |

Important `triplets.csv` columns:

- `sequence_id`
- `base_model`
- `content_image_path`, `style_image_path`, `target_image_path`
- `vault_primary_instruction_en_123`, `vault_primary_instruction_cn_123`
- `vault_sample_instruction_en_123`, `vault_sample_instruction_cn_123`
- `vault_captions_scene_3_en`, `vault_captions_scene_3`
- `vault_texts_json`
- `content_generation_prompt`, `style_generation_prompt`, `target_generation_prompt` provenance fields
- `content_original_path`, `style_original_path`, `target_original_path` provenance fields
- `content_match_status`, `style_match_status`, `target_match_status`
- `content_prompt_status`, `style_prompt_status`, `target_prompt_status`

## Notes

- Images are deduplicated; the same image file may appear in multiple triplet rows.
- `original_path` and prompt fields are best-effort provenance metadata and may be unresolved for some rows.
- `_state/`, if present, is internal export/resume state and is not needed for normal dataset use.
- For detailed column definitions and provenance status values, see `cref_sref/README.md`.