Skip to content

[nnx] add JitWrapped API #4699

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 1 commit into
base: main
Choose a base branch
from
Open

[nnx] add JitWrapped API #4699

wants to merge 1 commit into from

Conversation

cgarciae
Copy link
Collaborator

What does this PR do?

nnx.jit now returns a JitWrapped object that mimics the behavior from the JAX counterpart.

@cgarciae cgarciae force-pushed the nnx-jitwrapped branch 2 times, most recently from 8fb0f2c to 4bc81f2 Compare April 17, 2025 04:56
querying properties of lowered computations across JAX's various
lowering paths (:func:`~jax.jit`, :func:`~jax.pmap`, etc.).
"""
lowered: jax._src.stages.Lowered
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use jax.stages.Lowered to avoid using internal APIs

common API for querying properties of compiled computations across
JAX's various compilation paths and backends.
"""
compiled: jax._src.stages.Compiled
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use external API if possible, same for other types

return self._inner_obj.donate_argnums

@dataclasses.dataclass(frozen=True, slots=True)
class Compiled(Stage):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: why not subclass JAX's Stage, Compiled, etc? Looks easier than creating new classes

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.

2 participants