pix2code
Operate the pix2code research repository for GUI screenshot-to-DSL experiments, legacy Keras/TensorFlow training, model sampling, and DSL compilation to web, Android, or iOS code.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- pix2code
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Operate the pix2code research repository for GUI screenshot-to-DSL experiments, legacy Keras/TensorFlow training, model sampling, and DSL compilation to web, Android, or iOS code.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/package-overview.md3.8 KB
- 参考文档references/repo-provenance.md2.2 KB
- 参考文档references/repo-routing-metadata.json324 B
- 参考文档references/troubleshooting.md2.8 KB
- 脚本scripts/check_pix2code_environment.py2.2 KB
03 SKILL.md 正文
pix2code Repo Skill
Use this skill when a task involves the pix2code research codebase: turning GUI screenshot datasets into training examples, training or inspecting the legacy Keras/TensorFlow model, generating the pix2code DSL from screenshots, or compiling .gui DSL files into web, Android, or iOS scaffold code.
pix2code is an educational 2017 research prototype. Treat it as historical ML code, not a production UI generator. Prefer small, deterministic checks and explicit artifact validation before attempting model training or inference.
Start here
- Read references/repo-provenance.md before deciding whether this skill matches a checkout or needs a refresh.
- Read references/package-overview.md for repository layout, dependency constraints, and source facts shared across workflows.
- Run or adapt scripts/check_pix2code_environment.py when the task starts with setup, dependency diagnosis, or legacy TensorFlow/Keras compatibility.
- Route to the focused sub-skill below; do not reopen original repo scripts unless the user is explicitly maintaining the checkout.
Install and inspection baseline
The original README listed Python 2 or 3 and these historical pins:
Keras==2.1.2
numpy==1.13.3
opencv-python==3.3.0.10
h5py==2.7.1
tensorflow==1.4.0
For modern hosts, expect to use an isolated legacy Python environment. The old OpenCV pin may no longer be available from current package indexes; use the troubleshooting reference before changing versions. A minimal inspection check is:
python scripts/check_pix2code_environment.py --include-ml
The repository is not a packaged Python distribution with console entry points. Its scripts rely on working from either the model/ or compiler/ source directories. This generated skill therefore bundles safer helpers that are self-contained and runnable from arbitrary directories.
Route map
| Task intent | Read this |
|---|---|
Prepare pix2code datasets, validate .gui/image pairs, split train/eval sets, convert screenshots to .npz, or plan legacy training commands. |
sub-skills/data-and-training/SKILL.md |
Validate trained artifacts, choose greedy versus beam search, diagnose missing pix2code.json / .h5 / meta_dataset.npy / words.vocab, or explain batch versus single-image generation. |
sub-skills/sampling-and-generation/SKILL.md |
Compile a .gui DSL file to web Bootstrap HTML, Android XML, or iOS Storyboard, inspect DSL tokens, or debug malformed DSL nesting. |
sub-skills/dsl-compilation/SKILL.md |
| Diagnose install/import failures, stale helper behavior, unavailable pretrained results, or research-prototype limitations shared by multiple workflows. | references/troubleshooting.md |
Operating rules
- Keep user-facing instructions self-contained. Use bundled scripts and references in this skill rather than relying on original checkout scripts.
- Avoid full training unless the user explicitly accepts a long-running legacy TensorFlow/Keras job and has the data unpacked.
- Treat GPU acceleration as optional for this skill. CPU validates dataset handling and DSL compilers; paper-scale training speed or model quality is not verified by CPU checks.
- Validate generated or user-supplied
.guifiles before compiling them. Unknown tokens raiseKeyErrorin the original compiler; use the bundled compiler's clearer diagnostics. - Verify trained artifact directories before sampling. pix2code inference requires the JSON architecture, HDF5 weights, NumPy metadata, and vocabulary files to agree.
- Record any dependency substitutions separately from model-quality claims. A successful import of modern or substituted packages does not prove the 2017 paper result.
Common deliverables
- A cleaned or validated pix2code dataset layout with paired
.guiand.png/.npzfiles. - A command plan for legacy model training that distinguishes in-memory versus generator mode.
- A trained-artifact validation report before sampling screenshots.
- A compiled HTML/XML/Storyboard scaffold from a DSL fixture using bundled compiler logic.
- A troubleshooting note that names whether the blocker is dependency compatibility, missing data, missing trained weights, malformed DSL, or a research-code limitation.
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).