L1_Overview_of_Multimodality - Contrastive learning model don't fit

L1_Overview_of_Multimodality (first lab Jupyter Notebook) - Contrastive learning model don’t fit generating a very noise loss curve graph when in training mode (“train = True”).

Please, within the “Model Training” section remove or comment code “net = Network()” in the “train_model” function. See bellow:

Before:

def train_model(epoch_count=10):#
    net = Network()
    lrs = []
    losses = []

After:

def train_model(epoch_count=10):#
    # net = Network()
    lrs = []
    losses = []

To add support for GPU model training on MacOS with ARM processors (M1, M2,…) modify the code in the “Define the Training Configuration” section as follows:

net = Network()

device = 'cpu'
if torch.cuda.is_available():
    device = torch.device('cuda:0')
elif torch.backends.mps.is_available():
    device = torch.device("mps")

net = net.to(device)
device