Text Classification - Jupyter Notebook
Trains is now ClearML
This documentation applies to the legacy Trains versions. For the latest documentation, see ClearML.
The example text_classification_AG_NEWS.ipynb demonstrates using Juypter Notebook for Trains, and the integration of Trains into code which trains a network to classify text in the torchtext
AG_NEWS dataset, and then applies the model to predict the classification of sample text. Trains automatically logs the scalar and console output by calling TensorBoard methods. In the example, we explicitly log parameters with the Task. When the script runs, it creates an experiment named text classifier
which is associated with the Text Example
project.
Scalars
Accuracy, learning rate, and training loss appear in RESULTS > SCALARS, along with the resource utilization plots, which are titled :monitor: machine.
Hyperparameters
Trains automatically logs the command line options, because the example code uses argparse
. A parameter dictionary is logged by connecting it to the Task using a call to the Task.connect method.
configuration_dict = {'number_of_epochs': 6, 'batch_size': 16, 'ngrams': 2, 'base_lr': 1.0}
configuration_dict = task.connect(configuration_dict) # enabling configuration override by trains
Command line options appear in CONFIGURATIONS > HYPER PARAMETERS > Args.
Parameter dictionaries appear in the General subsection.
Log
Text printed to the console for training progress, as well as all other console output, appear in RESULTS > LOG.