transformers/templates/adding_a_new_model/cookiecutter-template-{{cookiecutter.modelname}}
Hamid Shojanazeri af6e01c5bc
Fix for the issue of device-id getting hardcoded for token_type_ids during Tracing [WIP] (#11252)
* registering a buffer for token_type_ids, to pass the error of device-id getting hardcoded when tracing

* sytle format

* adding persistent flag to the resgitered buffers that prevent from adding them to the state_dict and addresses the Backward compatibility issue

* adding the try catch to the fix as persistent flag is only available from PT >1.6

* adding version check

* added the condition to only use the token_type_ids buffer when its autogenerated not passed by user

* adding comments and making the conidtion where token_type_ids are None to use the registered buffer

* taking out position-embeddding from the if block

* adding comments

* handling the case if buffer for position_ids was not registered

* reverted the changes on position_ids, fix the issue with size of token_type_ids buffer, moved the modification for generated token_type_ids to Bertmodel, instead of Embeddings

* reverting the token_type_ids in case of None to the previous version

* reverting changes on position_ids adding back the if block

* changes added by running make fix-copies

* changes added by running make fix-copies and added the import version as it was getting used

* changes added by running make fix-copies

* changes added by running make fix-copies

* fixing the import format

* fixing the import format

* modified to use temp tensor for trimed and expanded token_type_ids buffer

* changes made by fix-copies after temp tensor modifications

* changes made by fix-copies after temp tensor modifications

* changes made by fix-copies after temp tensor modifications

* clean up

* clean up

* clean up

* clean up

* Nit

* Nit

* Nit

* modified according to support device conversion on traced models

* modified according to support device conversion on traced models

* modified according to support device conversion on traced models

* modified according to support device conversion on traced models

* changes based on latest in master

* Adapt templates

* Add version import

Co-authored-by: Ubuntu <ubuntu@ip-172-31-32-81.us-west-2.compute.internal>
Co-authored-by: Lysandre <lysandre.debut@reseau.eseo.fr>
2021-06-22 05:21:30 -04:00
..
__init__.py Fix model templates (#9999) 2021-02-04 07:47:26 -05:00
{{cookiecutter.lowercase_modelname}}.rst Honor contributors to models (#11329) 2021-04-21 09:47:27 -04:00
configuration_{{cookiecutter.lowercase_modelname}}.py Fixes in the templates (#10951) 2021-03-29 17:36:13 -04:00
configuration.json Model Templates for Seq2Seq (#9251) 2020-12-22 23:41:20 +01:00
modeling_{{cookiecutter.lowercase_modelname}}.py Fix for the issue of device-id getting hardcoded for token_type_ids during Tracing [WIP] (#11252) 2021-06-22 05:21:30 -04:00
modeling_tf_{{cookiecutter.lowercase_modelname}}.py TF BART models - Add cross_attentions to model output and fix cross-attention head masking (#10699) 2021-04-26 14:16:21 +02:00
test_modeling_{{cookiecutter.lowercase_modelname}}.py Fix model templates (#9999) 2021-02-04 07:47:26 -05:00
test_modeling_tf_{{cookiecutter.lowercase_modelname}}.py Enforce string-formatting with f-strings (#10980) 2021-03-31 10:00:27 -04:00
to_replace_{{cookiecutter.lowercase_modelname}}.py Fix model templates (#9999) 2021-02-04 07:47:26 -05:00
tokenization_{{cookiecutter.lowercase_modelname}}.py Make get_special_tokens_mask consider all tokens (#11163) 2021-04-09 11:57:44 -04:00
tokenization_fast_{{cookiecutter.lowercase_modelname}}.py Copy tokenizer files in each of their repo (#10624) 2021-03-10 11:26:23 -05:00