技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
datafeed-inputmode【数据与研究】InputMode.SPARK data feeding, inference, and DataFeed queue semantics for TensorFlowOnSpark map_fun code.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill when the user is writing or debugging TensorFlowOnSpark InputMode.SPARK code where Spark RDD or DStream rows are fed into a TensorFlow map_fun(args, ctx) through TFNode.DataFeed.
TFCluster.train(dataRDD, num_epochs=..., feed_timeout=..., qname='input') data feeding for Spark RDDs and DStreams.TFCluster.inference(dataRDD, feed_timeout=..., qname='input') and its lazy output RDD.TFNode.DataFeed(ctx.mgr, ...) inside user map_fun code:
next_batch(batch_size)should_stop()batch_results(results)terminate()EndPartition, end-of-feed None, default input/output/error queues, feed_timeout, and worker exception propagation.TFEstimator / TFModel DataFrame workflows: use the spark-ml-pipelines sub-skill.dataframes-tfrecords sub-skill.TFParallel.run: use the cluster-lifecycle sub-skill.input_mode=TFCluster.InputMode.SPARK.TFNode.DataFeed(ctx.mgr) in map_fun, consume next_batch(), and call cluster.train(...) on the driver.TFNode.DataFeed(ctx.mgr, train_mode=False), return exactly one result for every input row via batch_results(), and call a Spark action on the RDD returned by cluster.inference(...).num_epochs, partition count, and training step limits so each worker gets enough data but does not leave excessive trailing partitions.feed_timeout for how long Spark feeder tasks should wait for the TensorFlow worker to consume queued input; use longer values for streaming or slow model steps only after verifying the worker is actively calling next_batch().cluster.shutdown(...) after cluster.train(...) or after the inference output RDD action completes. Use grace_secs if the TensorFlow code may export or raise a late exception after data feeding.EndPartition, early stop, and tensor mapping patterns.scripts/render_datafeed_template.py — render safe code templates without importing or running Spark or TensorFlow.For inference, the key invariant is: for every batch returned by next_batch(), batch_results() must receive the same number of results before the next partition can finish. For training, the key invariant is: the TensorFlow code must keep calling next_batch() until it has legitimately completed, then call terminate() if it exits before Spark has fed all planned input.