Commit Graph

9747 Commits

Author SHA1 Message Date
hasan salim kanmaz
c33f6046c3
[WIP] Enable reproducibility for distributed trainings (#16907)
* add seed worker and set_deterministic_seed_for_cuda function to enforce reproducability

* change function name to enable determinism, add docstrings, reproducability support for tf

* change function name to enable_determinism_for_distributed_training

* revert changes in set_seed and call set_seed within enable_full_determinism

* add one position argument for seed_worker function

* add full_determinism flag in training args and call enable_full_determinism when it is true

* add enable_full_determinism to documentation

* apply make fixup after the last commit

* Update src/transformers/training_args.py

Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>

Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
2022-05-11 09:37:13 -04:00
Martin Pömsl
5229744b26
Add missing RetriBERT tokenizer tests (#17017)
* Create RetriBERT tests folder

* Add missing RetriBERT tokenizer test file

* Apply style corrections

* Add non-english filter

* Update tests/retribert/test_tokenization_retribert.py

Co-authored-by: SaulLu <55560583+SaulLu@users.noreply.github.com>

* Update tests/retribert/test_tokenization_retribert.py

Co-authored-by: SaulLu <55560583+SaulLu@users.noreply.github.com>

* Move test files to new directory

* Update import path for testing utils to new test file structure

Co-authored-by: SaulLu <55560583+SaulLu@users.noreply.github.com>
2022-05-11 15:04:07 +02:00
Heng Kuan Wee
6bc6797e04
Convert image to rgb for clip model (#17101)
Co-authored-by: kuanwee.heng <kuanwee.heng@aaqua.live>
2022-05-11 13:09:54 +01:00
Sylvain Gugger
0a2bea4752 Fix repo consistency 2022-05-11 08:05:45 -04:00
arampacha
0645b07daf
propagate "attention_mask" dtype for "use_past" in OnnxConfig.generate_dummy_inputs (#17105)
* propagate attention_mask dtype

* fixup&style
2022-05-11 07:50:35 -04:00
jianan-gu
0e6ec2a469
Extend Transformers Trainer Class to Enable PyTorch SGD/Adagrad Optimizers for Training (#17154)
* add torch SGD and Adagrad optimizer bits

* refine naming

Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>

Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
2022-05-11 07:24:11 -04:00
Suraj Patil
63517fdf48
[M2M100 doc] remove duplicate example (#17175)
* remove duplicate example

* remove code block
2022-05-11 12:16:46 +01:00
Leon Derczynski
4a419d4995
MobileBERT tokenizer tests (#16896)
* unhardcode pretrained model path, make it a class var

* add tests for mobilebert tokenizer

* allow tempfiles for vocab & merge similarity test to autodelete

* add explanatory comments

* remove unused imports, let make style do its.. thing

* remove inheritance and use BERT tok tests for MobileBERT

* Update tests/mobilebert/test_tokenization_mobilebert.py

Co-authored-by: SaulLu <55560583+SaulLu@users.noreply.github.com>

* amend class names, remove unused import, add fix for mobilebert's hub pathname

* unhardcode pretrained model path, make it a class var

* add tests for mobilebert tokenizer

* allow tempfiles for vocab & merge similarity test to autodelete

* add explanatory comments

* remove unused imports, let make style do its.. thing

* remove inheritance and use BERT tok tests for MobileBERT

* Update tests/mobilebert/test_tokenization_mobilebert.py

Co-authored-by: SaulLu <55560583+SaulLu@users.noreply.github.com>

* amend class names, remove unused import, add fix for mobilebert's hub pathname

* amend paths for model tests being in models/ subdir of /tests

* explicitly rm test from prev path

Co-authored-by: SaulLu <55560583+SaulLu@users.noreply.github.com>
2022-05-10 16:39:58 -04:00
Jason Phang
48a8f3daa1
Add DebertaV2ForMultipleChoice (#17135) 2022-05-10 16:21:44 -04:00
Sylvain Gugger
4ad2f68e34
Fix template init (#17163) 2022-05-10 15:24:23 -04:00
Nicolas Brousse
e99f0efedc
Add MLFLOW_FLATTEN_PARAMS support in MLflowCallback (#17148)
* add support for MLFLOW_FLATTEN_PARAMS

* ensure key is str

* fix style and update warning msg

* Empty commit to trigger CI

* fix bug in check_inits.py

* add unittest for flatten_dict utils

* fix 'NoneType' object is not callable on __del__

* add generic flatten_dict unittest to SPECIAL_MODULE_TO_TEST_MAP

* fix style
2022-05-10 14:29:18 -04:00
Stas Bekman
976835d515
missing file (#17164) 2022-05-10 10:19:50 -07:00
Patrick Haller
259eeb6dab
Fixing the output of code examples in the preprocessing chapter (#17162) 2022-05-10 12:16:28 -04:00
Stas Bekman
f861504466
[Deepspeed] add many more models to the model zoo test (#12695)
* model zoo take 2

* add deberta

* new param for zero2

* doc update

* doc update

* add layoutlm

* bump deepspeed

* add deberta-v2, funnel, longformer

* new models

* style

* add t5_v1

* update TAPAS status

* reorg problematic models

* move doc to another PR

* style

* fix checkpoint check test

* making progress on more models running

* cleanup

* new version

* cleanup
2022-05-10 08:22:42 -07:00
Stas Bekman
9aeacfe0ff
[trainer] sharded _load_best_model (#17150)
* [trainer] sharded _load_best_model

probably needs a test?

* undo delete
2022-05-10 07:58:53 -07:00
Dom Miketa
1766fa2159
train args defaulting None marked as Optional (#17156)
Co-authored-by: Dom Miketa <dmiketa@exscientia.co.uk>
2022-05-10 10:09:34 -04:00
Nicolas Patry
6d80c92c77
LogSumExp trick question_answering pipeline. (#17143)
* LogSumExp trick `question_answering` pipeline.

* Adding a failing test.
2022-05-10 10:03:55 +02:00
Zachary Mueller
d719bcd46a
Fix all docs for accelerate install directions (#17145) 2022-05-09 15:45:18 -04:00
Nicolas Brousse
766d4bf792
Fix MLflowCallback end_run() and add support for tags and nested runs (#17130)
* ensure mlflow.end_run() is executed at end of training when mlflow.start_run() was executed by the callback

* add debug msg

* add support for MLFLOW_TAGS, MLFLOW_RUN_ID, and MLFLOW_NESTED_RUN

* update to support python 3.6+

* Validate env variables using ENV_VARS_TRUE_VALUES

* Empty-Commit
2022-05-09 13:09:48 -04:00
Zachary Mueller
2fbb237967
Add the auto_find_batch_size capability from Accelerate into Trainer (#17068)
Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>

- Adds auto_batch_size finder 
- Moves training loop to an inner training loop
2022-05-09 12:29:18 -04:00
Dom Miketa
df735d1317
[WIP] Fix Pyright static type checking by replacing if-else imports with try-except (#16578)
* rebase and isort

* modify cookiecutter init

* fix cookiecutter auto imports

* fix clean_frameworks_in_init

* fix add_model_to_main_init

* blackify

* replace unnecessary f-strings

* update yolos imports

* fix roberta import bug

* fix yolos missing dependency

* fix add_model_like and cookiecutter bug

* fix repository consistency error

* modify cookiecutter, fix add_new_model_like

* remove stale line

Co-authored-by: Dom Miketa <dmiketa@exscientia.co.uk>
2022-05-09 11:28:53 -04:00
Sylvain Gugger
7783fa6bb3 Fix quality and repo consistency 2022-05-09 11:14:36 -04:00
Sourab Mangrulkar
05fc1766ff
PyTorch FSDP integration in Trainer (#17136)
* PyTorch FSDP integration in Trainer

* reformatting

make style and make quality are now compliant.

* Updating dependency check

* Trigger CI

Co-authored-by: Sylvain Gugger <Sylvain.gugger@gmail.com>
2022-05-09 20:40:56 +05:30
Manan Dey
dc3645dc9c
add mobilebert onnx configs (#17029)
* update docs of length_penalty

* Revert "update docs of length_penalty"

This reverts commit 466bf4800b.

* add mobilebert onnx config

* address suggestions

* Update auto.mdx

* Update __init__.py

* Update features.py
2022-05-09 10:36:53 -04:00
robsmith155
a021f2b90c
Add type hints for BigBirdPegasus and Data2VecText PyTorch models (#17123)
* Add type hints for remaining BigBirdPegasus models

Here I added type hints to the BigBirdPegasusForCausalLM class.

* Add missing type hints for Data2VecText models

Added type hints to the Data2VecTextForCausalLM, Data2VecTextForMaskedLM,
Data2VecTextForMultipleChoice, Data2VecTextForQuestionAnswering,
Data2VecTextForSequenceClassification, and
Data2VecTextForTokenClassification classes.
2022-05-09 12:45:43 +01:00
ghlai9665
e9fd583ce0
LayoutLMv2Processor: ensure 1-to-1 mapping between images and samples in case of overflowing tokens (#17092)
* add get_overflowing_images function to ensure 1-to-1 mapping between samples and images in LayoutLMv2Processor

* make style

* add test for overflowing_tokens, change assert to ValueError, avoiding unrelated formatting changes

* change line length by passing --preview into black
2022-05-09 07:39:08 -04:00
Yih-Dar
3212afa614
split single_gpu and multi_gpu (#17083)
* split single_gpu and multi_gpu

* update needs in send_result

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
2022-05-09 07:13:07 -04:00
Ritik Nandwal
215e0681e4
Added BigBirdPegasus onnx config (#17104)
* Add onnx configuration for bigbird-pegasus

* Modify docs
2022-05-06 17:31:00 +02:00
Yih-Dar
351cdbdfdc
Fix self-push CI report path in cat (#17111)
* fix report cat path

* fix report cat path

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
2022-05-06 07:45:17 -07:00
Steven Liu
cad61b6839
Fix link to example scripts (#17103) 2022-05-05 15:20:27 -05:00
Yih-Dar
a59eb349c5
fix missing "models" in pipeline test module (#17090)
Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
2022-05-05 16:12:01 +02:00
Sylvain Gugger
dd16a113a4
Remove torchhub test (#17097) 2022-05-05 10:02:47 -04:00
Nicolas Brousse
c849a61e65
Fix MLflowCallback and add support for MLFLOW_EXPERIMENT_NAME (#17091)
* Fix use of mlflow.active_run() and add proper support for MLFLOW_EXPERIMENT_NAME

* Fix code style (make style)
2022-05-05 09:49:55 -04:00
robsmith155
99289c08a1
Add type hints for BERTGeneration (#17047)
Added type hints for the BERTGenerationEncoder and BERTGenerationDecoder
classes.
2022-05-05 12:22:46 +01:00
Robot Jelly
45360e1a8e
type hints for pytorch models (#17064)
* type hints for pytorch models

* fixed import error

* fixed some errors
2022-05-05 12:21:17 +01:00
Daniel Espejel
db377a0b37
Added spanish translation of autoclass_tutorial. (#17069)
* Added spanish translation of autoclass_tutorial.
Added 'local' and 'title' fields for autoclass_tutorial.

* Fixed autoclass_tutorial title in _toctree.yml and autoclass_tutorial.mdx
2022-05-04 14:18:24 -05:00
Yih-Dar
6dc4c36acb
minor change on TF Data2Vec test (#17085)
Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
2022-05-04 18:39:30 +02:00
Steven Liu
23619ef6b7
📝 open fresh PR for pipeline doctests (#17073) 2022-05-04 11:30:34 -05:00
Patrick Deutschmann
870e6f29a6
Fix DeBERTa token_type_ids (#17082) 2022-05-04 18:23:37 +02:00
Sean Moriarity
279bc5849b
Allow saved_model export of TFCLIPModel in save_pretrained (#16886)
* CLIP Serving

* Add type hints per code review

* Use black, flake8, and isort

* Update src/transformers/models/clip/modeling_tf_clip.py

Co-authored-by: Joao Gante <joaofranciscocardosogante@gmail.com>

* Rollback serving_output and add TODO

* Remove irrelevant portions of failing tests

* Revert "Rollback serving_output and add TODO"

This reverts commit a4abfa6ba3b7875a13538dbc2ddc4eb17dfcca8d.

* Rollback to original test/serving_output

* Fix unused var

* Apply suggestions from code review

* Update formatting with black

* Fix style again from rebase

* Update tests/models/clip/test_modeling_tf_clip.py

Co-authored-by: Yih-Dar <2521628+ydshieh@users.noreply.github.com>

Co-authored-by: Joao Gante <joaofranciscocardosogante@gmail.com>
Co-authored-by: Sean Moriarity <sean.l.moriarity.mil@army.mil>
Co-authored-by: Yih-Dar <2521628+ydshieh@users.noreply.github.com>
2022-05-04 16:37:58 +02:00
Zachary Mueller
ef20390291
Update to build via git for accelerate (#17084) 2022-05-04 09:42:36 -04:00
Sylvain Gugger
bb8d40529e
Deprecate model templates (#17062)
* Deprecate model templates

* Address review comments
2022-05-04 09:36:38 -04:00
karthikrangasai
9c5ae87f13
Type hint complete Albert model file. (#16682)
* Type hint complete Albert model file.

* Update typing.

* Update src/transformers/models/albert/modeling_albert.py

Co-authored-by: Matt <Rocketknight1@users.noreply.github.com>
2022-05-04 14:35:12 +01:00
dependabot[bot]
2bf95e2b09
Bump notebook from 6.4.1 to 6.4.10 in /examples/research_projects/lxmert (#16634)
Bumps [notebook](http://jupyter.org) from 6.4.1 to 6.4.10.

---
updated-dependencies:
- dependency-name: notebook
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-04 08:27:40 -04:00
dependabot[bot]
7a229ef446
Bump notebook in /examples/research_projects/visual_bert (#16635)
Bumps [notebook](http://jupyter.org) from 6.4.1 to 6.4.10.

---
updated-dependencies:
- dependency-name: notebook
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-04 08:27:27 -04:00
Sayak Paul
049e791758
Add Data2Vec for Vision in TF (#17008)
* add utilities till TFData2VecVisionLayer.

* chore: pass window_size to attention layer.

* feat: add TFData2VecVisionRelativePositionBias.

* feat: initial implementation ready for tf data2vec.

* fix: relative position bias index, table to be fixed.

* chore: implementation added, tests remaining.

* add: tests, other PR files.

* fix: code quality.

* fix: import structure in init.

* chore: run make fix-copies.

* chore: address PR feedback (round I).

* chore: styling nit.

* fix: tests due to removal of to_2tuple().

* chore: rebase with upstream main and move the test.

* Update src/transformers/models/auto/modeling_tf_auto.py

Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>

* Update src/transformers/models/auto/modeling_tf_auto.py

Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>

* fix: layer call.

* chore: remove from_pt=True and rerun test.

* chore: remove cast and tf.divide.

* chore: minor edits to the test script.

* Update src/transformers/models/data2vec/modeling_tf_data2vec_vision.py

Co-authored-by: Matt <Rocketknight1@users.noreply.github.com>

* fix: expand() on TF tensors with broadcast_to().

* fix: test import.

Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
Co-authored-by: Matt <Rocketknight1@users.noreply.github.com>
2022-05-04 08:08:25 -04:00
Sylvain Gugger
d76d2a2af7
Make sure telemetry arguments are not returned as unused kwargs (#17063)
* Make sure telemetry arguments are not returned as unused kwargs

* Fix test
2022-05-04 07:47:57 -04:00
lewtun
675e2d1663
Remove masked image modeling from BEIT ONNX export (#16980)
* Add masked image modelling to task mapping

* Refactor ONNX features to be listed alphabetically

* Add warning about BEiT masked image modeling

Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
2022-05-04 10:05:24 +02:00
lewtun
4bb1d0ec84
Skip RoFormer ONNX test if rjieba not installed (#16981)
* Skip RoFormer ONNX test if rjieba not installed

* Update deps table

* Skip RoFormer serialization test

* Fix RoFormer vocab

* Add rjieba to CircleCI
2022-05-04 10:04:10 +02:00
Thomas Wang
db034660fb
Fix hashing for deduplication (#17048) 2022-05-04 08:40:24 +02:00