1. 19 Nov, 2021 3 commits
  2. 18 Nov, 2021 3 commits
    • Sylvain Gugger's avatar
    • NielsRogge's avatar
      Add ImageGPT (#14240) · da36c557
      NielsRogge authored
      * First draft
      
      * More improvements
      
      * Improve conversion script
      
      * Fix init weights for layer norm
      
      * Fix correct model for conversion script
      
      * Don't tie input and output embeddings
      
      * Add print statements for debugging
      
      * Add print statements for debugging
      
      * Fix vocab size of model
      
      * Improve documentation, remove fast tokenizer
      
      * Add ImageGPTForImageClassification, improve docs
      
      * Fix docs issue
      
      * Set verbosity level back to info
      
      * Improve tests
      
      * Fix tests and add figure
      
      * Delete tokenizer file
      
      * Remove ImageGPTTokenizer from init files
      
      * Remove ImageGPTLayer from init files
      
      * Remove ImageGPT tokenizer from docs
      
      * First draft of ImageGPTFeatureExtractor
      
      * Fix typo
      
      * Fix bug
      
      * More improvements
      
      * Apply suggestions from code review, add tests for feature extractor
      
      * Fix layernorm
      
      * Update save_pretrained method
      
      * Fix issue
      
      * Make all tests of ImageGPTFeatureExtractor pass
      
      * Update code examples
      
      * Rename model inputs to pixel_values
      
      * Improve code examples
      
      * Update init_weights to post_init
      
      * Fix post_init
      da36c557
    • Sylvain Gugger's avatar
      Add a post init method to all models (#14431) · d83b0e0c
      Sylvain Gugger authored
      * Add a post init method to all models
      
      * Fix tests
      
      * Fix last tests
      
      * Fix templates
      
      * Add comment
      
      * Forgot to save
      d83b0e0c
  3. 17 Nov, 2021 3 commits
    • N's avatar
      [WIP] Ensure TF model configs can be converted to proper JSON (#14415) · 1991da07
      N authored
      
      
      * test: make sure model configs are jsonifiable
      
      * fix: return python dict instead of config object
      
      * fix: accept pretrained config and use correct class
      
      * Re-enabling slow tests and applying them to core models only
      
      * Re-enabling slow tests and applying them to core models only
      
      * Add new test file to fetcher
      
      * Remove tooslow tests from test_modeling_tf_common.py
      
      * make style
      
      * Style fixes
      
      * Style fixes
      
      * Style fixes
      
      * Style fixes
      
      * Adding core tests to GPT2 and BART
      
      * Removing unused imports
      Co-authored-by: default avatarniklas.fruehauf <niklas.fruehauf@sovanta.com>
      Co-authored-by: default avatarmatt <rocketknight1@gmail.com>
      1991da07
    • NielsRogge's avatar
      Improve semantic segmentation models (#14355) · a2864a50
      NielsRogge authored
      * Improve tests
      
      * Improve documentation
      
      * Add ignore_index attribute
      
      * Add semantic_ignore_index to BEiT model
      
      * Add segmentation maps argument to BEiTFeatureExtractor
      
      * Simplify SegformerFeatureExtractor and corresponding tests
      
      * Improve tests
      
      * Apply suggestions from code review
      
      * Minor docs improvements
      
      * Streamline segmentation map tests of SegFormer and BEiT
      
      * Improve reduce_labels docs and test
      
      * Fix code quality
      
      * Fix code quality again
      a2864a50
    • Patrick von Platen's avatar
      [Wav2Vec2] Add New Wav2Vec2 Translation (#14392) · 700a748f
      Patrick von Platen authored
      * add new wav2vec2 translation
      
      * correct
      
      * up
      
      * add tests
      
      * correct end copy
      
      * correct more
      
      * up
      
      * correct unispeech sat
      
      * finish
      
      * finalize
      
      * finish
      
      * up
      700a748f
  4. 16 Nov, 2021 2 commits
    • Valentin's avatar
      Avoid looping when data exhausted (#14413) · a33168aa
      Valentin authored
      * stop training when a finite IterableDataset is exhausted
      
      when using an iterable dataset num_epochs is set to
      sys.maxsize to make sure all data is consumed
      likewise we want to set max_steps high enough
      but still stop when all data is consumed
      
      (cherry picked from commit 6f0e1d6363153da9051e93acffe1cbab3a3f3b12)
      
      * fix typo flase -> false
      
      * add test for stopping training on exhausted finite iterable dataset
      
      * remove redundant gradient_accumulation_steps
      
      * run make style
      
      reformat training_args docstring
      a33168aa
    • Sylvain Gugger's avatar
      Fix gradient_checkpointing backward compatibility (#14408) · 040fd471
      Sylvain Gugger authored
      
      
      * Fix gradient_checkpointing backward compatibility
      
      * Remove needless line
      
      * make sure mask prob is big enough and length small enough
      
      * Fix tests
      Co-authored-by: default avatarpatrickvonplaten <patrick.v.platen@gmail.com>
      040fd471
  5. 15 Nov, 2021 4 commits
  6. 13 Nov, 2021 1 commit
  7. 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
  8. 11 Nov, 2021 4 commits
  9. 10 Nov, 2021 2 commits
  10. 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
  11. 08 Nov, 2021 4 commits
  12. 06 Nov, 2021 2 commits
  13. 04 Nov, 2021 2 commits
  14. 03 Nov, 2021 4 commits