Unrecognized tensor type ID: PythonTLSSnapshot

I am trying to train an encoder of a GAN model,

latent = encoder(real_img.to(torch.float32))
fake_img, fake_seg = generator([latent], input_is_latent=True)
# InputType:  torch.float32 
# InputShape:  torch.Size([1, 3, 256, 256]) 
# UniqueValues:  tensor([-1609.6704, -1520.1901, -1462.0510,  ...,  6500.6426,  6592. 7332.2651], device='cuda:0')

I get this error for generator
Unrecognized tensor type ID: PythonTLSSnapshot

Could you post a minimal, executable code snippet to reproduce the issue as well as the output of python -m torch.utils.collect_env, please?

I used random input for latent and had the same error.
I did clone the generator (Stylegan2) again, and it is working.
I think I had changed somewhere of the source code to adapt it for my input and it was producing the error.
However is there any source to read more about type IDs?