Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
56b9b2c
add doctests to TF ViT
Mar 28, 2022
fbd0461
add doctests to TF ViT
Mar 28, 2022
f9d231f
add empty lines back in
Mar 28, 2022
946e4b4
Merge branch 'doc-test-vit-tf' of https://github.com/johko/transforme…
Mar 28, 2022
8529562
Fix blenderbot conversion script (#16472)
patil-suraj Mar 29, 2022
ed31ab3
Adding DocTest to TrOCR (#16398)
arnaudstiegler Mar 29, 2022
5216607
[MNLI example] Prevent overwriting matched with mismatched metrics (#…
eldarkurtic Mar 29, 2022
45abb37
Remove duplicate mLuke (#16460)
stevhliu Mar 29, 2022
aebca69
Fix missing output_attentions in PT/Flax equivalence test (#16271)
ydshieh Mar 29, 2022
86cff21
Fix some TF GPT-J CI testings (#16454)
ydshieh Mar 29, 2022
b62ac4d
Fix example test and test_fetcher for examples (#16478)
sgugger Mar 29, 2022
3015d12
fix wrong variable name (#16467)
wesleyacheng Mar 29, 2022
6358a4c
Add TF vision model code samples (#16477)
ydshieh Mar 29, 2022
875e07a
[doc] Fix missing trainer import (#16469)
wesleyacheng Mar 29, 2022
0540d1b
Add type hints for UniSpeech (#16399)
Tegzes Mar 29, 2022
7a9ef81
TF: properly handle kwargs in encoder_decoder architectures (#16465)
gante Mar 29, 2022
5b40a37
Add TF ViT MAE (#16255)
sayakpaul Mar 29, 2022
781af73
added typehints for RAG pytorch models (#16416)
akashe Mar 29, 2022
d7c8ce5
Avoid accessing .dataset of a DataLoader in Trainer (#16451)
sanderland Mar 29, 2022
ee18d4d
TF GPT2: clearer model variable naming with @unpack_inputs (#16311)
cakiki Mar 29, 2022
2b48323
Raise diff tolerance value for TFViTMAEModelTest (#16483)
ydshieh Mar 29, 2022
277d49a
Do not initialize `torch.distributed` process group if one is already…
Yard1 Mar 29, 2022
ffd19ee
TF GPT-J Type hints and TF decorator (#16488)
Dahlbomii Mar 30, 2022
147c816
Nit: MCSCOCO -> MS COCO (#16481)
AdityaKane2001 Mar 30, 2022
d04adc3
Add length to PreTrainedTokenizer train_new_from_iterator (#16493)
dctelus Mar 30, 2022
ae189ef
Add support for exporting GPT-J to ONNX-TRT (#16492)
tomerip Mar 30, 2022
c2f8eaf
TF: unpack inputs on Convbert, GPTJ, LED, and templates (#16491)
gante Mar 30, 2022
c4deb7b
Feature Extractor accepts `segmentation_maps` (#15964)
FrancescoSaverioZuppichini Mar 30, 2022
a73281e
[examples] max samples can't be bigger than the len of dataset (#16501)
stas00 Mar 30, 2022
81ac45f
update smddp api to v1.4.0 (#16371)
roywei Mar 30, 2022
857eb87
Support reduce_bucket_size=auto for deepspeed stages <3 (#16496)
manuelciosici Mar 30, 2022
a8b6443
Refactor Modeling Outputs (#16341)
FrancescoSaverioZuppichini Mar 31, 2022
99a0142
make tuple annotation more specific to avoid failures during symbolic…
chenbohua3 Mar 31, 2022
98939e6
Spanish translation of the file multilingual.mdx (#16329)
SimplyJuanjo Mar 31, 2022
c551add
Translate installation.mdx to Spanish (#16229)
lilianabs Mar 31, 2022
6a4dbba
Translate accelerate.mdx from english to spanish (#16176)
Sangohe Mar 31, 2022
05b4c32
fixed a typo (#16508)
bhadreshpsavani Mar 31, 2022
b808d8a
added type hints to xglm pytorch (#16500)
mowafess Mar 31, 2022
e4b2348
Fix syntax error in generate docstrings (#16516)
sgugger Mar 31, 2022
5807054
[research] link to the XTREME-S paper (#16519)
anton-l Mar 31, 2022
bfeff6c
Fixed a typo in legacy seq2seq_trainer.py (#16531)
Agoniii Apr 1, 2022
9de70f2
Add ONNX export for BeiT (#16498)
akuma12 Apr 1, 2022
483a945
call on_train_end when trial is pruned (#16536)
fschlatt Apr 1, 2022
afc5a1e
Type hints added (#16529)
Dahlbomii Apr 1, 2022
59a9c83
Fix Bart type hints (#16297)
gchhablani Apr 1, 2022
9947dd0
Add VisualBert type hints (#16544)
gchhablani Apr 1, 2022
5fe06b9
Adding missing type hints for mBART model (PyTorch) (#16429)
reichenbch Apr 1, 2022
823dbf8
Remove MBart subclass of XLMRoberta in tokenzier docs (#16546)
gchhablani Apr 1, 2022
2199382
Use random_attention_mask for TF tests (#16517)
ydshieh Apr 1, 2022
61ee26a
Improve code example (#16450)
NielsRogge Apr 1, 2022
53a4d6b
Pin tokenizers version <0.13 (#16539)
LysandreJik Apr 1, 2022
60d27b1
Add code samples for TF speech models (#16494)
ydshieh Apr 1, 2022
9ac49ab
add doctests to TF ViT
Mar 28, 2022
f4f0f6c
add empty lines back in
Mar 28, 2022
92e0b2d
use add_code_sample_docstrings decorator
Apr 1, 2022
1cb3323
merged
Apr 1, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/transformers/models/vit/modeling_tf_vit.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,6 @@ def call(
Returns:

Examples:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure if there is supposed to be an empty line here or not, for me it looked better without it

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just keep the empty line. It is done this way in other places.

```python
>>> from transformers import ViTFeatureExtractor, TFViTModel
>>> from PIL import Image
Expand All @@ -677,6 +676,8 @@ def call(
>>> inputs = feature_extractor(images=image, return_tensors="tf")
>>> outputs = model(**inputs)
>>> last_hidden_states = outputs.last_hidden_state
>>> list(last_hidden_states.shape)
[1, 197, 768]
```"""

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also wasn't sure about the style here, keep ``` and """ in the same line or split to two lines

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be more or less a style choice. In the model files, we usually keep it as ```"""


outputs = self.vit(
Expand Down Expand Up @@ -768,7 +769,6 @@ def call(
Returns:

Examples:

```python
>>> from transformers import ViTFeatureExtractor, TFViTForImageClassification
>>> import tensorflow as tf
Expand All @@ -787,6 +787,7 @@ def call(
>>> # model predicts one of the 1000 ImageNet classes
>>> predicted_class_idx = tf.math.argmax(logits, axis=-1)[0]
>>> print("Predicted class:", model.config.id2label[int(predicted_class_idx)])
Predicted class: Egyptian cat
```"""

outputs = self.vit(
Expand Down
1 change: 1 addition & 0 deletions utils/documentation_tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ src/transformers/models/van/modeling_van.py
src/transformers/models/vilt/modeling_vilt.py
src/transformers/models/vision_encoder_decoder/modeling_vision_encoder_decoder.py
src/transformers/models/vit/modeling_vit.py
src/transformers/models/vit/modeling_tf_vit.py
src/transformers/models/vit_mae/modeling_vit_mae.py
src/transformers/models/wav2vec2/modeling_wav2vec2.py
src/transformers/models/wav2vec2/tokenization_wav2vec2.py
Expand Down