I did in this way:
def train(net, loaders, optimizer, criterion, epochs=10, dev=dev, save_param = False, model_name="valerio"):
    loaders_mnist, loaders_cifar = loaders
    try:
        net = net.to(dev)
        #print(net)
        # Initialize history
        history_loss = {"train": [], "val": [], "test": []}
        history_accuracy = {"train": [], "val": [], "test": []}
        # Store the best val accuracy
        best_val_accuracy = 0

        # Process each epoch
        for epoch in range(epochs):
            # Initialize epoch variables
            sum_loss = {"train": 0, "val": 0, "test": 0}
            sum_accuracy = {"train": 0, "val": 0, "test": 0}
            # Process each split
            for split in ["train", "val", "test"]:
                if split == "train":
                  net.train()
                else:
                  net.eval()
                # Process each batch
                for ((input_mnist, labels_mnist), (input_cifar, labels_cifar)) in zip(loaders_mnist[split], loaders_cifar[split]):
                #for (input, labels) in loaders[split]:
                    # Move to CUDA
                    input_mnist = input_mnist.to(dev)
                    labels_mnist = labels_mnist.to(dev)
                    input_cifar = input_cifar.to(dev)
                    labels_cifar = labels_cifar.to(dev)
                    # Reset gradients
                    optimizer.zero_grad()
                    # Compute output
                    pred = net(input_mnist, input_cifar)
                    #pred = pred.squeeze(dim=1) # Output shape is [Batch size, 1], but we want [Batch size]
                    labels = labels.unsqueeze(1)
                    labels = labels.float()
                    loss = criterion(pred, labels)
                    # Update loss
                    sum_loss[split] += loss.item()
                    # Check parameter update
                    if split == "train":
                        # Compute gradients
                        loss.backward()
                        # Optimize
                        optimizer.step()
                    # Compute accuracy
                    #pred_labels = pred.argmax(1) + 1
                    pred_labels = (pred >= 0.5).long() # Binarize predictions to 0 and 1
                    batch_accuracy = (pred_labels == labels).sum().item()/input.size(0)
                    # Update accuracy
                    sum_accuracy[split] += batch_accuracy
            # Compute epoch loss/accuracy
            epoch_loss = {split: sum_loss[split]/len(loaders[split]) for split in ["train", "val", "test"]}
            epoch_accuracy = {split: sum_accuracy[split]/len(loaders[split]) for split in ["train", "val", "test"]}

            # Store params at the best validation accuracy
            if save_param and epoch_accuracy["val"] > best_val_accuracy:
              #torch.save(net.state_dict(), f"{net.__class__.__name__}_best_val.pth")
              torch.save(net.state_dict(), f"{model_name}_best_val.pth")
              best_val_accuracy = epoch_accuracy["val"]

            # Update history
            for split in ["train", "val", "test"]:
                history_loss[split].append(epoch_loss[split])
                history_accuracy[split].append(epoch_accuracy[split])
            # Print info
            print(f"Epoch {epoch+1}:",
                  f"TrL={epoch_loss['train']:.4f},",
                  f"TrA={epoch_accuracy['train']:.4f},",
                  f"VL={epoch_loss['val']:.4f},",
                  f"VA={epoch_accuracy['val']:.4f},",
                  f"TeL={epoch_loss['test']:.4f},",
                  f"TeA={epoch_accuracy['test']:.4f},")
    except KeyboardInterrupt:
        print("Interrupted")
    finally:
        # Plot loss
        plt.title("Loss")
        for split in ["train", "val", "test"]:
            plt.plot(history_loss[split], label=split)
        plt.legend()
        plt.show()
        # Plot accuracy
        plt.title("Accuracy")
        for split in ["train", "val", "test"]:
            plt.plot(history_accuracy[split], label=split)
        plt.legend()
        plt.show()

# Train model
train(modelcombo, (loaders, loaders_cifar), optimizer, criterion, epochs=3, dev=dev)

I have this error:
---------------------------------------------------------------------------

UnboundLocalError                         Traceback (most recent call last)

<ipython-input-120-991dbce10c53> in <module>()
      1 # Train model
----> 2 train(modelcombo, (loaders, loaders_cifar), optimizer, criterion, epochs=3, dev=dev)

<ipython-input-119-8f7766b35a35> in train(net, loaders, optimizer, criterion, epochs, dev, save_param, model_name)
     34                     pred = net(input_mnist, input_cifar)
     35                     #pred = pred.squeeze(dim=1) # Output shape is [Batch size, 1], but we want [Batch size]
---> 36                     labels = labels.unsqueeze(1)
     37                     labels = labels.float()
     38                     loss = criterion(pred, labels)

UnboundLocalError: local variable 'labels' referenced before assignment

Obviously I tried to fix, with the above code, but I failed:
def train2(net, loaders, optimizer, criterion, epochs=10, dev=dev, save_param = False, model_name="valerio"):
    loaders_mnist, loaders_cifar = loaders
    try:
        net = net.to(dev)
        #print(net)
        # Initialize history
        history_loss = {"train": [], "val": [], "test": []}
        history_accuracy = {"train": [], "val": [], "test": []}
        # Store the best val accuracy
        best_val_accuracy = 0

        # Process each epoch
        for epoch in range(epochs):
            # Initialize epoch variables
            sum_loss = {"train": 0, "val": 0, "test": 0}
            sum_accuracy = {"train": 0, "val": 0, "test": 0}
            # Process each split
            for split in ["train", "val", "test"]:
                if split == "train":
                  net.train()
                else:
                  net.eval()
                # Process each batch
                for ((input_mnist, labels_mnist), (input_cifar, labels_cifar)) in zip(loaders_mnist[split], loaders_cifar[split]):
                #for (input, labels) in loaders[split]:
                    # Move to CUDA
                    input_mnist = input_mnist.to(dev)
                    labels_mnist = labels_mnist.to(dev)
                    input_cifar = input_cifar.to(dev)
                    labels_cifar = labels_cifar.to(dev)
                    # Reset gradients
                    optimizer.zero_grad()
                    # Compute output
                    pred = net(input_mnist, input_cifar)
                    #pred = pred.squeeze(dim=1) # Output shape is [Batch size, 1], but we want [Batch size]
                    labels_mnist = labels_mnist.unsqueeze(1)
                    labels_mnist = labels_mnist.float()
                    labels_cifar = labels_cifar.unsqueeze(1)
                    labels_cifar = labels_cifar.float()
                    labels = labels_mnist, labels_cifar
                    loss = criterion(pred, labels)
                    # Update loss
                    sum_loss[split] += loss.item()
                    # Check parameter update
                    if split == "train":
                        # Compute gradients
                        loss.backward()
                        # Optimize
                        optimizer.step()
                    # Compute accuracy
                    #pred_labels = pred.argmax(1) + 1
                    pred_labels = (pred >= 0.5).long() # Binarize predictions to 0 and 1
                    batch_accuracy = (pred_labels == labels).sum().item()/input.size(0)
                    # Update accuracy
                    sum_accuracy[split] += batch_accuracy
            # Compute epoch loss/accuracy
            epoch_loss = {split: sum_loss[split]/len(loaders[split]) for split in ["train", "val", "test"]}
            epoch_accuracy = {split: sum_accuracy[split]/len(loaders[split]) for split in ["train", "val", "test"]}

            # Store params at the best validation accuracy
            if save_param and epoch_accuracy["val"] > best_val_accuracy:
              #torch.save(net.state_dict(), f"{net.__class__.__name__}_best_val.pth")
              torch.save(net.state_dict(), f"{model_name}_best_val.pth")
              best_val_accuracy = epoch_accuracy["val"]

            # Update history
            for split in ["train", "val", "test"]:
                history_loss[split].append(epoch_loss[split])
                history_accuracy[split].append(epoch_accuracy[split])
            # Print info
            print(f"Epoch {epoch+1}:",
                  f"TrL={epoch_loss['train']:.4f},",
                  f"TrA={epoch_accuracy['train']:.4f},",
                  f"VL={epoch_loss['val']:.4f},",
                  f"VA={epoch_accuracy['val']:.4f},",
                  f"TeL={epoch_loss['test']:.4f},",
                  f"TeA={epoch_accuracy['test']:.4f},")
    except KeyboardInterrupt:
        print("Interrupted")
    finally:
        # Plot loss
        plt.title("Loss")
        for split in ["train", "val", "test"]:
            plt.plot(history_loss[split], label=split)
        plt.legend()
        plt.show()
        # Plot accuracy
        plt.title("Accuracy")
        for split in ["train", "val", "test"]:
            plt.plot(history_accuracy[split], label=split)
        plt.legend()
        plt.show()

Error:
---------------------------------------------------------------------------

AttributeError                            Traceback (most recent call last)

<ipython-input-113-96aba51d9c54> in <module>()
      1 # Train model
----> 2 train2(modelcombo, (loaders, loaders_cifar), optimizer, criterion, epochs=3, dev=dev)

3 frames

/usr/local/lib/python3.7/dist-packages/torch/nn/functional.py in binary_cross_entropy_with_logits(input, target, weight, size_average, reduce, reduction, pos_weight)
   2824         reduction_enum = _Reduction.get_enum(reduction)
   2825 
-> 2826     if not (target.size() == input.size()):
   2827         raise ValueError("Target size ({}) must be the same as input size ({})".format(target.size(), input.size()))
   2828 

AttributeError: 'tuple' object has no attribute 'size'