| # Source Records | |
| This folder stores supplemental source-side information for the packaged benchmark samples. | |
| ## Contents | |
| - `by_id/<id>.json`: one merged JSON record per packaged sample ID. | |
| - `html_metadata.json`: filtered HTML-derived metadata for packaged sample IDs. | |
| - `summary.json`: coverage summary for the supplemental export. | |
| ## Why this exists | |
| The canonical benchmark splits are intentionally task-oriented. They are good for training and evaluation, but some users may want richer provenance fields from the original Glazy pages, such as: | |
| - page title | |
| - author name | |
| - author URL | |
| - long-form description | |
| - page-level status | |
| - HTML-derived UMF and related ratios | |
| The per-sample JSON files expose these fields without forcing users to parse the raw HTML themselves. | |
| ## Relationship to canonical benchmark files | |
| These files are supplemental. The benchmark-facing train/test splits remain the authoritative interface for evaluation. | |
| ## Reader script | |
| Use `../tools/read_source_record.py` to inspect the packaged source-side data without writing your own loader. | |
| The script supports both quick one-off inspection and small batch exports. | |
| ### What it can do | |
| - Read one or many sample IDs. | |
| - Read IDs from a text file. | |
| - Return the full merged sample record. | |
| - Return shortcuts such as `title`, `author`, `description`, `umf`, and `raw_html_path`. | |
| - Drill into nested fields with a dotted `--path` lookup. | |
| - Preview the raw HTML directly, with optional tag stripping. | |
| - Export results as `json`, `jsonl`, or plain text. | |
| - Save output to a file instead of stdout. | |
| ### Common examples | |
| Quick summary: | |
| ```bash | |
| python huggingface/tools/read_source_record.py --summary | |
| ``` | |
| List the first 10 packaged sample IDs: | |
| ```bash | |
| python huggingface/tools/read_source_record.py --list-sample-ids 10 | |
| ``` | |
| Read the full merged record for one sample: | |
| ```bash | |
| python huggingface/tools/read_source_record.py --sample-id 100018 --field full | |
| ``` | |
| Read a convenience field: | |
| ```bash | |
| python huggingface/tools/read_source_record.py --sample-id 100018 --field umf | |
| python huggingface/tools/read_source_record.py --sample-id 100018 --field html_metadata | |
| python huggingface/tools/read_source_record.py --sample-id 100018 --field title | |
| python huggingface/tools/read_source_record.py --sample-id 100018 --field raw_html_path | |
| ``` | |
| Read a nested path inside the selected field: | |
| ```bash | |
| python huggingface/tools/read_source_record.py --sample-id 100018 --field full --path property_prediction.test.recipe.umf | |
| python huggingface/tools/read_source_record.py --sample-id 100018 --field full --path html_metadata.title | |
| ``` | |
| Preview the raw HTML: | |
| ```bash | |
| python huggingface/tools/read_source_record.py --sample-id 100018 --html-preview-chars 500 | |
| python huggingface/tools/read_source_record.py --sample-id 100018 --html-preview-chars 500 --html-preview-strip-tags | |
| ``` | |
| Read multiple samples at once: | |
| ```bash | |
| python huggingface/tools/read_source_record.py --sample-id 100018 10009 10023 --field title | |
| ``` | |
| Read sample IDs from a file: | |
| ```bash | |
| python huggingface/tools/read_source_record.py --sample-id-file sample_ids.txt --field raw_html_path --output-format jsonl | |
| ``` | |
| Export to a file: | |
| ```bash | |
| python huggingface/tools/read_source_record.py --sample-id 100018 10009 --field full --output-format jsonl --output out/source_records.jsonl | |
| ``` | |
| ### Notes | |
| - `--field umf` returns the first available UMF found in the merged sample record, preferring split-aligned recipe data and then HTML-derived metadata. | |
| - `--path` is applied after `--field` selection, so `--field full --path image_generation.train.metadata.image_path` works as expected. | |
| - For batch usage, `jsonl` is usually the easiest format to consume downstream. | |