<jupyter_start><jupyter_text>Training Process<jupyter_code>import numpy as np

from pathlib import Path
from end2you.training_process import TrainingProcess
from end2you.utils import Params<jupyter_output><empty_output><jupyter_text>We use the class `Params` to elegantly define the parameters required for the training process.The parameters for the training process are the following:```- train: The parameters for the training process.    - batch_size        : The batch size to load.    - is_training       : If the loader is used in training or evaluation (always True here).    - cuda              : Load data in cuda.    - num_workers       : Number of workers to use to load data.    - seq_length        : Number of consecutive frames to load per batch.    - modality          : Modality to be used for. Values [`audio`, `visual`, `audiovisual`].    - dataset_path      : Path to training .hdf5 files.    - summarywriter_file: Name of the summarywriter file.    - num_epochs        : Number of epochs to perform training.    - save_summary_steps: Every which step to perform evaluation in training.    - loss              : Loss function to use. One of [`mse`, `ccc`, `ce`].    - learning_rate     : The learning rate to use for training.    - optimizer         : Optimizer to use. One defined in PyTorch (default `adam`).- valid: The parameters for the validation process.    - summarywriter_file: Name of the summarywriter file.    - dataset_path      : Path to validation .hdf5 files.    - metric            : Metric to use for evaluation. One of [`ccc`, `uar`, `mse`].    - cuda              : Load data in cuda (should be same as in train).    - num_workers       : Number of workers to use to load data.    - modality          : Modality to be used for. Values `audio`, `visual`, `audiovisual`.    - is_training       : If the loader is used in training or evaluation (always False here).    - batch_size        : Always 1.    - save_summary_steps: Always 1.    - seq_length        : Number of consecutive frames to load per batch.- model: The parameters of the model.    - model_name: The name of the model to use.    - num_outs: The number of outputs of the model.- root_dir: Path to save the output files of end2you.- log_file: Path to save log file- ckpt_path: Path to checkpoint. If not defined training starts from scratch.- num_gpus: Number of GPUs to use. Need to have more than one defined with `CUDA_VISIBLE_DEVICES`.```Example:<jupyter_code>params = Params(dict_params={
    'train':Params(dict_params={'loss':'ccc',
                                'dataset_path':'/path/to/train/hdf5/files',
                                'optimizer':'adam',
                                'learning_rate':0.0002,
                                'summarywriter_file':'train_sw',
                                'num_epochs':50,
                                'num_workers':2,
                                'cuda':True, 
                                'modality':'audio',
                                'batch_size':3,
                                'is_training':True, # Always True
                                'save_summary_steps':10, 
                                'seq_length': 150
                               }),
    'valid':Params(dict_params={'summarywriter_file':'eval_sw',
                                'metric':'ccc',
                                'dataset_path':'/path/to/valid/hdf5/files',
                                'num_workers':2,
                                'cuda':True,  
                                'modality':'audio',
                                'batch_size':1, # Always 1
                                'save_summary_steps':1, # Always 1
                                'is_training':False, # Always False
                                'seq_length': 150
                              }),
    'model':Params(dict_params={'model_name':'emo18', 'num_outs':3}),
    'root_dir':'./path/to/save/output/files/of/end2you',
    'log_file':'training.log',
    'ckpt_path': None,
    'num_gpus':1
})<jupyter_output><empty_output><jupyter_text>Defining the parameters we can now invoke the TrainingProcess class and start the training.For example<jupyter_code>training = TrainingProcess(params)
training.start()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09141660851360782, 'fraction_numerical': 0.00837404047452896, 'mean_word_length': 1.862849533954727, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '395534', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1167, 'n_tokens_neox': 1105, 'n_words': 363, 'path': 'docs/tutorials/3. Training Process.ipynb', 'repo_name': 'mauricege/end2you', 'size': '4299'}