Commit Graph

9066 Commits

Author SHA1 Message Date
Lysandre Debut
0b5bf6abef
Framework split model report (#15825) 2022-02-25 12:00:00 -05:00
Sylvain Gugger
0118c4f6a8
Re-enable doctests for the quicktour (#15828)
* Re-enable doctests for the quicktour

* Re-enable doctests for task_summary (#15830)

* Remove &
2022-02-25 17:46:38 +01:00
Ella Charlaix
fd5b05eb81
Add ONNX Runtime quantization for text classification notebook (#15817) 2022-02-25 11:29:35 -05:00
Suraj Patil
bf1fe32824
[examples/summarization and translation] fix readme (#15833) 2022-02-25 17:28:16 +01:00
Yih-Dar
8635407bc7
Fix tf.concatenate + test past_key_values for TF models (#15774)
* fix wrong method name tf.concatenate

* add tests related to causal LM / decoder

* make style and quality

* clean-up

* Fix TFBertModel's extended_attention_mask when past_key_values is provided

* Fix tests

* fix copies

* More tf.int8 -> tf.int32 in TF test template

* clean-up

* Update TF test template

* revert the previous commit + update the TF test template

* Fix TF template extended_attention_mask when past_key_values is provided

* Fix some styles manually

* clean-up

* Fix ValueError: too many values to unpack in the test

* Fix more: too many values to unpack in the test

* Add a comment for extended_attention_mask when there is past_key_values

* Fix TFElectra extended_attention_mask when past_key_values is provided

* Add tests to other TF models

* Fix for TF Electra test: add prepare_config_and_inputs_for_decoder

* Fix not passing training arg to lm_head in TFRobertaForCausalLM

* Fix tests (with past) for TF Roberta

* add testing for pask_key_values for TFElectra model

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
2022-02-25 17:11:46 +01:00
Pavel Belevich
4818bf7aed
HFTracer.trace should use/return self.graph to be compatible with torch.fx.Tracer (#15824) 2022-02-25 15:54:45 +01:00
Nicolas Patry
ad0d7d1745
Adding the option to return_timestamps on pure CTC ASR models. (#15792)
* Adding the option to return_timestamps on pure CTC ASR models.

* Remove `math.prod` which was introduced in Python 3.8

* int are not floats.

* Reworking the PR to support "char" vs "word" output.

* Fixup!

* Update src/transformers/pipelines/automatic_speech_recognition.py

Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>

* Update src/transformers/pipelines/automatic_speech_recognition.py

Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>

* Update src/transformers/pipelines/automatic_speech_recognition.py

Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>

* Update src/transformers/pipelines/automatic_speech_recognition.py

Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>

* Update src/transformers/pipelines/automatic_speech_recognition.py

Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>

* Update src/transformers/pipelines/automatic_speech_recognition.py

Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>

* Update src/transformers/pipelines/automatic_speech_recognition.py

Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>

* Update src/transformers/pipelines/automatic_speech_recognition.py

Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>

* Update src/transformers/pipelines/automatic_speech_recognition.py

Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>

* Quality.

Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
2022-02-25 14:06:45 +01:00
Tanay Mehta
7566734d6f
Add model specific output classes to PoolFormer model docs (#15746)
* Added model specific output classes to poolformer docs

* Fixed Segformer typo in Poolformer docs
2022-02-25 13:43:56 +01:00
Pavel Belevich
7963578fc5
Fix dummy_inputs() to dummy_inputs in symbolic_trace doc (#15776) 2022-02-25 11:32:23 +01:00
Sylvain Gugger
074645e32a
Fix semantic segmentation pipeline test (#15826) 2022-02-25 09:21:29 +01:00
Lysandre Debut
b7e292aebd
Fix the push run (#15807) 2022-02-24 19:30:17 +01:00
Patrick von Platen
cbf4391177
[TFXLNet] Correct tf xlnet generate (#15822)
* [TFXLNet] Correct tf xlnet

* adapt test comment
2022-02-24 19:23:34 +01:00
Patrick von Platen
2f0f9038e2
[Barthez Tokenizer] Fix saving (#15815) 2022-02-24 19:09:09 +01:00
Patrick von Platen
ca57b45071
[Unispeech] Fix slow tests (#15818)
* remove soundfile old way of loading audio

* Adapt slow test
2022-02-24 19:08:54 +01:00
Sylvain Gugger
35ecf99cc4
Revert changes in logit size for semantic segmentation models (#15722)
* Revert changes in logit size for semantic segmentation models

* Address review comments
2022-02-24 15:52:52 +01:00
Sylvain Gugger
d1fcc90abf
Fix from_pretrained with default base_model_prefix (#15814) 2022-02-24 11:43:51 +01:00
Sylvain Gugger
7f921bcf47
Fix add-new-model-like when old model checkpoint is not found (#15805)
* Fix add-new-model-like command when old checkpoint can't be recovered

* Style
2022-02-24 08:58:18 +01:00
Lysandre Debut
bb7949b35a
Fix model templates (#15806)
* Fix model templates

* Update paths
2022-02-23 18:27:29 -05:00
Lysandre
309e87e25e Docker images should only run on a daily basis 2022-02-23 18:01:44 -05:00
Lysandre
c475f3ce2d Scheduled tests should only run on a daily basis 2022-02-23 17:52:22 -05:00
Eliott C
6336017c15
Fix build_documentation CI (#15803) 2022-02-23 21:53:51 +01:00
Lysandre Debut
a0e3480699
[Test refactor 5/5] Build docker images (#15729) 2022-02-23 15:48:19 -05:00
Lysandre Debut
4c737f0e40
[Test refactor 4/5] Improve the scheduled tests (#15728) 2022-02-23 15:48:05 -05:00
Lysandre Debut
d3ae2bd3cf
[Test refactor 3/5] Notification service improvement (#15727)
* Per-folder tests reorganization

* Review comments

Co-authored-by: sgugger <sylvain.gugger@gmail.com>
Co-authored-by: Stas Bekman <stas@stason.org>
2022-02-23 15:46:59 -05:00
Lysandre Debut
0400b2263d
[Test refactor 2/5] Tests fetcher (#15726)
* Tests fetcher

* Review comments

Co-authored-by: sgugger <sylvain.gugger@gmail.com>
Review comments
2022-02-23 15:46:37 -05:00
Lysandre Debut
29c10a41d0
[Test refactor 1/5] Per-folder tests reorganization (#15725)
* Per-folder tests reorganization

Co-authored-by: sgugger <sylvain.gugger@gmail.com>
Co-authored-by: Stas Bekman <stas@stason.org>
2022-02-23 15:46:28 -05:00
Steven Liu
fecb08c2b8
🧼 NLP task guides (#15731)
* clean commit of changes to NLP tasks

* 🖍 apply feedback

* 📝 move tf data collator in multiple choice

Co-authored-by: Steven <stevhliu@gmail.com>
2022-02-23 13:58:33 -06:00
Eliott C
86636f52a9
Fix indent in doc-builder CI (#15798) 2022-02-23 20:01:33 +01:00
Eliott C
a1efc82362
HTML dev docs (#15678)
Co-authored-by: Pierric Cistac <Pierrci@users.noreply.github.com>
2022-02-23 19:43:22 +01:00
lsb
3f76bf54ff
Align documentation with code defaults (#15468)
In the code, `do_normalize` defaults to True
2022-02-23 18:39:41 +01:00
Julien Chaumond
32f5de10a0
[doc] custom_models: mention security features of the Hub (#15768)
* custom_models: tiny doc addition

* mention security feature earlier in the section

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>
2022-02-23 11:40:06 -05:00
Nicolas Patry
9e71d46455
Enable image-segmentation on AutoModelForSemanticSegmentation (#15647)
* Enabling Beit SegFormer to `image-segmentation`.

* Fixing the score.

* Fix import ?

* Missing in type hint.

* Multiple test fixes:

- Add `raw_image` support. It should be the default IMHO since in Python
  world it doesn't make any sense to base64 encode the image (Sorry
  @mishig, didn't catch that in my review). I really think we should
  consider breaking BC here.
- Add support for Segformer tiny test (needed
  `SegformerModelTester.get_config` to enable TinyConfig
  @NielsRogge)
- Add the check that `batch_size` works correctly on that pipeline.
  Uncovered that it doesn't for Detr, which IMO is OK since images
  after `feature_extractor` don't have the same size. Comment should
  explain.

* Type hint as a string.

* Make fixup + update black.

* torch+vision protections.

* Don't use torchvision, use F.interpolate instead (no new dep).

* Last fixes for Segformer.

* Update test to reflect new image (which was broken)

* Update tests.

* Major BC modification:

- Removed the string compressed PNG string, that's a job for users
`transformers` stays in python land.
- Removed the `score` for semantic segmentation. It has hardly a meaning
  on its own in this context.
- Don't include the grayscale with logits for now (which could enable
  users to get a sense of confidence). Might be done later.
- Don't include the surface of the mask (could be used for sorting by
  users, to filter out small masks). It's already calculable, and
  it's easier to add later, than to add now and break later if we need.

* `make fixup`.

* Small changes.

* Rebase + doc fixup.
2022-02-23 17:20:26 +01:00
Suraj Patil
1b23979736
[ViLT] Fix checkpoint url in config (#15790)
* [ViLT] Fix checkpoint url in config

* Apply suggestions from code review

Co-authored-by: NielsRogge <48327001+NielsRogge@users.noreply.github.com>

Co-authored-by: NielsRogge <48327001+NielsRogge@users.noreply.github.com>
2022-02-23 14:51:40 +01:00
Suraj Patil
de737866f2
[CLIP] fix grad ckpt (#15789) 2022-02-23 14:30:05 +01:00
Nicolas Patry
a3e607d19e
Supporting Merges.txt files than contain an endline. (#15782)
(`hf-internal-testing/tiny-clip` for instance)
2022-02-23 11:51:48 +01:00
Suraj Patil
24588c6731
[M2M100, XGLM] fix create_position_ids_from_inputs_embeds (#15751) 2022-02-23 10:46:42 +01:00
Nicolas Patry
f9582c205a
Adding ZeroShotImageClassificationPipeline (#12119)
* [Proposal] Adding ZeroShotImageClassificationPipeline

- Based on CLIP

* WIP, Resurection in progress.

* Resurrection... achieved.

* Reword handling different `padding_value` for `feature_extractor` and
`tokenizer`.

* Thanks doc-builder !

* Adding docs + global namespace `ZeroShotImageClassificationPipeline`.

* Fixing templates.

* Make the test pass and be robust to floating error.

* Adressing suraj's comments on docs mostly.

* Tf support start.

* TF support.

* Update src/transformers/pipelines/zero_shot_image_classification.py

Co-authored-by: Suraj Patil <surajp815@gmail.com>

Co-authored-by: Suraj Patil <surajp815@gmail.com>
2022-02-23 09:41:42 +01:00
Santiago Castro
05a12a090d
Fix HfArgumentParser when passing a generator (#15758)
* Fix `HfArgumentParser` when passing a generator

* Add missing import

* Always convert `dataclass_types` into a list
2022-02-23 00:16:38 +01:00
Julien Chaumond
db57bb2b71
Cleanup transformers-cli (#15767) 2022-02-22 15:58:05 -05:00
Yongrae Jo
3db2e8f92b
Fix typo on examples/pytorch/question-answering (#15644)
cna -> can
2022-02-22 13:51:07 -05:00
Boumadane Abdelmoumene
2cdb6dbee5
fixed pipeline code (#15607)
Co-authored-by: Boumadane Abdelmoumene <moumene.boumadane@gmail.com>
2022-02-22 13:46:21 -05:00
Patrick von Platen
c44d3675c2
Time stamps for CTC models (#15687)
* [Wav2Vec2 Time Stamps]

* Add first version

* add word time stamps

* Fix

* save intermediate space

* improve

* [Finish CTC Tokenizer]

* remove @

* remove @

* push

* continue with phonemes

* up

* finish PR

* up

* add example

* rename

* finish

* Apply suggestions from code review

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

* correct split

* finalize

Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
2022-02-22 19:26:44 +01:00
Funtowicz Morgan
32295b15a1
Gelu10 (#15676)
* Add GeLU10 (clipped version of GeLU) to transformers to improve quantization performances.

* Add unittests.

* Import tensorflow after `is_tf_available` check.

* Fix tensorflow wrong function `tf.tensor` to `tf.constant`

* style.

* use `tf.math.max`

* Fix tf tests.

* style.

* style style style style style style

* style style style style style style

* Address @sgugger comments.

* Fix wrong operator for raising ValueError for ClippedGELUActivation.
2022-02-22 18:21:16 +01:00
Joao Gante
2c3fcc647a
TF train_step docstring (#15755)
* TF train_step docstring
2022-02-22 11:18:35 +00:00
Francesco Saverio Zuppichini
38bed912e3
added link to our writing-doc document (#15756) 2022-02-22 09:57:28 +01:00
SaulLu
0187c6f0ad
revert temporary addition to test next version of CLIPTokenizerFast (#15717) 2022-02-21 18:30:11 +01:00
Joao Gante
3956b133b6
TF text classification examples (#15704)
* Working example with to_tf_dataset

* updated text_classification

* more comments
2022-02-21 17:17:59 +00:00
Kevin Ko
142b69f24b
Add layer_idx to CrossAttention of GPT2 model (#15730)
* Add layer_idx to CrossAttention

* Add layer_idx to crossattention of ImageGPT model
2022-02-21 17:31:39 +01:00
Suraj Patil
86119c1154
add VisionTextDualEncoder and CLIP fine-tuning script (#15701)
* begin script

* update script

* fix features and data args

* main

* add requirements

* add column name args

* fix captions

* don't jit transforms

* fix caption

* fix labels, handle attention mask

* convert pixel values to numpy

* labels => input_ids

* transform images on the fly

* use AutoModel class, create the hybird model outside of the script

* fix version message

* add readme

* Apply suggestions from code review

Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>

* adderss review comments

* add more comments

* allow freezing vision and text models

Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
2022-02-21 16:10:59 +01:00
Ivan Agarský
5444687f0f
Fix minor comment typos (#15740) 2022-02-21 12:41:27 +01:00