Open dfuchsgruber opened 1 year ago
This looks to be a typeguard bug. Here's a repro without using jaxtyping at all:
from typing_extensions import Annotated
from typeguard import typechecked
@typechecked
def foo(x: Annotated[int, 'a b c']):
return 1
I'd suggest raising this as an issue on the typeguard issue tracker!
Wasn't sure if typeguard is supposed to be able to handle "arbitrary" annotations, as it seems to only support things that are parsable by ast
. Anyway, I'm gonna open a typeguard issue to get response from the devs there, thanks :)
(oups, wrong issue)
FWIW I think this is now fixed with more recent typeguard releases, if anyone else would like to confirm.
@patrick-kidger the issue has not been fixed but the issue has been closed on the typeguard repo (https://github.com/agronholm/typeguard/issues/353 for anyone else running into this). My solution has been to downgrade to a pre 4.0 version of typeguard for the moment.
I was updating my typeguard version to the latest release on Github: https://github.com/agronholm/typeguard (4.0.0rc5), and now get conflicts when trying to shape annotate torch Tensors (the code was working fine with previous typeguard versions). In particular running the following simple snippet:
Will throw this error:
Seems like typeguard is parsing the annotation
"a b c"
withast
, which does not like this format. Is there any workaround for this? I need the latest typeguard version as earlier versions do not seem to support annotating@property
decorated functions.Relevant versions of typeguard and `jaxtyping: