Thanks for the code snippet.
You are currently creating the model instance as well as other objects at the module-level, which will most likely create the issue on Windows.
Move all instantiations into a method e.g. def main() and don’t initialize anything on the module level.
In particular, move:
ngpu=1
device = torch.device("cuda:0" if (torch.cuda.is_available() and ngpu > 0) else "cpu")
dataload=dataset3D(transform=None)

dataloader = torch.utils.data.DataLoader(dataload, batch_size=20,
                                         shuffle=True, num_workers=0)

model_3d= Gen_model_3D()
optimizer_gen = torch.optim.Adam(model_3d.parameters(), lr=1E-5,
               weight_decay=1e-6)

to a new method (call it main) and execute train from there.
The background for this issue and why the if-clause protection is needed is described in this StackOverflow post 3 (I’ve posted this link already in this thread in a previous post).
The GPU memory increase in your current code snippet is thus most likely caused, because Windows needs to execute all module-level code in each child process.