Detect mixing of linen and nnx api #5191
-
|
I'm recently upgrading old nn modules to nnx and missed one. Training code reported TraceContextError. It's a fairly confusing error. Would be nice if some assertion's added to check if nn and nnx modules get mixed. Edit: My problem's caused by mixing nn and nnx module together, causing the mutation inside jitted function. Leaving it here in case someone else ran into same problem. Don't waste hours debugging a typo. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
The error is about a mutation of rng inside jitted function. Usually, cloning the model or rng can help with it: |
Beta Was this translation helpful? Give feedback.
The error is about a mutation of rng inside jitted function. Usually, cloning the model or rng can help with it: