You can create a custom dataset composed of two datasets.
First read the following tutorial if you don’t know.
https://pytorch.org/tutorials/beginner/data_loading_tutorial.html#data-loading-and-processing-tutorial 4
For example:
class CustomDataset(Dataset):
    def __init__(self, dataset1, dataset2):
        self.dataset1 = dataset1
        self.dataset2 = dataset2

    def __len__(self):
        return len(self.dataset1)

    def __getitem__(self, idx):
        sample = {'data1': self.dataset1[idx], 'data2': self.dataset2[idx]}
        return sample