Variable vs VariableState #4465
Replies: 1 comment
-
i understand, now. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a question regarding the difference between the two. This question came to mind because of the
nnx.get_partition_spec()
functionality.What I’m trying to do is create function a that automatically create
PartitionSpec
by inferring the shape of the parameters and the mesh configuration.When I try to do this:
It results in an error:
x
has no attributeshape
. But when I run the following code:It runs fine.
If I understand correctly, the
variablelib.Variable
corresponds toparam.value
, so it has the.shape
and even.sharding
properties (even though it's still the unsharded one). But what exactly isVariableState
used for, and what is the corresponding part in thennx.Module
class? Also, why doesnnx.get_partition_spec()
perform the tree mapping withVariableState
as the definition of leaf?Beta Was this translation helpful? Give feedback.
All reactions