TensorFlow
knowledge skill
Train or load a TensorFlow model from data, then export the trained model artifact. Produces a saved_model.pb directory containing weights and graph for later inference.
Worked examples
- {"input": {"model_spec": "https://storage.googleapis.com/tf_models/v1/resnet50_saved_model.pb", "data": "ndarray(shape=(1000,224,224,3), dtype=float32)", "labels": "ndarray(shape=(1000,1000), dtype=float32)", "hyperparams": {"learning_rate": 0.001, "epochs": 10, "batch_size": 32}}, "output": {"model_path": "/tmp/trained_resnet50/1/", "metrics": {"loss": 0.12, "accuracy": 0.95}, "graph_summary": "node { name: \"input\" ... }"}}
- {"input": {"model_spec": "./bert_base_uncased", "data": "tf.data.Dataset.from_tensor_slices((texts, labels))", "labels": "tf.constant([0,1,1,...], shape=(N,))", "hyperparams": {"learning_rate": 3e-05, "epochs": 3, "batch_size": 16}}, "output": {"model_path": "/tmp/bert_finetuned/2/", "metrics": {"loss": 0.45, "accuracy": 0.88}, "graph_summary": "node { name: \"bert/encoder\" ... }"}}
Input
- model_spec: string/URL or local path to a TensorFlow SavedModel or checkpoint
- data: tensor or array of numeric training examples
- labels: tensor or array of numeric labels
- hyperparams: object/learning_rate:float, epochs:int, batch_size:int
Output
- model_path: string/local filesystem path to exported SavedModel directory
- metrics: object/loss:float, accuracy:float
- graph_summary: string/text protobuf graph summary
Details
- Skill type: knowledge skill
- Safety level: safe_public_research
- Version: 1.0.0