Skip to content

Attribute finder doesn't check datamodule when hparams is set #4558

@rnett

Description

@rnett

🐛 Bug

Issue is seen here too: #3233 (comment)

See: https://github.com/rnett/pytorch-lightning/blob/6e5f232f5cec2b5e635ae34fa365c6b969d0902e/pytorch_lightning/utilities/parsing.py#L177

In pytorch_lightning.utilities.parsing.lightning_hasattr (and getattr and setattr), because hasattr(model, 'hparams') is used in the elif, checking only continues (i.e. to the dataloader) if hparams is not present. It does not continue if hparams is present, but does not have the attribute.

I can make a PR, but the semantics needs to be decided on first, especially when hparams is a dict: do we only see the attribute if it is already present in the dict? This is particularly important for making setting and getting match.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghelp wantedOpen to be worked on

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions