Repository navigation
Storing gradient information in metadata_props
#290
Replies: 4 comments 12 replies
|
Hi Clément, thanks for bringing this up! Preserving information about which parameters your framework considers trainable sounds useful, and I’d be happy to explore it together with a small example. We already use I’d like to keep jax2onnx focused on inference, with its simple API and straightforward validation: run the original JAX function and the exported ONNX model and compare their outputs. Parameter annotations could fit within that scope; preserving the original gradient or training semantics would be a separate, much larger commitment. For ONNX→JAX, I’d keep that separate from jax2onnx and first explore existing work such as jaxonnxruntime, potentially with an Equimo integration on top. Do you have a small model showing how you identify trainable and frozen parameters, and how you’d use those annotations after export? That would help us check whether we can reliably associate the source parameters with the exported values and find the smallest useful extension. Best, |
|
Hi Clément, thanks for the thorough testing of #292. Before going further there, I'd like to Let me know whether this fits your workflow. |
|
Hi Clément, jax2onnx 0.19.0 is released and contains Both of your suggestions are in the release. BF16: the contract corpus now has pure BF16 programs, checked at export level for type, default bits, metadata and K9: an elementwise product, a Linear + LayerNorm + GELU + softmax block, self-attention and a patch embedding. A further program casts BF16 state at the use and runs in ONNX Runtime, with the defaults and with an override. The test that a state export equals the ordinary export of Walkthrough: the walkthrough uses The Also in 0.19.0: the Is the BF16 coverage above what you had in mind, or do you need specific layers? If anything else is missing or not right yet, a discussion, an issue or a PR is welcome. That includes the float16 normalization benchmark that crashes on your machine. |
|
Hi Clément, both steps from the plan are done and released in jax2onnx 0.19.1. BF16. #305 is merged, with export cases for Elu and for OneHot's Float16 abort. Fixed in the export (#307): the trigger was Thanks again for the scan and the version bisect. |
Uh oh!
There was an error while loading. Please reload this page.
Hey, hope you are doing well :)
I have a small question (or maybe two actually).
At some point, I may need to train ONNX models themselves, so perhaps use the experimental onnx.training approach, or do a... onnx2jax operation. The thing is, jax -> onnx is a lossy operation in the sense that the onnx graph no longer stores which tensor is trainable or not. One easy approach would be to use
metadata_propsonTensorProto,NodeProtoand several other onnx structures to attach metadata likerequires_grad=True.Would you see a clean way to do that with jax2onnx?
Also, what do you think about the scope of jax2onnx? Should it also include the onnx2jax part, or do you think this belongs to a new library, or simply in frameworks directly, like adding a
from_onnxAPI in Equimo?Have a nice day,
Clément
All reactions