NVlabs / stylegan3

Official PyTorch implementation of StyleGAN3
Other
6.38k stars 1.12k forks source link

[Discriminator] Forward() results in 'NoneType' object has no attribute 'dtype' #636

Open LeWentz opened 6 months ago

LeWentz commented 6 months ago

When training a new dataset using the train.py likes this on Windows 11 in a conda env:

python train.py --outdir="C:\\Models\\styleGANv3" --cfg=stylegan3-t --data="C:\\Datasets\\ABC\\" --batch=32 --gpus=1 --gamma=8.2 --aug=noaug

I get an Error on the Forward() of the Discriminator.

'NoneType' object has no attribute 'dtype'

The reason for that is x=None in the following code snippet.

https://github.com/NVlabs/stylegan3/blob/c233a919a6faee6e36a316ddd4eddababad1adf9/training/networks_stylegan2.py#L778-L783

The actual Error is then raised here, when x.dtype is accessed:

https://github.com/NVlabs/stylegan3/blob/c233a919a6faee6e36a316ddd4eddababad1adf9/training/networks_stylegan2.py#L176-L177

Also the first argument just passes x to the function which directly asserts x is not None: https://github.com/NVlabs/stylegan3/blob/c233a919a6faee6e36a316ddd4eddababad1adf9/torch_utils/ops/conv2d_resample.py#L71

My Question is: Why is x=None and is that supposed to work? I feel like x should be a Tensor of an actual image and not None. I see others here training successfully and think, that the error seems on my side.

Neilstid commented 6 months ago

I think this kind of error may appear if you have either an empty directory or images in a wrong format (and thus can't be red by the loader). Is your images in either .jpg or .png ? Also try to print the path when it loads an image this could help.