You should be able to specify the start method via:
torch.multiprocessing.set_start_method('spawn')

Using this approach, you might encounter another limitation of Python’s multiprocessing, which should work, if you import the Dataset from another script:
# dummy_dataloading.py
import torch
from torch.utils.data import Dataset

class DummyDataset(Dataset):
    def __init__(self, transform=None):
        super().__init__()
        self.transform = transform

    def __getitem__(self, idx):
        sample = torch.randn(2, 2, 2)

        if self.transform is not None:
            sample = self.transform(sample)
        return sample

    def __len__(self):
        return 10


class ToDevice(object):
    def __init__(self, device):
        self.device = device

    def __call__(self, sample):
        return sample.to(self.device)


class DummyModel(torch.nn.Module):
    def __init__(self):
        super().__init__()

    def forward(self, x):
        return torch.randn(2, 2, 2)

# main.py
import torch
torch.multiprocessing.set_start_method('spawn')
import torchvision
from torch.utils.data import DataLoader

from dummy_dataloading import ToDevice, DummyDataset, DummyModel


if __name__ == "__main__":
    device = torch.device("cuda")

    transform = None
    transform = torchvision.transforms.Compose([ToDevice(device)])  # A. commenting this removes exception

    dataset = DummyDataset(transform=transform)

    model = DummyModel().to(device)
    #model = torch.nn.DataParallel(model, device_ids=[0])  # B. or commenting this - same story

    loader = DataLoader(dataset, num_workers=4)  # C. or setting num_workers=0
    for sample in loader:
        print(sample)
        break

However, the usual approach would be to load the data onto the CPU and transfer each sample to the GPU to

save GPU memory
hide the loading latency by the actual GPU workload (model training)

If you are working with a small dataset and can fit it easily on the GPU, you could probably avoid using a DataLoader at all (or just slice the samples in the main process).