-
Notifications
You must be signed in to change notification settings - Fork 31.9k
[WIP] Add MarianMT to models exportable with ONNX #13854
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
Changes from all commits
5e574a2
d79320e
e6558aa
a13f0f2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -310,7 +310,7 @@ def __setstate__(self, d: Dict) -> None: | |
| self.current_spm = self.spm_source | ||
| self._setup_normalizer() | ||
|
|
||
| def num_special_tokens_to_add(self, **unused): | ||
| def num_special_tokens_to_add(self, *args, **kwargs): | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the reason for this?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| """Just EOS""" | ||
| return 1 | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,7 @@ | |
| from ..models.gpt_neo import GPTNeoOnnxConfig | ||
| from ..models.layoutlm import LayoutLMOnnxConfig | ||
| from ..models.longformer import LongformerOnnxConfig | ||
| from ..models.marian import MarianOnnxConfig | ||
| from ..models.mbart import MBartOnnxConfig | ||
| from ..models.roberta import RobertaOnnxConfig | ||
| from ..models.t5 import T5OnnxConfig | ||
|
|
@@ -60,6 +61,7 @@ class FeaturesManager: | |
| _SUPPORTED_MODEL_KIND = { | ||
| "albert": supported_features_mapping("default", onnx_config_cls=AlbertOnnxConfig), | ||
| "bart": supported_features_mapping("default", onnx_config_cls=BartOnnxConfig), | ||
| "marian": supported_features_mapping("seq2seq-lm", onnx_config_cls=MarianOnnxConfig), | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can also add the "default" task. |
||
| "mbart": supported_features_mapping("default", onnx_config_cls=MBartOnnxConfig), | ||
| "bert": supported_features_mapping("default", onnx_config_cls=BertOnnxConfig), | ||
| "distilbert": supported_features_mapping("default", onnx_config_cls=DistilBertOnnxConfig), | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LysandreJik @patil-suraj What do you think?
Just saw this comment, will investigate and come back to you.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, anyway I just copied what BART does here
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be added here. This is done for BART because of the denoising pre-training objective, so only BART and mBART prepare the
deocder_input_idsfrominput_ids. For Marian users should pass eitherdecoder_input_idsorlabelsand this is already handled by theMarianMTModelclass.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @patil-suraj for the reply, but as I said in this comment,
transformers.onnx.convert.export()callsMarianMTModel.forward()without passingdecoder_input_idsorlabels, so how is this supposed to be handled?