examples-conversion
Convert TensorFlow, Keras, Estimator, and tutorial examples into TensorFlowOnSpark spark-submit workflow plans.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- examples-conversion
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Convert TensorFlow, Keras, Estimator, and tutorial examples into TensorFlowOnSpark spark-submit workflow plans.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/conversion-patterns.md10.1 KB
- 参考文档references/deployment-and-serving.md7.5 KB
- 参考文档references/mnist-workflows.md9.9 KB
- 参考文档references/troubleshooting.md7.8 KB
- 脚本scripts/render_spark_submit_plan.py13.8 KB
03 SKILL.md 正文
examples-conversion
Use this operating sub-skill when a user wants to convert or adapt an existing TensorFlow, Keras, Estimator, ResNet, segmentation, or MNIST tutorial into a TensorFlowOnSpark workflow that can be launched with spark-submit.
This sub-skill is a router and checklist. Put low-level API details in the owning sub-skills; use this sub-skill to decide the workflow shape, Spark command, deployment assumptions, and validation signals.
Route by user intent
| User intent | Use this file |
|---|---|
| Decide how to wrap existing TensorFlow code for TensorFlowOnSpark | references/conversion-patterns.md |
| Build Keras or Estimator MNIST train, inference, pipeline, or streaming command plans | references/mnist-workflows.md |
| Plan SavedModel inspection, TF Serving, Spark batch inference, local standalone, or YARN deployment | references/deployment-and-serving.md |
| Diagnose failed conversions, missing Spark/JVM/classpath, stalled jobs, input-mode mistakes, SavedModel issues, or serving hazards | references/troubleshooting.md |
| Render a dry-run command plan from caller-supplied paths | scripts/render_spark_submit_plan.py |
Boundary and handoff rules
- For
TFCluster.run, reservation, TensorBoard, executor count, GPU/resource, shutdown, orTFParallel.runinternals, route to the cluster-lifecycle sub-skill. - For
InputMode.SPARKqueue semantics,TFNode.DataFeed, one-output-per-input inference,next_batch,batch_results,terminate, or feed timeouts, route to the datafeed-inputmode sub-skill. - For Spark ML
TFEstimator,TFModel, input/output mappings, and DataFrame transform details, route to the spark-ml-pipelines sub-skill. - For Spark DataFrame to TFRecord conversion,
dfutil, TensorFlow Hadoop jar/classpath, and MNIST row reshaping utilities, route to the dataframes-tfrecords sub-skill. - Treat downloads, Docker, host Spark installation, and EC2/cloud deployment scripts as reference-only. Do not execute them from this skill.
Default conversion procedure
- Identify whether the original TensorFlow program already reads its own data (
InputMode.TENSORFLOW) or should consume a Spark RDD/DataFrame (InputMode.SPARK). - Wrap the TensorFlow entrypoint as
main_fun(args, ctx)ormain_fun(argv, ctx)and create a small Spark driver that callsTFCluster.run. - Render a
spark-submitcommand with explicit--master, executor/core settings, application script path, cluster size, data/model/export paths, and optional--py-filesor--jars. - Check that every worker can see the data path, model/export path, Python dependencies, and optional TensorFlow Hadoop jar.
- Validate by observing cluster startup, TensorFlow workers connecting, output checkpoint/export directories appearing, and either predictions or SavedModel signatures matching the expected tensors.
Safe helper usage
The bundled helper only prints a plan. It does not start Spark, run Docker, download data, remove files, or mutate the host.
python scripts/render_spark_submit_plan.py --help
Use caller-provided concrete paths whenever possible. If reusing shell variables in the printed plan, review quoting before running the rendered command manually.
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).