Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
LeWentz opened this issue Mar 22, 2024 · 1 comment

Comments

@LeWentz
Copy link

LeWentz commented Mar 22, 2024

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.

def forward(self, img, c, update_emas=False, **block_kwargs):
_ = update_emas # unused
x = None
for res in self.block_resolutions:
block = getattr(self, f'b{res}')
x, img = block(x, img, **block_kwargs)

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

x = conv2d_resample.conv2d_resample(x=x, w=w.to(x.dtype), f=self.resample_filter, up=self.up, down=self.down, padding=self.padding, flip_weight=flip_weight)

Also the first argument just passes x to the function which directly asserts x is not None:

assert isinstance(x, torch.Tensor) and (x.ndim == 4)

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
Copy link

Neilstid commented Apr 2, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants