Commit Graph

12885 Commits

Author SHA1 Message Date
Yih-Dar
ca3df9f0cf
Run doctest (in PRs) only when some doc example(s) are modified (#23387)
* fix

* fix

* update

---------

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
2023-05-16 23:29:02 +02:00
ropoctl
17d0290e57
Why crash the whole run when HFHub gives a 50x error? (#23320)
Logging an error and continuing is probably following the principle of least surprise.
2023-05-16 15:46:53 -04:00
Sylvain Gugger
d712ebd86d
Fix smdistributed check (#23414) 2023-05-16 15:18:31 -04:00
Taras Tsugrii
4e244b8817
Replace appends with list comprehension. (#23359)
It's more idiomatic and significantly more efficient because
1) it avoids repeated `append` call that Python has to resolve on each iteration
2) can preallocate the size of the final list avoiding resizing
2023-05-16 20:14:11 +01:00
Joao Gante
918a06e25d
Generate: add test to check KV format (#23403)
Co-authored-by: amyeroberts <22614925+amyeroberts@users.noreply.github.com>
2023-05-16 19:28:19 +01:00
Sylvain Gugger
9cf4a8b456
Build with non Python files (#23405)
* Add a test of the built release

* Polish everything

* Trigger CI
2023-05-16 14:23:10 -04:00
Joao Gante
5b1ad0eb73
Docs: add link to assisted generation blog post (#23397) 2023-05-16 18:54:34 +01:00
Stas Bekman
bbbc5c15d4
[AutoModel] fix torch_dtype=auto in from_pretrained (#23379)
* [automodel] fix torch_dtype=auto in from_pretrained

* add test

* fix logic

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

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

---------

Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
2023-05-16 10:21:42 -07:00
Zachary Mueller
8a58809312
Fix translation no_trainer (#23407)
* Fix translation
2023-05-16 13:10:42 -04:00
Joao Gante
130e154291
Generate: faster can_generate check on TF and Flax (#23398) 2023-05-16 15:12:21 +01:00
Younes Belkada
2922e394e3
[Pix2Struct] Add conditional generation on docstring example (#23399)
add conditional generation on docstring
2023-05-16 15:59:18 +02:00
Lucain
52d516c3a9
Minor fixes in transformers-tools (#23364)
* Few fixes in new Tools implementation

* code quality
2023-05-16 15:55:44 +02:00
Sohyun Sim
728c5e82cc
🌐 [i18n-KO] Translated asr.mdx to Korean (#23106)
* docs: ko: task/asr.mdx

* feat: manual draft

* fix: resolve suggestions

Co-authored-by: Hyeonseo Yun <0525yhs@gmail.com>

---------

Co-authored-by: Hyeonseo Yun <0525yhs@gmail.com>
2023-05-16 09:22:56 -04:00
Ivan Sedykh
770a1275d3
Fix chat prompt in HFAgent (#23335)
fix chat prompts
2023-05-16 09:18:58 -04:00
Joao Gante
466af1a356
OPT/BioGPT: Improved attention mask shape exception (#23270) 2023-05-16 13:59:53 +01:00
Yih-Dar
21741e8c7e
Update test_batched_inference_image_captioning_conditioned (#23391)
* fix

* fix

* fix test + add more docs

---------

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
Co-authored-by: younesbelkada <younesbelkada@gmail.com>
2023-05-16 14:49:24 +02:00
Yih-Dar
d765717c76
Fix RwkvModel (#23392)
fix

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
2023-05-16 12:14:54 +02:00
ready-research
80ca924709
Use mkstemp to replace deprecated mktemp (#23372)
* Use `mkstemp` to replace deprecated `mktemp`

The `tempfile.mktemp` function is [deprecated](https://docs.python.org/3/library/tempfile.html#tempfile.mktemp) due to [security issues](https://cwe.mitre.org/data/definitions/377.html).

* Update src/transformers/utils/hub.py

Co-authored-by: amyeroberts <22614925+amyeroberts@users.noreply.github.com>

---------

Co-authored-by: amyeroberts <22614925+amyeroberts@users.noreply.github.com>
2023-05-16 11:10:54 +01:00
Koki Tanaka
ba6815e824
Replace NumPy Operations with JAX NumPy Equivalents for JIT Compilation Compatibility (#23356)
* Replace numpy operations with jax.numpy for JIT compatibility

Replaced numpy operations with their jax.numpy equivalents in the transformer library. This change was necessary to prevent errors during JIT compilation. Specifically, the modifications involve changing numpy's in-place assignments to jax.numpy's immutable update methods.

* rm numpy import

* rm numpy import and fix np->jnp

* fixed slices bug

* fixed decoder_start_tokens -> decoder_start_token_id

* fixed jnp in modleing mt5

* doc fix

* rm numpy import

* make
2023-05-16 10:54:19 +01:00
dewa
c2393cad08
Added type hints for Graphormer pytorch version (#23073)
* Added type hints for `Graphormer` pytorch version

added type hints for graphormers pytorch , checked formating issues .

* made the code less bloated
2023-05-15 18:27:41 +01:00
LWprogramming
ee3be05310
Fix test typos - audio feature extractors (#23310) 2023-05-15 17:22:10 +01:00
Yih-Dar
8f76dc8e5a
Skip failing AlignModelTest::test_multi_gpu_data_parallel_forward (#23374)
fix

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
2023-05-15 16:46:58 +02:00
AinL
41d47db90f
[Bugfix] OPTDecoderLayer does not return attentions when gradient_checkpointing and training is enabled. (#23367)
Update modeling_opt.py
2023-05-15 13:31:53 +01:00
Yih-Dar
569a97adb2
Revert "Only add files with modification outside doc blocks" (#23371)
fix

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
2023-05-15 14:28:36 +02:00
Yih-Dar
c94f7a1cce
Fix OwlViTForObjectDetection.image_guided_detection doc example (#23370)
fix

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
2023-05-15 14:17:09 +02:00
Yih-Dar
380280d994
Fix BigBirdForMaskedLM doctest (#23369)
fix

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
2023-05-15 14:15:43 +02:00
Yih-Dar
96ae83a0d2
Fix some is_xxx_available (#23365)
* fix

* fix

---------

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
2023-05-15 14:08:45 +02:00
richardachen
65b885027a
Typo suggestion (#23360)
Update graphormer.mdx

Typo suggestion
2023-05-15 12:04:16 +01:00
Yih-Dar
81a73fa638
Fix issue introduced in PR #23163 (#23363)
* fix

* fix

---------

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
2023-05-15 11:38:44 +02:00
Gregory
2958b55fe5
Removing one of the twice defined position_embeddings in LongFormer (#23343)
Removing twice defined position_embeddings

The self.position_embeddings in LongFormerEmbeddings is defined twice.
Removing the first with padding_idx
2023-05-15 10:35:55 +01:00
Yih-Dar
cf11493dce
Use cu118 with cudnn >= 8.6 in docker file (#23339)
* fix

* fix

---------

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
2023-05-12 21:58:15 +02:00
Susnato Dhar
79743cedab
replaced assert with raise ValueError for t5, switch_transformers, pix2struct, mt5, longt5, gptsan_japanese. (#23273)
* replaced assert with raise ValueError

* one liner

* reverse one liner and cache-decoder check
2023-05-12 19:29:50 +01:00
Alisamar Husain
291c5e9b25
Handle padding warning in generation when using inputs_embeds (#23131)
* Handle padding warning in generation when using `inputs_embeds`

* Simpler condition

* Black formatter

* Changed warning logic
2023-05-12 17:06:15 +01:00
hwuebben
65d7b21b77
OR am I crazy? (#23295)
or or and
2023-05-12 16:47:40 +01:00
Steven Liu
ef3e25ce4e
[docs] Fix Agents and Tools docstring (#23313)
fix kwargs
2023-05-12 08:29:13 -07:00
Yih-Dar
a3975f94f3
Only add files with modification outside doc blocks (#23327)
* min. version for pytest

* fix

* fix

---------

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
2023-05-12 16:35:15 +02:00
Mario Lezcano Casado
7f8b909189
Compute the mask in-place, with less memory reads, and on CUDA on XLNetLMHeadModel (#23332)
When working on TorchInductor, I realised that there was a part from
`XLNetLMHeadModel` that was being compiled to CPU code.

This PR should allow to fuse this operation with other CUDA operations
in `torch.compile`. It also should be faster on eager mode, as it has a
this implementation has a lower foot-print.

If in-place operations are not allowed even in non-grad context, I still
believe that doing ones + tril rather than a ones + tril + zeros + cat
should be faster simply due to the number of memory reads/writes.

I tested that this code produces the same results for `0 <= qlen,mlen <
10` and `same_length in (True, False)`.
2023-05-12 14:35:37 +01:00
Yih-Dar
8c8744a94a
Fix docker image (caused by tensorflow_text) (#23321)
fix

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
2023-05-12 13:37:37 +02:00
Shehan Munasinghe
c045249049
Add swiftformer (#22686)
* Commit the automatically generated code

using add-new-model-like

* Update description at swiftformer.mdx file

* remove autogenerated code for MaskedImageModeling

* update weight conversion scripts

* Update modeling_swiftformer.py

* update configuration_swiftformer.py

* Update test_modeling_swiftformer.py

* update modeling code - remove einops dependency

* Update _toctree.yml

* update modeling code - remove copied from comments

* update docs

* Revert "update docs"

This reverts commit c2e05e2998.

* update docs

* remove unused reference SwiftFormerImageProcessor

* update dependency_versions_table.py

* update swiftformer.mdx

* update swiftformer.mdx

* change model output type - no attentions

* update model org name

* Fix typo

* fix copies

* Update tests/models/swiftformer/test_modeling_swiftformer.py

Co-authored-by: amyeroberts <22614925+amyeroberts@users.noreply.github.com>

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

Co-authored-by: amyeroberts <22614925+amyeroberts@users.noreply.github.com>

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

Co-authored-by: amyeroberts <22614925+amyeroberts@users.noreply.github.com>

* Update docs/source/en/model_doc/swiftformer.mdx

Co-authored-by: amyeroberts <22614925+amyeroberts@users.noreply.github.com>

* Update src/transformers/models/swiftformer/configuration_swiftformer.py

Co-authored-by: amyeroberts <22614925+amyeroberts@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: amyeroberts <22614925+amyeroberts@users.noreply.github.com>

* Apply suggestions from code review

Co-Authored-By: amyeroberts <22614925+amyeroberts@users.noreply.github.com>

* Apply suggestions from code review

Co-Authored-By: amyeroberts <22614925+amyeroberts@users.noreply.github.com>

* Apply suggestions from code review

Co-Authored-By: amyeroberts <22614925+amyeroberts@users.noreply.github.com>

* Update modeling_swiftformer.py

fix-copies

* make style, make quality, fix-copies

* Apply suggestions from code review

Co-Authored-By: amyeroberts <22614925+amyeroberts@users.noreply.github.com>

* Apply suggestions from code review

Co-Authored-By: amyeroberts <22614925+amyeroberts@users.noreply.github.com>

* make style

Co-Authored-By: amyeroberts <22614925+amyeroberts@users.noreply.github.com>

* Add suggestions from code review

Co-Authored-By: amyeroberts <22614925+amyeroberts@users.noreply.github.com>

* Add suggestions from code review

Co-Authored-By: amyeroberts <22614925+amyeroberts@users.noreply.github.com>

* make fix-copies

* Update modeling_swiftformer.py

* Update modeling_swiftformer.py

* Add suggestions from code review

Co-Authored-By: amyeroberts <22614925+amyeroberts@users.noreply.github.com>

---------

Co-authored-by: amyeroberts <22614925+amyeroberts@users.noreply.github.com>
2023-05-12 11:52:31 +01:00
Yih-Dar
364ced6893
Remove LanguageIdentificationTool in __init__.py as we don't have it yet (#23326)
remove LanguageIdentificationTool

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
2023-05-12 12:11:20 +02:00
Sylvain Gugger
273f5ba026
Revert "search buffers for dtype" (#23308)
Revert "search buffers for dtype (#23159)"

This reverts commit ef42c2c487.
2023-05-11 15:31:59 -04:00
Yih-Dar
ba71d9e94c
unpin tf prob (#23293)
* unpin tf prob

---------

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
2023-05-11 21:28:08 +02:00
Sylvain Gugger
786b9cf5ca
Style 2023-05-11 14:40:38 -04:00
Sylvain Gugger
4eea25b445
Fix image segmentation tool test (#23306) 2023-05-11 14:38:11 -04:00
Freddy Boulton
662751b4e2
Fix typo in gradio-tools docs (#23305)
Fix typo
2023-05-11 14:31:28 -04:00
Sylvain Gugger
f76fb3aeea
Fix broken links in the agent docs (#23297) 2023-05-11 14:26:19 -04:00
Lysandre Debut
71b19ee251
Agents extras (#23301)
* Agents extras

* Add to docs
2023-05-11 14:25:51 -04:00
raghavanone
ab96bf0294
Add gradient_checkpointing parameter to FlaxWhisperEncoder (#23300)
Add gradient_checkpointing parameter
2023-05-11 19:13:05 +01:00
Alessandro Pietro Bardelli
83eda6435e
Better check for packages availability (#23163)
* Better check for packages availability

* amend _optimumneuron_available

* amend torch_version

* amend PIL detection and lint

* lint

* amend _faiss_available

* remove overloaded signatures of _is_package_available

* fix sklearn and decord detection

* remove unused checks

* revert
2023-05-11 13:52:22 -04:00
Yih-Dar
d51296d9c2
skip test_run_squad_no_trainer for now (#23302)
skip

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
2023-05-11 19:26:48 +02:00