1. 15 Nov, 2021 2 commits
  2. 13 Nov, 2021 1 commit
  3. 12 Nov, 2021 1 commit
    • Nicolas Patry's avatar
      Adding support for raw python `generator` in addition to `Dataset` for pipelines (#14352) · ed5d1551
      Nicolas Patry authored
      * Adding support for raw python `generator` in addition to `Dataset`
      
      The main goal is to ease the create of streaming data to the pipe.
      
      `Dataset` is more involved and pytorch specific.
      
      This PR, provides a way to use a python iterator too.
      This enabled #14250 but can be proposed as a standalone PR.
      
      ```python
      from transformers import pipeline
      
      def read_data(filename):
          with open(filename, 'r') as f:
              for line in f:
                  yield f
      
      pipe = pipeline("text-classification")
      for classified in pipe(read_data("large_file.txt")):
          print("Success ! ", classified)
      ```
      
      The main caveat of this, is the interaction with `DataLoader` with
      `num_workers>1`. When you have multiple workers, each receive a copy
      of the generator (like `IterableDataset`). That means the naive Iterator
      will fail since all workers iterate on all items of the generator.
      
      There are ways to do clever "skipping", but it could be bad still
      because all workers still do have to pass through all items of the
      generator (they just ignore items they don't handle), depending on
      the case it might be bad.
      
      Using `num_workers=1` is the simplest fix and if the cost of loading
      your data is small enough should be good enough. In the above example
      trying to do smart tricks to skip some lines is unlikely to be a net
      positive for instance.
      
      If there are better ways to do "jumps" on some data, then using
      `Dataset` is more advised (since then differents workers can just jump
      themselves).
      
      * Adding iterator support for `tf` too.
      ed5d1551
  4. 11 Nov, 2021 4 commits
  5. 10 Nov, 2021 2 commits
  6. 09 Nov, 2021 5 commits
    • Patrick von Platen's avatar
      [Bert2Bert] allow bert2bert + relative embeddings (#14324) · e81d8d7f
      Patrick von Platen authored
      * [Bert2Bert] allow bert2bert + relative embeddings
      
      * up
      
      * Update README_ko.md
      
      * up
      
      * up
      e81d8d7f
    • Yih-Dar's avatar
      babd0b9a
    • Yih-Dar's avatar
      Add TFViTModel (#13778) · be4a6c64
      Yih-Dar authored
      
      
      * Start the work for TFViTModel
      
      * Convert to TF code - need to check in the follow up commits
      
      * Clean up model code
      
      * Expose TFViTModel
      
      * make style
      
      * make quality
      
      * Add test
      
      * make style & quality
      
      * Fix some imports
      
      * fix wrong usage - *kwargs => ** kwargs
      
      * Fix Conv2D weight loading (PT->TF) issue
      
      * Add tests for images with different sizes + fix model
      
      * Fix some common tests for TFViTModel
      
      * Use inputs instead of input_ids in test_compile_tf_model
      
      * Add a comment about transpose and Conv2D in convert_tf_weight_name_to_pt_weight_name
      
      * Avoid transpose in TFViT call
      
      * Fix Conv2D issue in load_tf2_weights_in_pytorch_model
      
      * Use tf.keras.layers.Conv2D instead of tf.nn.conv2d
      
      * Using simpler heuristic to detect Conv2D layer
      
      * Change convert_tf_weight_name_to_pt_weight_name to return TransposeType
      
      * Check tf_weight_shape is not None before using it
      
      * Apply suggestions from code review
      Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>
      
      * fix missing comma
      
      * fix input dtype
      Co-authored-by: default avatarydshieh <ydshieh@users.noreply.github.com>
      Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>
      be4a6c64
    • Apoorv Garg's avatar
      Correct order of overflowing tokens for LayoutLmV2 tokenizer (#13495) · 6326aa4b
      Apoorv Garg authored
      
      
      * correct order of overflowing tokens for LayoutLmV2 tokenizer
      
      * test to check order of overflowing_tokens for a seq of input_ids
      
      * fix up quality
      
      * added suggested changes
      
      * check that tests the bbox sequence
      
      * pair_input test added
      
      * pass quality test
      
      * check bbox sequence added
      
      * unittest method
      
      * comments added
      
      * add overflowing bbox test
      
      * improved "seq_1"
      Co-authored-by: default avatarSaulLu <55560583+SaulLu@users.noreply.github.com>
      
      * improve code quality
      Co-authored-by: default avatarSaulLu <lucilesaul.com@gmail.com>
      Co-authored-by: default avatarSaulLu <55560583+SaulLu@users.noreply.github.com>
      6326aa4b
    • Yih-Dar's avatar
      Add FlaxVisionEncoderDecoderModel (#13359) · 95b3ec3b
      Yih-Dar authored
      
      
      * Start the work on FlaxVisionEncoderDecoderModel
      
      * Add FlaxVisionEncoderDecoderModel
      
      * Add VisionEncoderDecoderConfig
      
      * Make FlaxVisionEncoderDecoderModel visible to transformers
      
      * Add test
      
      * Fix wrong getattr usage
      
      * Fix tests
      
      * Add FlaxAutoModelForVision2Seq
      
      * Expose FLAX_MODEL_FOR_VISION_2_SEQ_MAPPING
      
      * clean-up
      
      * add integration test
      
      * update expected logits
      
      * update expected scores
      
      * Add ViT2GPT2ModelIntegrationTest + some cleaning
      
      * Add projection layer + PT/Flax equivalence tests
      
      * Fix import
      
      * minor changes
      
      * make test slow again
      
      * Apply suggestions
      
      * Add modeling_flax_vision_encoder_decoder to _ignore_modules in get_model_modules()
      
      * fix copies
      
      * Apply suggestions from code review
      Co-authored-by: default avatarSuraj Patil <surajp815@gmail.com>
      
      * split long strings in multiple lines
      
      * decoder_input_ids can't be None
      
      * Add back test_configuration_tie
      
      * Remove attention_mask parameter
      
      * fix test - encoder_last_hidden_state should be encoder_outputs.last_hidden_state instead of the projected vector
      
      * Apply suggestions from code review
      Co-authored-by: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
      
      * Remove more encoder_attention_mask
      
      * remove encoder_attention_mask when calling self.decode (in FlaxVisionEncoderDecoderModule)
      
      * Fix style + pass 1s instead of None as encoder_attention_mask
      
      * fix init_weights
      
      * pass None for encoder_attention_mask
      
      * pass 1s instead of None as encoder_attention_mask
      
      * Fix doc style
      Co-authored-by: default avatarydshieh <ydshieh@users.noreply.github.com>
      Co-authored-by: default avatarSuraj Patil <surajp815@gmail.com>
      Co-authored-by: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
      95b3ec3b
  7. 08 Nov, 2021 4 commits
  8. 06 Nov, 2021 2 commits
  9. 04 Nov, 2021 2 commits
  10. 03 Nov, 2021 5 commits
  11. 02 Nov, 2021 3 commits
  12. 01 Nov, 2021 4 commits
  13. 29 Oct, 2021 5 commits
    • Lysandre Debut's avatar
      Torch 1.10 (#14169) · 63d91f44
      Lysandre Debut authored
      * Torch 1.10
      
      * torch scatter for 1.10
      
      * style
      
      * Skip tests
      ok
      63d91f44
    • Sylvain Gugger's avatar
      Generalize problem_type to all sequence classification models (#14180) · c28bc80b
      Sylvain Gugger authored
      * Generalize problem_type to all classification models
      
      * Missing import
      
      * Deberta BC and fix tests
      
      * Fix template
      
      * Missing imports
      
      * Revert change to reformer test
      
      * Fix style
      c28bc80b
    • Nicolas Patry's avatar
      Adding `handle_long_generation` paramters for `text-generation` pipeline. (#14118) · dc540dd3
      Nicolas Patry authored
      * Adding `handle_long_generation` paramters for `text-generation` pipeline.
      
      * More error handling
      
      * Fixing tests by dropping tf support on this functionality, it needs
      
      `max_new_tokens` to make it possible to understand user's intent.
      Otherwise, `max_length` == `tokenizer.model_max_length` <
      input_ids.shape[0].
      
      * Fixing doc ?
      
      * Doc ?
      
      * Remove link from doc.
      
      * Catched an issue on roberta.
      
      * Damn doc.
      
      * Non BC proposal ?
      
      * Cleaning the fix ?
      
      * Finally using only a test override.
      
      * Don't need to modify this.
      
      * Bad print.
      dc540dd3
    • Daniel Stancl's avatar
      Add `BlenderbotTokenizerFast` (#13720) · d37f1fb8
      Daniel Stancl authored
      * Add the support for the fast (rust) implementation of BlenbderbotTokenizer
      
      * Fix a converter and a typo in a doc
      
      * Apply the patil-suraj's suggestion
      
      * (Nitpick) Fast tokenization -> Fast Tokenization in doc
      
      * Apply the SaulLu's suggestion
      
      * Apply Narsil's suggestion to fix test pipelines
      
      * Add encoder_no_repeat_ngram_size according to the Narsil's suggestion
      
      * Revert the last (unnecessary) commit
      
      * Override pipeline config for Blenderbot to allow for larger pos. emb.
      
      * make fix-copies
      d37f1fb8
    • Thomas Wang's avatar
      Remove n_ctx from configs (#14165) · 5b45422b
      Thomas Wang authored
      * Remove n_ctx from configs
      
      * Fix GPTJ and OpenAIGPT, both are acceptable breaking changes as there are no configs such that it breaks
      
      * Remove unecessary n_positions from TFOpenAIGPT
      5b45422b