Commit Graph

8011 Commits

Author SHA1 Message Date
Ibraheem Moosa eae7a96b7d
Optimize Token Classification models for TPU (#13096)
* Optimize Token Classification models for TPU

As per the XLA document XLA cannot handle masked indexing well. So token classification
models for BERT and others use an implementation based on `torch.where`. This implementation
works well on TPU. 

ALBERT token classification model uses the masked indexing which causes performance issues
on TPU. This PR fixes this issue by following the BERT implementation.

* Same fix for ELECTRA

* Same fix for LayoutLM
2021-09-17 10:07:52 -04:00
Benjamin Davidson e02ed0ee7e
XLMR tokenizer is fully picklable (#13577)
* made tokenizer fully picklable

* remove whitespace

* added testcase
2021-09-16 16:30:05 -04:00
Sylvain Gugger af5c6ae5ed
Properly use test_fetcher for examples (#13604)
* Properly use test_fetcher for examples

* Fake example modification

* Fake modeling file modification

* Clean fake modifications

* Run example tests for any modification.
2021-09-16 15:13:00 -04:00
Stas Bekman bec2e3f55c
[deepspeed] replaced deprecated init arg (#13587)
* [deepspeed] replaced deprecated init arg

* Trigger CI
2021-09-16 12:12:16 -07:00
Patrick von Platen 4d5b4c7863
Feature Extractor: Wav2Vec2 & Speech2Text - Allow truncation + padding=longest (#13600)
* correct

* add tests

* Update src/transformers/feature_extraction_sequence_utils.py

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

Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
2021-09-16 20:02:54 +02:00
Matt e59041684e
DataCollatorForTokenClassification numpy fix (#13609)
* Fix issue when labels are supplied as Numpy array instead of list

* Fix issue when labels are supplied as Numpy array instead of list

* Fix same issue in the `TokenClassification` data collator

* Style pass
2021-09-16 18:00:59 +01:00
Sylvain Gugger 88dbbfb2d6
Fix make fix-copies with type annotations (#13586) 2021-09-16 11:55:37 -04:00
Lysandre Debut cec1c63642
Fix test (#13608) 2021-09-16 11:33:08 -04:00
Matt 5c5937182a
Fix DataCollatorForSeq2Seq when labels are supplied as Numpy array instead of list (#13582)
* Fix issue when labels are supplied as Numpy array instead of list

* Fix issue when labels are supplied as Numpy array instead of list
2021-09-16 15:35:57 +01:00
Patrick von Platen 421929b556
finish (#13593) 2021-09-16 10:07:47 +02:00
Patrick von Platen b5bab710f7
correct (#13585) 2021-09-16 09:07:20 +02:00
Stas Bekman 89da1bfeac
[ci] nightly: add deepspeed master (#13589) 2021-09-15 20:18:34 -04:00
Patrick von Platen 95f933ea85
[Pretrained Model] Add resize_position_embeddings (#13559)
* finish

* delete bogus file

* correct some stuff

* finish

* finish
2021-09-15 19:03:56 +02:00
elishowk c783e14887
upgrade sentencepiece version (#13564) 2021-09-15 15:25:03 +02:00
Suraj Patil e86c02ea90
Fix GPTNeo onnx export (#13524)
Update GPT Neo ONNX config to match the changes implied by the simplification of the local attention

Co-authored-by: Michael Benayoun <michael@huggingface.co>
2021-09-15 13:08:41 +02:00
Bhadresh Savani 3fbb55c757
[Flax] Fixes typo in Bart based Flax Models (#13565) 2021-09-15 11:03:52 +05:30
Sylvain Gugger 7bd16b8776
Fix test_fetcher when setup is updated (#13566)
* Fix test_fetcher when setup is updated

* Remove example
2021-09-14 13:33:41 -04:00
elishowk 054b6013c2
separate model card git push from the rest (#13514)
Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
2021-09-14 18:07:36 +02:00
Sylvain Gugger 9f318be3d3 Fix yml syntax error 2021-09-14 11:31:17 -04:00
Sylvain Gugger 801ec115cf
Add checks to build cleaner model cards (#13542)
* Add checks to build cleaner model cards

* Address review comments
2021-09-14 11:27:32 -04:00
Bhadresh Savani c1e47bf4fe
[Flax] Addition of FlaxPegasus (#13420)
* added initial files

* fixes pipeline

* fixes style and quality

* fixes doc issue and positional encoding

* fixes layer norm and test

* fixes quality issue

* fixes code quality

* removed extra layer norm

* added layer norm back in encoder and decoder

* added more code copy quality checks

* update tests

* Apply suggestions from code review

* fix import

* fix test

Co-authored-by: patil-suraj <surajp815@gmail.com>
2021-09-14 17:15:19 +02:00
Suraj Patil fc3551a6d7
add flax mbart in auto seq2seq lm (#13560) 2021-09-14 19:06:41 +05:30
Sylvain Gugger 3081d3868e
Push to hub when saving checkpoints (#13503)
* Push to hub when saving checkpoints

* Add model card

* Revert partial model card

* Small fix for checkpoint

* Add tests

* Add documentation

* Fix tests

* Bump huggingface_hub

* Fix test
2021-09-14 08:02:15 -04:00
Avital Oliver 51e5eca612
Add long overdue link to the Google TRC project (#13501)
* Add long-overdue link to the Google TRC project

* Apply suggestions from code review

Co-authored-by: Suraj Patil <surajp815@gmail.com>
Co-authored-by: Stefan Schweter <stefan@schweter.it>
2021-09-14 13:41:55 +05:30
Lysandre Debut 3ab0185b06
Nightly torch ci (#13550)
* Nightly CI torch

* Version

* Reformat

* Only subset
Fix

* Revert

* Better formatting

* New channel
2021-09-13 16:17:29 -04:00
Patrick von Platen 5c14fceac0
return attention mask in int32 (#13543) 2021-09-13 14:02:23 +02:00
SaulLu 149c833b75
Small changes in `perplexity.rst`to make the notebook executable on google collaboratory (#13541)
* add imports

* Update docs/source/perplexity.rst

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

Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
2021-09-13 13:32:32 +02:00
Stas Bekman f1c22dae7d
[tokenizer] use use_auth_token for config (#13523)
* [tokenizer] use use_auth_token for config

* args order
2021-09-13 07:31:35 -04:00
Patrick von Platen d2904264ab
up (#13538) 2021-09-13 13:07:59 +02:00
Nicolas Patry 65ee1a43e5
fixing BC in `fill-mask` (wasn't tested in theses test suites (#13540)
apparently).
2021-09-13 12:48:54 +02:00
Patrick von Platen 9d60eebeb5
up (#13536) 2021-09-13 11:30:10 +02:00
Xiaohan Zou a2045067c5
Fix attention mask size checking for CLIP (#13535) 2021-09-13 13:38:38 +05:30
Alex Hedges 68b0baeedc
Ignore past_key_values during GPT-Neo inference (#13521) 2021-09-13 03:06:07 -04:00
holazzer 07c2607d4d
fix use_cache value assign (#13532)
fix use_cache value assign
2021-09-13 11:18:50 +05:30
Suraj Patil 010965dcde
[GPT-Neo] Simplify local attention (#13491)
* simplify local attention

* update tests

* add a comment and use torch.bitwise_xor
2021-09-10 22:52:20 +05:30
Patrick von Platen a57d784df5
[Wav2Vec2] Fix dtype 64 bug (#13517)
* fix

* 2nd fix
2021-09-10 18:19:10 +02:00
patrickvonplaten 72ec2f3eb5 Docs for v4.10.1 2021-09-10 16:45:19 +02:00
Matt 26d9212e3c
TF multiple choice loss fix (#13513)
Fix issues with `TFMultipleChoiceLoss` if the choices dimension is None when `build()` is called.
2021-09-10 14:49:17 +01:00
Patrick von Platen d7b3b709d0
[Wav2Vec2] Fix normalization for non-padded tensors (#13512)
* finalize

* Apply suggestions from code review

* finish cleaner implementation

* more tests

* small fix

* finish

* up
2021-09-10 15:27:16 +02:00
Nicolas Patry c63fcabfe9
[Large PR] Entire rework of pipelines. (#13308)
* Enabling dataset iteration on pipelines.

Enabling dataset iteration on pipelines.

Unifying parameters under `set_parameters` function.

Small fix.

Last fixes after rebase

Remove print.

Fixing text2text `generate_kwargs`

No more `self.max_length`.

Fixing tf only conversational.

Consistency in start/stop index over TF/PT.

Speeding up drastically on TF (nasty bug where max_length would increase
a ton.)

Adding test for support for non fast tokenizers.

Fixign GPU usage on zero-shot.

Fix working on Tf.

Update src/transformers/pipelines/base.py

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

Update src/transformers/pipelines/base.py

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

Small cleanup.

Remove all asserts + simple format.

* Fixing audio-classification for large PR.

* Overly explicity null checking.

* Encapsulating GPU/CPU pytorch manipulation directly within `base.py`.

* Removed internal state for parameters of the  pipeline.

Instead of overriding implicitly internal state, we moved
to real named arguments on every `preprocess`, `_forward`,
`postprocess` function.

Instead `_sanitize_parameters` will be used to split all kwargs
of both __init__ and __call__ into the 3 kinds of named parameters.

* Move import warnings.

* Small fixes.

* Quality.

* Another small fix, using the CI to debug faster.

* Last fixes.

* Last fix.

* Small cleanup of tensor moving.

* is not None.

* Adding a bunch of docs + a iteration test.

* Fixing doc style.

* KeyDataset = None guard.

* RRemoving the Cuda test for pipelines (was testing).

* Even more simple iteration test.

* Correct import .

* Long day.

* Fixes in docs.

* [WIP] migrating object detection.

* Fixed the target_size bug.

* Fixup.

* Bad variable name.

* Fixing `ensure_on_device` respects original ModelOutput.
2021-09-10 14:47:48 +02:00
Stefan Schweter 09549aa18c
examples: minor fixes in flax example readme (#13502) 2021-09-10 11:45:57 +05:30
Nicolas Patry aacd2123ee
Fixing #13381 (#13400)
* Fixing #13381

* Enabling automatic LED models.
2021-09-09 14:23:52 -04:00
Nicolas Patry db514a75d0
Fixing backward compatiblity for non prefixed tokens (B-, I-). (#13493) 2021-09-09 13:36:09 -04:00
Sylvain Gugger e59d4d0147
Refactor internals for Trainer push_to_hub (#13486) 2021-09-09 13:04:37 -04:00
Nicolas Patry 3dd538c4d3
[Tentative] Moving slow tokenizer to the Trie world. (#13220)
* Moving slow tokenizer to the Trie world.

* Adding more docstrings to the Trie.

* Fixing doctest (incompatible wiht our format? )

* Update src/transformers/tokenization_utils.py

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

* Adding a lot more comment into the internals of this algorithm.

* Cleaner doc.

* Fixing the namings.

* Update src/transformers/tokenization_utils.py

Co-authored-by: Lysandre Debut <lysandre@huggingface.co>

* quality.

* Fixing longest first match.

* Small improvements to cuts + more test + canine resistant test.

* Fixing fast test.

Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
Co-authored-by: Lysandre Debut <lysandre@huggingface.co>
2021-09-09 17:26:16 +02:00
Matt b8385d8a11
TF Seq2Seq int dtype fix (#13496)
Fixes problems with passing int64 input to TF Seq2Seq models.
2021-09-09 15:54:08 +01:00
Aleksander Smywiński-Pohl 008c2d0b7a
Fix typo in documentation (#13494)
* Fix typo in deepspeed documentation

* Add missing import in deepspeed configuration

* Fix path in translation examples
2021-09-09 08:00:05 -04:00
Kamal Raj 1c191efc3a
flax ner example (#13365)
* flax ner example

* added task to README

* updated readme

* 1. ArgumentParser -> HfArgumentParser
2. step-wise logging,eval and save

* added requirements.txt

* added progress bar

* updated README

* added check_min_version

* updated training data permuattion with JAX

* added metric lib to requirements

* updated readme table

* fixed imports
2021-09-09 10:12:57 +05:30
Aleksander Smywiński-Pohl c37573806a
Fix typo in deepspeed documentation (#13482)
* Fix typo in deepspeed documentation

* Add missing import in deepspeed configuration
2021-09-08 11:24:10 -07:00
Anton Lozhkov e1f6e4903a
Fix integration tests for TFWav2Vec2 and TFHubert 2021-09-08 19:51:51 +03:00