data-preparation
Prepare zi2zi paired glyph images and pickle streams from source/target fonts, charsets, labels, and rendered JPG directories.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- data-preparation
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Prepare zi2zi paired glyph images and pickle streams from source/target fonts, charsets, labels, and rendered JPG directories.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/data-formats.md2.8 KB
- 参考文档references/preprocessing-workflow.md2.9 KB
- 参考文档references/troubleshooting.md2.5 KB
- 脚本scripts/inspect_zi2zi_obj.py5.5 KB
- 脚本scripts/zi2zi_font_pair_planner.py6.3 KB
03 SKILL.md 正文
zi2zi data preparation
Use this sub-skill when the task is about creating or validating zi2zi input
data before training or inference. It covers the font-to-image renderer,
charset choices, label naming, JPG pair schema, train.obj/val.obj packaging,
and safe inspection of generated object files.
Use this sub-skill when
- The user has source and target font files and wants zi2zi training images.
- The user needs to choose between
CN,CN_T,JP,KR, or a custom charset. - The task mentions
font2img.py,package.py,sample_dir,label,filter,shuffle,train.obj,val.obj, or pickled(label, bytes)records. - Generated data is empty, labels are wrong, glyphs are missing, or a
.objfile cannot be read.
Route elsewhere
- For training, fine-tuning, losses, label shuffling during training, or checkpoints, read training-and-model.
- For checkpoint inference, interpolation, GIFs, or export, read inference-and-export.
- For Python/TensorFlow/SciPy compatibility that affects multiple workflows, read the root compatibility reference.
What zi2zi expects
- A rendered example is one JPG containing two square glyph canvases side by side: target style on the left, source style on the right.
- The filename must start with the integer embedding/style label followed by an
underscore, for example
0_0000.jpg. package.pyscans*.jpgfiles in one directory, parses labels from the filename prefix, and writes pickled(label, image_bytes)records intotrain.objandval.obj.train.pylater expects those object files underexperiment/data/unless the user deliberately changes the experiment layout.
Standard workflow
- Pick a source font and one or more target fonts.
- Assign each target font a stable integer label. Avoid reusing a label for a different target style within the same training run.
- Choose a built-in charset (
CN,CN_T,JP,KR) or create a one-line UTF-8 text file for a custom character set. - Render paired JPGs with
font2img.pysemantics. Use--filter=1when the target font may be missing glyphs, and--shuffle=1when you want a random sample from the charset. - Package the rendered JPG directory into
train.objandval.objwithpackage.pysemantics. - Inspect record counts and label distribution before training.
Read preprocessing-workflow.md for complete command templates, multi-font labeling, and validation steps. Read data-formats.md for exact image/object schemas and charset behavior. Read troubleshooting.md when fonts, charsets, filters, labels, or pickle streams fail.
Bundled helpers
- scripts/zi2zi_font_pair_planner.py
prints validated
font2img.pyandpackage.pycommand templates for one source font and one or more target fonts. - scripts/inspect_zi2zi_obj.py safely reads
zi2zi
.objpickle streams from Python 3 and reports record counts, labels, byte sizes, and optional image dimensions.
Quick checks before training
- The samples directory contains JPGs, not PNGs or nested directories.
- Every filename has an integer prefix before
_. - Label count equals or is less than
--embedding_numplanned for training. train.objandval.objboth exist, even if the validation split is small.- Inspecting a few records shows image bytes and expected labels.
- If validation is empty because the sample count is tiny and split randomness placed all examples in training, either accept that for a smoke test or create a deterministic tiny fixture outside the original script.
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).