FreeStyle_Dataset / README.md
Blue2Giant's picture
Update concise root README with training prompt fields
ae01c4b verified
|
Raw
History Blame Contribute Delete
6.17 kB
---
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`.