Skip to content

Convert DenseGeneral to NNX #1743

New issue

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Convert DenseGeneral to NNX #1743

wants to merge 2 commits into from

Conversation

bvandermoon
Copy link
Collaborator

@bvandermoon bvandermoon commented May 14, 2025

Description

Finishing out PR 1604 for @cgarciae

Note: I updated the logits in golden_data_grpo_default.jsonl to the NNX values. The NNX logits don't match the Linen ones since the RNG keys are setup differently.

Previous PR description:

This commit converts DenseGeneral to NNX and creates a dense_general to interface with it through a Linen wrapper. dense_general contains all the same arguments as the Linen version but adds two additional ones:

  • input_shape: the expected shape of the input.
  • in_features: an int or tuple representing the input features.

Only one of them can be set at a time.

Tests

  • Unit tests
  • We may end up needing to regenerate and update other golden logits. The logits are not the same for NNX/Linen due to the way the RNG keys are handled and the weights are initialized

Checklist

Before submitting this PR, please make sure (put X in square brackets):

  • I have performed a self-review of my code.
  • I have necessary comments in my code, particularly in hard-to-understand areas.
  • I have run end-to-end tests tests and provided workload links above if applicable.
  • I have made or will make corresponding changes to the doc if needed.

Co-authored-by: Branden Vandermoon <[email protected]>
Co-authored-by: Cristian Garcia <[email protected]>
@bvandermoon bvandermoon force-pushed the bvandermoon-nnx-dev branch from 3aa33eb to fca144b Compare May 16, 2025 21:13
@bvandermoon bvandermoon force-pushed the bvandermoon-nnx-dev branch from 5312ae5 to 4a3d918 Compare May 16, 2025 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants