Skip to content

Explicit naming of modules #2046

Answered by marcvanzee
sanchit-gandhi asked this question in Q&A
Discussion options

You must be logged in to vote

Disclaimer: I am not a Pytorch expert.

It seems a Pytorch state dict and Flax parameters are essential two different things, so you shouldn't need to make them the same if you want your Flax and Pytorch models to behave the same.

Because Flax Modules are stateless, we do not use a state dict (Modules are instantiated with parameters only during apply and init, and immediately destroyed afterwards). A Flax parameter dict is exactly what the name says: a dictionary of all parameters used in the Module. While you define the Module inside WrapperModule, the parameters are only use in the submodule, so that is where they will appear in the parameter dict. If you want to have a parameter dict w…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@sanchit-gandhi
Comment options

@marcvanzee
Comment options

@sanchit-gandhi
Comment options

@marcvanzee
Comment options

Answer selected by marcvanzee
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants