Lightning-AI/pytorch-lightning

Lightning CLI should use fail_untyped=True

Open

#18.285 geöffnet am 11. Aug. 2023

Auf GitHub ansehen
 (4 Kommentare) (1 Reaktion) (1 zugewiesene Person)Python (3.233 Forks)batch import
3rd partybreaking changehelp wantedlightningclirefactor

Repository-Metriken

Stars
 (26.687 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 9T 15h) (3 gemergte PRs in 30 T)

Beschreibung

Outline & Motivation

Use fail_untyped=True here https://github.com/Lightning-AI/lightning/blob/97020bf8d7a88ca5195534b8585a5ef53f1ce6cb/src/lightning/pytorch/cli.py#L135 and here https://github.com/Lightning-AI/lightning/blob/97020bf8d7a88ca5195534b8585a5ef53f1ce6cb/src/lightning/pytorch/cli.py#L139

Pitch

I have spent quite a bit of time with the same issue described here https://github.com/Lightning-AI/lightning/issues/15741 . The person there also reported spending "several days". I finally figured it out when I created an isolated example with just jsonargparse which told me "Types as a string and from __future__ import annotations is currently not supported" . That was because CLI has fail_untyped=True by default . I do believe it would be better to have that as default to ease debugging. If not by default, maybe allow users to set that themselves.

I do know that from version 4.22 of jsonargparse this specific example is no longer an issue https://github.com/omni-us/jsonargparse/issues/120 , but my point is more about the general principle of having fail_untyped=True

Additional context

No response

cc @justusschock @awaelchli @borda @carmocca @mauvilsa

Contributor Guide