1. 02 Dec, 2020 5 commits
    • Patrick von Platen's avatar
      [PyTorch] Refactor Resize Token Embeddings (#8880) · 443f67e8
      Patrick von Platen authored
      * fix resize tokens
      
      * correct mobile_bert
      
      * move embedding fix into modeling_utils.py
      
      * refactor
      
      * fix lm head resize
      
      * refactor
      
      * break lines to make sylvain happy
      
      * add news tests
      
      * fix typo
      
      * improve test
      
      * skip bart-like for now
      
      * check if base_model = get(...) is necessary
      
      * clean files
      
      * improve test
      
      * fix tests
      
      * revert style templates
      
      * Update templates/adding_a_new_model/cookiecutter-template-{{cookiecutter.modelname}}/modeling_{{cookiecutter.lowercase_modelname}}.py
      443f67e8
    • ryota-mo's avatar
      Fix typo in docstring (#8905) · 801b2cb3
      ryota-mo authored
      801b2cb3
    • Stas Bekman's avatar
      [trainer] improve code readability (#8903) · 7e1cb00c
      Stas Bekman authored
      * [trainer] improve code
      
      This PR:
      - removes redundant code 
      ```
      self.model = model if model is not None else None
      ```
      and
      ```
      self.model = model
      ```
      are the same.
      
      * separate attribute assignment from code logic - which simplifies things further.
      
      * whitespace
      7e1cb00c
    • Nicolas Patry's avatar
      Warning about too long input for fast tokenizers too (#8799) · a8c3f9aa
      Nicolas Patry authored
      * Warning about too long input for fast tokenizers too
      
      If truncation is not set in tokenizers, but the tokenization is too long
      for the model (`model_max_length`), we used to trigger a warning that
      
      The input would probably fail (which it most likely will).
      
      This PR re-enables the warning for fast tokenizers too and uses common
      code for the trigger to make sure it's consistent across.
      
      * Checking for pair of inputs too.
      
      * Making the function private and adding it's doc.
      
      * Remove formatting ?? in odd place.
      
      * Missed uppercase.
      a8c3f9aa
    • sandip's avatar
      Transfoxl seq classification (#8868) · f6b44e61
      sandip authored
      * Transfoxl sequence classification
      
      * Transfoxl sequence classification
      f6b44e61
  2. 01 Dec, 2020 8 commits
  3. 30 Nov, 2020 7 commits
    • Nicolas Patry's avatar
      NerPipeline (TokenClassification) now outputs offsets of words (#8781) · d8fc26e9
      Nicolas Patry authored
      * NerPipeline (TokenClassification) now outputs offsets of words
      
      - It happens that the offsets are missing, it forces the user to pattern
      match the "word" from his input, which is not always feasible.
      For instance if a sentence contains the same word twice, then there
      is no way to know which is which.
      - This PR proposes to fix that by outputting 2 new keys for this
      pipelines outputs, "start" and "end", which correspond to the string
      offsets of the word. That means that we should always have the
      invariant:
      
      ```python
      input[entity["start"]: entity["end"]] == entity["entity_group"]
                                          # or entity["entity"] if not grouped
      ```
      
      * Fixing doc style
      d8fc26e9
    • LysandreJik's avatar
      fix pypi complaint on version naming · 5fd3d81e
      LysandreJik authored
      5fd3d81e
    • LysandreJik's avatar
      Release: v4.0.0 · 22b0ff75
      LysandreJik authored
      22b0ff75
    • Sylvain Gugger's avatar
      Remove deprecated `evalutate_during_training` (#8852) · 55302990
      Sylvain Gugger authored
      
      
      * Remove deprecated `evalutate_during_training`
      
      * Update src/transformers/training_args_tf.py
      Co-authored-by: default avatarLysandre Debut <lysandre@huggingface.co>
      Co-authored-by: default avatarLysandre Debut <lysandre@huggingface.co>
      55302990
    • Shai Erera's avatar
      Use model.from_pretrained for DataParallel also (#8795) · 77384941
      Shai Erera authored
      * Use model.from_pretrained for DataParallel also
      
      When training on multiple GPUs, the code wraps a model with torch.nn.DataParallel. However if the model has custom from_pretrained logic, it does not get applied during load_best_model_at_end.
      
      This commit uses the underlying model during load_best_model_at_end, and re-wraps the loaded model with DataParallel.
      
      If you choose to reject this change, then could you please move the this logic to a function, e.g. def load_best_model_checkpoint(best_model_checkpoint) or something, so that it can be overridden?
      
      * Fix silly bug
      
      * Address review comments
      
      Thanks for the feedback. I made the change that you proposed, but I also think we should update L811 to check if `self.mode` is an instance of `PreTrained`, otherwise we would still not get into that `if` section, right?
      77384941
    • Fraser Greenlee's avatar
    • Ahmed Elnaggar's avatar
      Add T5 Encoder for Feature Extraction (#8717) · 40ecaf0c
      Ahmed Elnaggar authored
      
      
      * Add T5 Encoder class for feature extraction
      
      * fix T5 encoder add_start_docstrings indent
      
      * update init with T5 encoder
      
      * update init with TFT5ModelEncoder
      
      * remove TFT5ModelEncoder
      
      * change T5ModelEncoder order in init
      
      * add T5ModelEncoder to transformers init
      
      * clean T5ModelEncoder
      
      * update init with TFT5ModelEncoder
      
      * add TFModelEncoder for Tensorflow
      
      * update init with TFT5ModelEncoder
      
      * Update src/transformers/models/t5/modeling_t5.py
      
      change output from Seq2SeqModelOutput to BaseModelOutput
      Co-authored-by: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
      
      * remove encoder_outputs
      
      1. remove encoder_outputs from the function call.
      2. remove the encoder_outputs If statement.
      3. remove isinstance from return_dict.
      
      * Authorize missing decoder keys
      
      * remove unnecessary input parameters
      
      remove pask_key_values and use_cache
      
      * remove use_cache
      
      remove use_cache from the forward method
      
      * add doctoring for T5 encoder
      
      add doctoring for T5 encoder with T5_ENCODER_INPUTS_DOCSTRING
      
      * change return_dict to dot access
      
      * add T5_ENCODER_INPUTS_DOCSTRING for TF T5
      
      * change TFT5Encoder output type to BaseModelOutput
      
      * remove unnecessary parameters for TFT5Encoder
      
      * remove unnecessary if statement
      
      * add import BaseModelOutput
      
      * fix BaseModelOutput typo to TFBaseModelOutput
      
      * update T5 doc with T5ModelEncoder
      
      * add T5ModelEncoder to tests
      
      * finish pytorch
      
      * finish docs and mt5
      
      * add mtf to init
      
      * fix init
      
      * remove n_positions
      
      * finish PR
      
      * Update src/transformers/models/mt5/modeling_mt5.py
      Co-authored-by: default avatarLysandre Debut <lysandre@huggingface.co>
      
      * Update src/transformers/models/t5/modeling_t5.py
      Co-authored-by: default avatarLysandre Debut <lysandre@huggingface.co>
      
      * Update src/transformers/models/t5/modeling_tf_t5.py
      Co-authored-by: default avatarLysandre Debut <lysandre@huggingface.co>
      
      * Update src/transformers/models/mt5/modeling_tf_mt5.py
      Co-authored-by: default avatarLysandre Debut <lysandre@huggingface.co>
      
      * make style
      Co-authored-by: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
      Co-authored-by: default avatarLysandre Debut <lysandre@huggingface.co>
      40ecaf0c
  4. 29 Nov, 2020 2 commits
    • Guy Rosin's avatar
      Minor docs typo fixes (#8797) · 3a08cc1c
      Guy Rosin authored
      
      
      * Fix minor typos
      
      * Additional typos
      
      * Style fix
      Co-authored-by: default avatarguyrosin <guyrosin@assist-561.cs.technion.ac.il>
      3a08cc1c
    • Patrick von Platen's avatar
      [Pegasus] Refactor Tokenizer (#8731) · 5ced23dc
      Patrick von Platen authored
      * refactor
      
      * further refactor
      
      * fix the rest tomorrow
      
      * save intermediate
      
      * finish slow tokenizer
      
      * make more tests pass
      
      * finish refactor
      
      * fix comment
      
      * clean further
      
      * fix name
      
      * fix naming
      
      * Update src/transformers/models/reformer/tokenization_reformer.py
      
      * Apply suggestions from code review
      
      * Apply suggestions from code review
      
      * refactor
      
      * fix init tokenizers
      
      * refactor
      
      * improve convert
      
      * refactor
      
      * correct convert slow tokenizer
      
      * final fix for Pegasus Tok
      
      * remove ipdb
      
      * improve links
      5ced23dc
  5. 28 Nov, 2020 1 commit
  6. 27 Nov, 2020 5 commits
  7. 25 Nov, 2020 4 commits
  8. 24 Nov, 2020 5 commits
    • Julien Plu's avatar
      New TF model inputs (#8602) · 29d49924
      Julien Plu authored
      * Apply on BERT and ALBERT
      
      * Update TF Bart
      
      * Add input processing to TF BART
      
      * Add input processing for TF CTRL
      
      * Add input processing to TF Distilbert
      
      * Add input processing to TF DPR
      
      * Add input processing to TF Electra
      
      * Add input processing for TF Flaubert
      
      * Add deprecated arguments
      
      * Add input processing to TF XLM
      
      * remove unused imports
      
      * Add input processing to TF Funnel
      
      * Add input processing to TF GPT2
      
      * Add input processing to TF Longformer
      
      * Add input processing to TF Lxmert
      
      * Apply style
      
      * Add input processing to TF Mobilebert
      
      * Add input processing to TF GPT
      
      * Add input processing to TF Roberta
      
      * Add input processing to TF T5
      
      * Add input processing to TF TransfoXL
      
      * Apply style
      
      * Rebase on master
      
      * Bug fix
      
      * Retry to bugfix
      
      * Retry bug fix
      
      * Fix wrong model name
      
      * Try another fix
      
      * Fix BART
      
      * Fix input precessing
      
      * Apply style
      
      * Put the deprecated warnings in the input processing function
      
      * Remove the unused imports
      
      * Raise an error when len(kwargs)>0
      
      * test ModelOutput instead of TFBaseModelOutput
      
      * Bug fix
      
      * Address Patrick's comments
      
      * Address Patrick's comments
      
      * Address Sylvain's comments
      
      * Add the new inputs in new Longformer models
      
      * Update the template with the new input processing
      
      * Remove useless assert
      
      * Apply style
      
      * Trigger CI
      29d49924
    • Stas Bekman's avatar
      [core] implement support for run-time dependency version checking (#8645) · 82d443a7
      Stas Bekman authored
      
      
      * implement support for run-time dependency version checking
      
      * try not escaping !
      
      * use findall that works on py36
      
      * small tweaks
      
      * autoformatter worship
      
      * simplify
      
      * shorter names
      
      * add support for non-versioned checks
      
      * add deps
      
      * revert
      
      * tokenizers not required, check version only if installed
      
      * make a proper distutils cmd and add make target
      
      * tqdm must be checked before tokenizers
      
      * workaround the DistributionNotFound peculiar setup
      
      * handle the rest of packages in setup.py
      
      * fully sync setup.py's install_requires - to check them all
      
      * nit
      
      * make install_requires more readable
      
      * typo
      
      * Update setup.py
      Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>
      
      * restyle
      
      * add types
      
      * simplify
      
      * simplify2
      Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>
      82d443a7
    • Lysandre Debut's avatar
      MT5 should have an autotokenizer (#8743) · e09e54fd
      Lysandre Debut authored
      * MT5 should have an autotokenizer
      
      * Different configurations should be able to point to same tokenizers
      e09e54fd
    • zhiheng-huang's avatar
      Support various BERT relative position embeddings (2nd) (#8276) · 2c83b3c3
      zhiheng-huang authored
      
      
      * Support BERT relative position embeddings
      
      * Fix typo in README.md
      
      * Address review comment
      
      * Fix failing tests
      
      * [tiny] Fix style_doc.py check by adding an empty line to configuration_bert.py
      
      * make fix copies
      
      * fix configs of electra and albert and fix longformer
      
      * remove copy statement from longformer
      
      * fix albert
      
      * fix electra
      
      * Add bert variants forward tests for various position embeddings
      
      * [tiny] Fix style for test_modeling_bert.py
      
      * improve docstring
      
      * [tiny] improve docstring and remove unnecessary dependency
      
      * [tiny] Remove unused import
      
      * re-add to ALBERT
      
      * make embeddings work for ALBERT
      
      * add test for albert
      Co-authored-by: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
      2c83b3c3
    • Lysandre Debut's avatar
      Model parallel documentation (#8741) · 02f48b9b
      Lysandre Debut authored
      * Add parallelize methods to the .rst files
      
      * Correct format
      02f48b9b
  9. 23 Nov, 2020 3 commits
    • Colin Brochtrup's avatar
      Add early stopping callback to pytorch trainer (#8581) · 8ffc01a7
      Colin Brochtrup authored
      * Add early stopping patience and minimum threshold metric must improve to prevent early stopping to pytorch trainer
      
      * Add early stopping test
      
      * Set patience counter to 0 if best metric not defined yet
      
      * Make early stopping a callback. Add callback event for updating the best metric for early stopping callback to trigger on.
      
      * Run make style
      
      * make funciton name sensible
      
      * Improve new argument docstring wording and hope that flakey CI test passes.
      
      * Use on_evaluation callback instead of custom. Remove some debug printing
      
      * Move early stopping arguments and state into early stopping callback
      
      * Run make style
      
      * Remove old code
      
      * Fix docs formatting. make style went rogue on me.
      
      * Remove copied attributes and fix variable
      
      * Add assertions on training arguments instead of mutating them. Move comment out of public docs.
      
      * Make separate test for early stopping callback. Add test of invalid arguments.
      
      * Run make style... I remembered before CI this time!
      
      * appease flake8
      
      * Add EarlyStoppingCallback to callback docs
      
      * Make docstring EarlyStoppingCallabck match other callbacks.
      
      * Fix typo in docs
      8ffc01a7
    • Stas Bekman's avatar
      consistent ignore keys + make private (#8737) · e84786aa
      Stas Bekman authored
      * consistent ignore keys + make private
      
      * style
      
      * - authorized_missing_keys    => _keys_to_ignore_on_load_missing
        - authorized_unexpected_keys => _keys_to_ignore_on_load_unexpected
      
      * move public doc of private attributes to private comment
      e84786aa
    • Sylvain Gugger's avatar
      Document new training argument · 49759c0c
      Sylvain Gugger authored
      49759c0c