Skip to content
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

Add text2text-generation-with-past test for encoder-decoder model #1338

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions optimum/onnxruntime/modeling_seq2seq.py
Original file line number Diff line number Diff line change
Expand Up @@ -1130,6 +1130,11 @@ def __init__(
config.decoder.model_type
)(config.decoder)

if self.decoder_with_past is not None:
self.decoder_with_past.normalized_config = NormalizedConfigManager.get_normalized_config_class(
config.decoder.model_type
)(config.decoder)

def _initialize_encoder(self, session: ort.InferenceSession) -> ORTEncoder:
return ORTEncoder(session, self)

Expand Down
7 changes: 6 additions & 1 deletion tests/exporters/exporters_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@
"detr": "hf-internal-testing/tiny-random-DetrModel", # hf-internal-testing/tiny-random-detr is larger
"distilbert": "hf-internal-testing/tiny-random-DistilBertModel",
"electra": "hf-internal-testing/tiny-random-ElectraModel",
"encoder-decoder": "hf-internal-testing/tiny-random-EncoderDecoderModel-bert-bert",
"encoder-decoder": {
"hf-internal-testing/tiny-random-EncoderDecoderModel-bert-bert": [
"text2text-generation",
],
"mohitsha/tiny-random-testing-bert2gpt2": ["text2text-generation", "text2text-generation-with-past"],
},
"flaubert": "hf-internal-testing/tiny-random-flaubert",
"gpt2": "hf-internal-testing/tiny-random-gpt2",
"gpt-bigcode": "hf-internal-testing/tiny-random-GPTBigCodeModel",
Expand Down
Loading
Loading