zi2zi
Operate zi2zi legacy Chinese/Japanese/Korean font style transfer workflows: paired glyph data preparation, TensorFlow 1.x training, inference, interpolation, and generator export.
Files23
View on GitHubSKILL.mdskills/repositories/repo-skills/zi2zi/SKILL.md
GitHubzi2zi
Use this repo skill when a task is about zi2zi, the legacy TensorFlow 1.x conditional GAN for Chinese, Japanese, Korean, or other font style transfer. The skill is a router plus compact operating context; read the linked sub-skills for concrete commands, data formats, validation checks, and troubleshooting.
Use this skill when
- The user wants to create zi2zi training data from source/target fonts.
- The user has glyph pair JPGs and needs
train.obj/val.objfiles. - The user wants to train or fine-tune zi2zi's conditional adversarial U-Net.
- The user wants to run generator inference, interpolate between style labels, create transition frames/GIFs, or export generator weights.
- The user needs help debugging legacy Python 2.7, TensorFlow 1.x, Pillow, scipy image I/O, checkpoint, label, or experiment-layout problems in a zi2zi workflow.
Avoid this skill when
- The task is a general pix2pix, CycleGAN, diffusion, OCR, or font-rendering question with no zi2zi command/API surface.
- The user is asking to port zi2zi to TensorFlow 2/PyTorch; this skill can explain the legacy model but does not provide a porting recipe.
- The user needs a modern packaged library with importable Python APIs; zi2zi is primarily a script-based repository, not an installable distribution.
Runtime expectations
For freshness checks, read repo provenance before using this skill against a different zi2zi checkout.
- zi2zi is legacy Python 2.7 + TensorFlow 1.x code. Do not assume Python 3,
TensorFlow 2, or current
scipy.miscAPIs work with the original scripts. - Practical training and checkpoint inference were designed for CUDA/cuDNN, but full training is long-running and should not be launched without explicit user approval, data, output location, and hardware budget.
- No pretrained checkpoint or font files are bundled in this skill. When a task
needs real training or inference, confirm the user has source/target fonts,
packaged
.objdata, or a TensorFlow checkpoint. - The bundled scripts in this skill are safe Python 3 planners/inspectors. They help construct commands and validate artifacts; they are not replacements for zi2zi's full TensorFlow model implementation.
Public install and verification direction
Use an isolated legacy environment for the original zi2zi scripts. A typical Conda direction is:
conda create -n zi2zi-legacy python=2.7 pip
conda install -n zi2zi-legacy tensorflow-gpu=1.15 scipy imageio pillow functools32
Then verify parser/import readiness from a zi2zi checkout:
python font2img.py --help
python package.py --help
python train.py --help
python infer.py --help
python export.py --help
Do not run long training or checkpoint inference until the user confirms data, checkpoint paths, GPU/runtime readiness, and output locations.
Route map
| If the task is about... | Read |
|---|---|
Rendering paired glyph images, choosing CJK/custom charsets, label prefixes, packaging JPGs into .obj, or inspecting packaged data |
data-preparation |
Training or fine-tuning, experiment directories, losses, label shuffling, freeze_encoder, fine_tune, checkpoints, samples, or model architecture |
training-and-model |
| Generator inference, random style IDs, interpolation frames/GIFs, output image names, checkpoint restore, or generator-only export | inference-and-export |
| End-to-end flow across all stages | workflow overview |
| Legacy dependency and backend compatibility | compatibility |
| Cross-cutting failures that affect multiple stages | troubleshooting |
Standard end-to-end flow
- Use
font2img.pysemantics to render source/target glyph pairs. The target glyph occupies the left half of each JPG, the source glyph the right half, and the filename prefix stores the style label. - Use
package.pysemantics to createtrain.objandval.obj, each a stream of pickled(label, image_bytes)records. - Place those files under an experiment data directory, normally
experiment/data/train.objandexperiment/data/val.obj. - Train with
train.py, which creates per-experiment checkpoint, log, and sample directories and saves checkpoints under a batch-size-specific name. - Run
infer.pyfrom a trained generator checkpoint, optionally interpolating style embeddings and compiling frames into a GIF. - Use
export.pyonly when a generator-only checkpoint is needed for later inference or transfer.
Useful bundled helpers
- Run scripts/zi2zi_smoke_plan.py when you need a safe checklist of zi2zi files, dependencies, and native smoke commands for a user's checkout.
- Use the data-preparation planners before writing or executing destructive preprocessing commands.
- Use the training and inference planners to validate paths, labels, and command flags before launching long TensorFlow jobs.
Verification baseline
During skill construction, safe checks covered Python 2.7 dependency imports,
all five original script --help parsers, and a CPU-hidden TensorFlow 1.15
UNet graph build. Full CUDA training and checkpoint-backed inference/export
were intentionally not run because they require user-provided fonts/data or
checkpoints and a legacy CUDA runtime budget. Preserve that distinction when
answering runtime-readiness questions.