-
Notifications
You must be signed in to change notification settings - Fork 72
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
Unable to retrieve hidden_states #52
Comments
@Ki6an I also tried by adding "output_hidden_states" = True in the onnx model's config. Also made sure this argument is added in model.generate() call, but still no luck. Any idea how I can retrieve the encoder/decoder hidden states? |
sorry for the late reply, you can get the ...
model = export_and_get_onnx_model(model_name)
encoder = model.encoder
hidden_state = encoder(input_ids, attention_mask) but for the decoder, you need to make lots of changes. you can start by making changes here fastT5/fastT5/onnx_models_structure.py Lines 52 to 62 in 20441b3
make it return that value as well return (
decoder_output[0],
self.lm_head(decoder_output[0] * (self.config.d_model ** -0.5)),
decoder_output[1],
) also, do the same changes for the decoder. then, retrieve those values from ort session here and here finally, pass those values here Line 199 in 20441b3
as |
I converted a locally saved T5 checkpoint to ONNX using FastT5:
I tested it for inference:
The hidden states are all None.
Is there any way that I can retrieve the hidden states for both encoder and decoder?
The text was updated successfully, but these errors were encountered: