To change the batch size, just pass the value to batch_size in your DataLoader:
dataloader = data.DataLoader(
    image_datasets['train'],
    num_workers=2,
    batch_size=16,
    sampler=sampler
)

Could you run your code in CPU and see, if you’ll get any error message?
If the code runs fine, try to run it with:
CUDA_LAUNCH_BLOCKING=1 python script.py args

Since CUDA calls are asynchronous, the stack trace might point to a wrong line of code.
After your script crashes again, could you post the error message with the stack trace again?