TensorFlow
Log a human-readable version of your dataset. Galileo will join these samples with the model's outputs and present them in the Console.
TensorFlow
import dataquality as dq
dq.init(task_type="text_classification", # Change this based on your task type
project_name="example_tf_project",
run_name="example_tf_run")
# 🔭🌕 Log the class labels in the order they are outputted by the model
labels_list = ["positive review", "negative review", "very positive review", "very negative review"]
dq.set_labels_for_run(labels_list)
# 🔭🌕 Log your pandas/huggingface/tf datasets to Galileo
dq.log_dataset(train_dataset, split="train")
dq.log_dataset(test_dataset, split="test")
Log model outputs from your TensorFlow model's forward function.
Your model must be defined in the TF model-subclass-style and be executing eagerly.
TensorFlow
import tensorflow as tf
class TextClassificationModel(tf.keras.Model):
"""Defines a TensorFlow text classification model."""
...
def call(self, x, ids):
"""Model forward function."""
...
# classification_embedding has shape - [batch x emb_dim]
# Logits has shape - [batch x num_classes]
# Generally we select the [CLS] token for classification embedding
# 🔭🌕 Galileo logging
dq.log_model_outputs(
embs=classification_embedding,
logits=logits,
ids=ids
)
return logits
Now you are ready to train your model! Log where you are within the training pipeline (epoch and current split) and behind the scenes Galileo will track the different stages of training and will combine your model outputs with your logged input data.
Last modified 8mo ago