We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
While trying to get jsonargparse to work with defaults on activation functions, I ran into omni-us/jsonargparse#619 (comment)
jsonargparse
The preferred MWE from the developer there is repeated below
>>> from copy import deepcopy >>> from dataclasses import dataclass, asdict >>> from flax import nnx >>> from typing import Callable >>> @dataclass ... class Settings: ... width: int = 64 ... activation: Callable = nnx.relu ... final_activation: Callable = nnx.softplus >>> deepcopy(nnx.softplus) is nnx.softplus False >>> nnx.softplus <PjitFunction of <function softplus at 0x7d73a9f0fb50>> >>> deepcopy(nnx.softplus) <PjitFunction>
It seems like the issue is that a deepcopy and perhaps a asdict of the jit'd functions is failing or not supported.
deepcopy
asdict
As said in that post, the workaround shows there is no intrinsic reason deepcopy can't be supported. If we put
from types import MethodType nnx.softplus.__deepcopy__ = MethodType(lambda self, memo: self, nnx.softplus)
Then things work great.
This applies to all versions.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Description
While trying to get
jsonargparse
to work with defaults on activation functions, I ran into omni-us/jsonargparse#619 (comment)The preferred MWE from the developer there is repeated below
It seems like the issue is that a
deepcopy
and perhaps aasdict
of the jit'd functions is failing or not supported.As said in that post, the workaround shows there is no intrinsic reason
deepcopy
can't be supported. If we putThen things work great.
System info (python version, jaxlib version, accelerator, etc.)
This applies to all versions.
The text was updated successfully, but these errors were encountered: