project-data-setup
Set up and validate DeepDanbooru projects, tag files, Danbooru-like SQLite datasets, and training-database conversions.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- project-data-setup
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Set up and validate DeepDanbooru projects, tag files, Danbooru-like SQLite datasets, and training-database conversions.
- disable-model-invocation
- true
02 资源文件 9
- 参考文档references/cli-reference.md3.2 KB
- 参考文档references/dataset-format.md4.0 KB
- 参考文档references/project-json-reference.md3.1 KB
- 参考文档references/tag-download-and-tags-files.md3.8 KB
- 参考文档references/troubleshooting.md4.1 KB
- 脚本scripts/create_project_probe.py3.5 KB
- 脚本scripts/make_tiny_danbooru_sqlite.py4.4 KB
- 脚本scripts/validate_danbooru_sqlite.py7.9 KB
- 脚本scripts/validate_tags_txt.py3.8 KB
03 SKILL.md 正文
Project and data setup
Use this sub-skill before training when a DeepDanbooru project, tag vocabulary, Danbooru-style SQLite database, or filtered training database is missing or uncertain. It is deliberately CPU-safe and offline by default. The bundled scripts use only the Python standard library and never contact Danbooru or read the original source checkout.
Fast path
- Put a dataset SQLite file beside an
images/directory. Validate it withvalidate_danbooru_sqlite.py. - Create a project in a new directory:
deepdanbooru create-project /absolute/path/to/project. - Edit
project.jsonsodatabase_pathpoints to the dataset SQLite file. Keep the path usable from the machine that will train; do not leave it asnull. Seeproject-json-reference.md. - Supply a reviewed newline-separated
tags.txt, or explicitly authorize the network operation in the tag-download workflow below. - If system rating tags or deleted-post filtering is needed, make a separate
SQLite output with
make-training-database; never use the source file as its own output. - Run the checks in
troubleshooting.md, then hand the prepared project to the sibling model-training sub-skill. After a model exists, hand images and the project to inference-evaluation.
Exact command forms
Create a project (the destination must be a directory path accepted by Click):
deepdanbooru create-project PROJECT_PATH
This creates the directory if necessary and writes only project.json; it does
not create tags.txt, a database, an images directory, or a model. It is
intended for a new project. Inspect and edit the generated JSON rather than
assuming the default database_path is usable.
Download tags only after an explicit user decision to make a network request:
deepdanbooru download-tags PROJECT_PATH \
--limit INTEGER --minimum-post-count INTEGER --overwrite \
--username DANBOORU_USERNAME --api-key DANBOORU_API_KEY
--limit defaults to 10000 for each downloaded category and
--minimum-post-count defaults to 500. --overwrite is a flag and is
required when an existing tags.txt may be replaced. --username and
--api-key are required by the CLI even though the bundled offline checks do
not need them. The command contacts https://danbooru.donmai.us/tags.json.
Do not put real credentials in fixtures, generated skills, logs, or an
unapproved shell history.
Convert a source Danbooru export into the smaller training schema:
deepdanbooru make-training-database SOURCE_PATH OUTPUT_PATH \
--start-id INTEGER --end-id INTEGER --use-deleted \
--chunk-size INTEGER --overwrite --vacuum
Defaults are start-id=1, end-id=sys.maxsize, chunk-size=5000000, and all
three flags are off. --overwrite deletes an existing output before creating
it. --vacuum runs SQLite VACUUM after copying. Use a separate output path
and make a backup before destructive replacement.
Contracts that must agree
- The project contract is
project.jsonplustags.txt; the full default context and path rules are in the project reference. - A usable dataset has
posts(id, md5, file_ext, tag_string, tag_count_general). A source for conversion additionally hasrating,score, andis_deleted; the converted output intentionally drops those source columns and adds rating tags intotag_string. - Supported training image extensions are
png,jpg, andjpeg(lowercase values in SQLite). For a row, the loader looks forDATASET_DIR/images/MD5[:2]/MD5.FILE_EXT, whereDATASET_DIRis the SQLite file's parent directory. Themd5text need not be a real hash, but it must match the file name and have a useful first-two-character directory prefix. - Rows are selected only when
tag_count_general >= project.json'sminimum_tag_count, and are ordered byid. The loader does not verify that files exist while building records; check the layout before training. - Use UTF-8 for
tags.txt, one tag per line. Blank/whitespace-only lines are ignored and surrounding whitespace is stripped; preserve a deliberate, duplicate-free order.
Safe validation workflow
python scripts/create_project_probe.py
python scripts/validate_tags_txt.py PROJECT_PATH/tags.txt
python scripts/validate_danbooru_sqlite.py DATASET_DIR/data.sqlite
python scripts/make_tiny_danbooru_sqlite.py --output-dir ./dd-fixture
python scripts/validate_danbooru_sqlite.py ./dd-fixture/source.sqlite --mode source
The tiny fixture is for local command and schema checks, not a training-quality
corpus. Its image payloads are deterministic fixtures; use real decoded images
for model work. All scripts refuse unsafe replacement by default and have
--help.
Failure handling
- A missing or malformed
postsschema is a data-preparation failure, not a reason to lowerminimum_tag_countblindly. Validate the source insourcemode before conversion and the output intrainingmode afterward. - A source/output collision is always an error. If output already exists,
omit
--overwritefirst and inspect it; only use the flag after an explicit replacement decision. - Deleted rows are skipped by default.
--use-deletedincludes them, but it does not restore missing image files. Ratingg,s,q, andebecomesrating:general,rating:sensitive,rating:questionable, orrating:explicit; score is currently not converted. - Tag download failures can be authentication, network, API response, or filesystem failures. Keep the current local tag files, fix the cause, and retry only with consent. Offline scripts cannot prove remote tag freshness.
- A project can be structurally valid yet unusable when
database_pathis null, points elsewhere, has no adjacentimages/, has missing files, or has no tags meeting the threshold. Report each condition separately.
Handoff boundary
This sub-skill ends after the project/data contracts and checks pass. It does
not train a model, evaluate images, download credentials, or claim GPU
readiness. The next model-training step consumes the project and validated
SQLite/image layout. The inference-evaluation step consumes a trained model,
its matching tags.txt, and target files or folders.
See also:
cli-reference.mdfor option defaults and side effects.dataset-format.mdfor schemas and paths.tag-download-and-tags-files.mdfor offline tag-file choices and network boundaries.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).