Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
6775b211
Unverified
Commit
6775b211
authored
Feb 07, 2022
by
lewtun
Committed by
GitHub
Feb 07, 2022
Browse files
Remove Longformers from ONNX-supported models (#15273)
parent
7a1412e1
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
3 additions
and
32 deletions
+3
-32
docs/source/serialization.mdx
docs/source/serialization.mdx
+1
-2
src/transformers/models/longformer/configuration_longformer.py
...ransformers/models/longformer/configuration_longformer.py
+1
-18
src/transformers/onnx/features.py
src/transformers/onnx/features.py
+0
-10
tests/test_onnx_v2.py
tests/test_onnx_v2.py
+0
-1
utils/check_table.py
utils/check_table.py
+1
-1
No files found.
docs/source/serialization.mdx
View file @
6775b211
...
...
@@ -43,7 +43,7 @@ and are designed to be easily extendable to other architectures.
Ready-made configurations include the following architectures:
<!--This table is automatically generated by make
style
, do not fill manually!-->
<!--This table is automatically generated by
`
make
fix-copies`
, do not fill manually!-->
- ALBERT
- BART
...
...
@@ -53,7 +53,6 @@ Ready-made configurations include the following architectures:
- GPT Neo
- I-BERT
- LayoutLM
- Longformer
- Marian
- mBART
- OpenAI GPT-2
...
...
src/transformers/models/longformer/configuration_longformer.py
View file @
6775b211
...
...
@@ -13,10 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
""" Longformer configuration"""
from
collections
import
OrderedDict
from
typing
import
List
,
Mapping
,
Union
from
typing
import
List
,
Union
from
...onnx
import
OnnxConfig
from
...utils
import
logging
from
..roberta.configuration_roberta
import
RobertaConfig
...
...
@@ -69,18 +67,3 @@ class LongformerConfig(RobertaConfig):
def
__init__
(
self
,
attention_window
:
Union
[
List
[
int
],
int
]
=
512
,
sep_token_id
:
int
=
2
,
**
kwargs
):
super
().
__init__
(
sep_token_id
=
sep_token_id
,
**
kwargs
)
self
.
attention_window
=
attention_window
class
LongformerOnnxConfig
(
OnnxConfig
):
@
property
def
inputs
(
self
)
->
Mapping
[
str
,
Mapping
[
int
,
str
]]:
return
OrderedDict
(
[
(
"input_ids"
,
{
0
:
"batch"
,
1
:
"sequence"
}),
(
"attention_mask"
,
{
0
:
"batch"
,
1
:
"sequence"
}),
]
)
@
property
def
outputs
(
self
)
->
Mapping
[
str
,
Mapping
[
int
,
str
]]:
return
OrderedDict
([(
"last_hidden_state"
,
{
0
:
"batch"
,
1
:
"sequence"
}),
(
"pooler_output"
,
{
0
:
"batch"
})])
src/transformers/onnx/features.py
View file @
6775b211
...
...
@@ -11,7 +11,6 @@ from ..models.gpt2 import GPT2OnnxConfig
from
..models.gpt_neo
import
GPTNeoOnnxConfig
from
..models.ibert
import
IBertOnnxConfig
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
...
...
@@ -154,15 +153,6 @@ class FeaturesManager:
"question-answering"
,
onnx_config_cls
=
DistilBertOnnxConfig
,
),
"longformer"
:
supported_features_mapping
(
"default"
,
"masked-lm"
,
"sequence-classification"
,
# "multiple-choice",
"token-classification"
,
"question-answering"
,
onnx_config_cls
=
LongformerOnnxConfig
,
),
"marian"
:
supported_features_mapping
(
"default"
,
"default-with-past"
,
...
...
tests/test_onnx_v2.py
View file @
6775b211
...
...
@@ -174,7 +174,6 @@ PYTORCH_EXPORT_MODELS = {
(
"ibert"
,
"kssteven/ibert-roberta-base"
),
(
"camembert"
,
"camembert-base"
),
(
"distilbert"
,
"distilbert-base-cased"
),
# ("longFormer", "longformer-base-4096"),
(
"roberta"
,
"roberta-base"
),
(
"xlm-roberta"
,
"xlm-roberta-base"
),
(
"layoutlm"
,
"microsoft/layoutlm-base-uncased"
),
...
...
utils/check_table.py
View file @
6775b211
...
...
@@ -210,7 +210,7 @@ def check_onnx_model_list(overwrite=False):
"""Check the model list in the serialization.mdx is consistent with the state of the lib and maybe `overwrite`."""
current_list
,
start_index
,
end_index
,
lines
=
_find_text_in_file
(
filename
=
os
.
path
.
join
(
PATH_TO_DOCS
,
"serialization.mdx"
),
start_prompt
=
"<!--This table is automatically generated by make
style
, do not fill manually!-->"
,
start_prompt
=
"<!--This table is automatically generated by
`
make
fix-copies`
, do not fill manually!-->"
,
end_prompt
=
"The ONNX conversion is supported for the PyTorch versions of the models."
,
)
new_list
=
get_onnx_model_list
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment