1. 01 Jul, 2021 2 commits
  2. 30 Jun, 2021 3 commits
    • Patrick von Platen's avatar
      [Flax] Add wav2vec2 (#12271) · 0d1f67e6
      Patrick von Platen authored
      
      
      * fix_torch_device_generate_test
      
      * remove @
      
      * start flax wav2vec2
      
      * save intermediate
      
      * forward pass has correct shape
      
      * add weight norm
      
      * add files
      
      * finish ctc
      
      * make style
      
      * finish gumbel quantizer
      
      * correct docstrings
      
      * correct some more files
      
      * fix vit
      
      * finish quality
      
      * correct tests
      
      * correct docstring
      
      * correct tests
      
      * start wav2vec2 pretraining script
      
      * save intermediate
      
      * start pretraining script
      
      * finalize pretraining script
      
      * finish
      
      * finish
      
      * small typo
      
      * finish
      
      * correct
      
      * Apply suggestions from code review
      Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>
      Co-authored-by: default avatarSuraj Patil <surajp815@gmail.com>
      
      * make style
      
      * push
      Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>
      Co-authored-by: default avatarSuraj Patil <surajp815@gmail.com>
      0d1f67e6
    • NielsRogge's avatar
      Add CANINE (#12024) · 6e685978
      NielsRogge authored
      
      
      * First pass
      
      * More progress
      
      * Add support for local attention
      
      * More improvements
      
      * More improvements
      
      * Conversion script working
      
      * Add CanineTokenizer
      
      * Make style & quality
      
      * First draft of integration test
      
      * Remove decoder test
      
      * Improve tests
      
      * Add documentation
      
      * Mostly docs improvements
      
      * Add CanineTokenizer tests
      
      * Fix most tests on GPU, improve upsampling projection
      
      * Address most comments by @dhgarrette
      
      * Remove decoder logic
      
      * Improve Canine tests, improve docs of CanineConfig
      
      * All tokenizer tests passing
      
      * Make fix-copies and fix tokenizer tests
      
      * Fix test_model_outputs_equivalence test
      
      * Apply suggestions from @sgugger's review
      Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>
      
      * Address some more comments
      
      * Add support for hidden_states and attentions of shallow encoders
      
      * Define custom CanineModelOutputWithPooling, tests pass
      
      * First pass
      
      * More progress
      
      * Add support for local attention
      
      * More improvements
      
      * More improvements
      
      * Conversion script working
      
      * Add CanineTokenizer
      
      * Make style & quality
      
      * First draft of integration test
      
      * Remove decoder test
      
      * Improve tests
      
      * Add documentation
      
      * Mostly docs improvements
      
      * Add CanineTokenizer tests
      
      * Fix most tests on GPU, improve upsampling projection
      
      * Address most comments by @dhgarrette
      
      * Remove decoder logic
      
      * Improve Canine tests, improve docs of CanineConfig
      
      * All tokenizer tests passing
      
      * Make fix-copies and fix tokenizer tests
      
      * Fix test_model_outputs_equivalence test
      
      * Apply suggestions from @sgugger's review
      Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>
      
      * Address some more comments
      
      * Make conversion script work for Canine-c too
      
      * Fix tokenizer tests
      
      * Remove file
      Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>
      6e685978
    • Sylvain Gugger's avatar
      Fix default bool in argparser (#12424) · c9486fd0
      Sylvain Gugger authored
      * Fix default bool in argparser
      
      * Add more to test
      c9486fd0
  3. 29 Jun, 2021 4 commits
  4. 28 Jun, 2021 1 commit
  5. 25 Jun, 2021 1 commit
  6. 24 Jun, 2021 1 commit
  7. 23 Jun, 2021 6 commits
    • Michael Benayoun's avatar
    • Lysandre's avatar
      941b4442
    • Sylvain Gugger's avatar
      Clean push to hub API (#12187) · 53c60bab
      Sylvain Gugger authored
      
      
      * Clean push to hub API
      
      * Create working dir if it does not exist
      
      * Different tweak
      
      * New API + all models + test Flax
      
      * Adds the Trainer clean up
      
      * Update src/transformers/file_utils.py
      Co-authored-by: default avatarLysandre Debut <lysandre@huggingface.co>
      
      * Address review comments
      
      * (nit) output types
      
      * No need to set clone_from when folder exists
      
      * Update src/transformers/trainer.py
      Co-authored-by: default avatarJulien Chaumond <julien@huggingface.co>
      
      * Add generated_from_trainer tag
      
      * Update to new version
      
      * Fixes
      Co-authored-by: default avatarLysandre Debut <lysandre@huggingface.co>
      Co-authored-by: default avatarJulien Chaumond <julien@huggingface.co>
      Co-authored-by: default avatarLysandre <lysandre.debut@reseau.eseo.fr>
      53c60bab
    • Vasudev Gupta's avatar
      Flax T5 (#12150) · e98233dd
      Vasudev Gupta authored
      
      
      * copy pytorch-t5
      
      * init
      
      * boom boom
      
      * forward pass same
      
      * make generation work
      
      * add more tests
      
      * make test work
      
      * finish normal tests
      
      * make fix-copies
      
      * finish quality
      
      * correct slow example
      
      * correct slow test
      
      * version table
      
      * upload models
      
      * Update tests/test_modeling_flax_t5.py
      
      * correct incorrectly deleted line
      Co-authored-by: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
      Co-authored-by: default avatarPatrick von Platen <patrick@huggingface.co>
      e98233dd
    • Daniel Stancl's avatar
      Add output in a dictionary for TF `generate` method (#12139) · 26a2e365
      Daniel Stancl authored
      * Add output args to greedy search
      
      * Fix critical typo + make style quality
      
      * Handle generate_beam_search
      
      * Add dict_specific tests and fix the placement of encoder outputs
      
      * Add  specific outputs
      
      * Update doc
      
      * Fix typo
      
      * Adjust handling encoder_outputs + Fix generating for T5
      
      * Fix generate for RAG
      
      * Fix handling ouptut_attentions when target_mapping is not None
      
      Take care of situations when target_mapping is provided
      as there are 2-tuple of attentions
      
      Change from:
      if inputs["output_attentions"]:
          attentions = tuple(tf.transpose(t, perm(2, 3, 0, 1)) for t in attentions)
      
      to:
      if inputs["output_attentions"]:
          if inputs["target_mapping"] is not None:
              # when target_mapping is provided, there are 2-tuple of attentions
               attentions = tuple(
                   tuple(tf.transpose(attn_stream, perm=(2, 3, 0, 1)) for attn_stream in t) for t in attentions
              )
          else:
              attentions = tuple(tf.transpose(t, perm=(2, 3, 0, 1)) for t in attentions)
      
      * Rename kwargs to model_kwargs
      
      * make style quality
      
      * Move imports in test_modeling_tf_common.py
      
      Move ModelOutput-related imports in test_modeling_tf_common.py
      into the `is_tf_available():` statement.
      
      * Rewrite nested if-statements
      
      * Fix added tests
      26a2e365
    • Nicolas Patry's avatar
      Optimizing away the `fill-mask` pipeline. (#12113) · d4be4984
      Nicolas Patry authored
      
      
      * Optimizing away the `fill-mask` pipeline.
      
      - Don't send anything to the tokenizer unless needed. Vocab check is
      much faster
      - Keep BC by sending data to the tokenizer when needed. User handling warning messages will see performance benefits again
      - Make `targets` and `top_k` work together better `top_k` cannot be
      higher than `len(targets)` but can be smaller still.
      - Actually simplify the `target_ids` in case of duplicate (it can happen
      because we're parsing raw strings)
      - Removed useless code to fail on empty strings. It works only if empty
      string is in first position, moved to ignoring them instead.
      - Changed the related tests as only the tests would fail correctly
      (having incorrect value in first position)
      
      * Make tests compatible for 2 different vocabs... (at the price of a
      warning).
      
      Co-authored-by: @EtaoinWu
      
      * ValueError working globally
      
      * Update src/transformers/pipelines/fill_mask.py
      Co-authored-by: default avatarLysandre Debut <lysandre@huggingface.co>
      
      * `tokenizer.vocab` -> `tokenizer.get_vocab()` for more compatiblity +
      fallback.
      Co-authored-by: default avatarLysandre Debut <lysandre@huggingface.co>
      d4be4984
  8. 22 Jun, 2021 3 commits
  9. 21 Jun, 2021 4 commits
  10. 17 Jun, 2021 2 commits
  11. 16 Jun, 2021 2 commits
  12. 15 Jun, 2021 2 commits
  13. 14 Jun, 2021 8 commits
    • Stas Bekman's avatar
      [style] consistent nn. and nn.functional: part 3 `tests` (#12155) · 372ab9cd
      Stas Bekman authored
      * consistent nn. and nn.functional: p3 templates
      
      * restore
      372ab9cd
    • Vasudev Gupta's avatar
      Flax Big Bird (#11967) · d9c0d08f
      Vasudev Gupta authored
      
      
      * add flax bert
      
      * bert -> bigbird
      
      * original_full ported
      
      * add debugger
      
      * init block sparse
      
      * fix copies ; gelu_fast -> gelu_new
      
      * block sparse port
      
      * fix block sparse
      
      * block sparse working
      
      * all ckpts working
      
      * fix-copies
      
      * make quality
      
      * init tests
      
      * temporary fix for FlaxBigBirdForMultipleChoice
      
      * skip test_attention_outputs
      
      * fix
      
      * gelu_fast -> gelu_new ; fix multiple choice model
      
      * remove nsp
      
      * fix sequence classifier
      
      * fix
      
      * make quality
      
      * make fix-copies
      
      * finish
      
      * Delete debugger.ipynb
      
      * Update src/transformers/models/big_bird/modeling_flax_big_bird.py
      
      * make style
      
      * finish
      
      * bye bye jit flax tests
      Co-authored-by: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
      d9c0d08f
    • Patrick von Platen's avatar
      [Flax] Fix flax pt equivalence tests (#12154) · 007be9e4
      Patrick von Platen authored
      * fix_torch_device_generate_test
      
      * remove @
      
      * upload
      007be9e4
    • Will Rice's avatar
      Adding TFWav2Vec2Model (#11617) · d438eee0
      Will Rice authored
      
      
      * [WIP] Add TFWav2Vec2Model
      
      Work in progress for adding a tensorflow version of Wav2Vec2
      
      * feedback changes
      
      * small fix
      
      * Test Feedback Round 1
      
      * Add SpecAugment and CTC Loss
      
      * correct spec augment mask creation
      
      * docstring and correct copyright
      
      * correct bugs
      
      * remove bogus file
      
      * finish tests correction
      
      * del unnecessary layers
      
      * Update src/transformers/models/wav2vec2/modeling_tf_wav2vec2.py
      Co-authored-by: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
      
      * make style
      
      * correct final bug
      
      * Feedback Changes
      Co-authored-by: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
      d438eee0
    • Stas Bekman's avatar
      [optim] implement AdafactorSchedule (#12123) · ff7c8168
      Stas Bekman authored
      
      
      * implement AdafactorSchedule
      
      * typo
      
      * fix
      
      * Update src/transformers/optimization.py
      Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>
      Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>
      ff7c8168
    • SaulLu's avatar
      Feature to use the PreTrainedTokenizerFast class as a stand-alone tokenizer (#11810) · 476ba679
      SaulLu authored
      
      
      * feature for tokenizer without slow/legacy version
      
      * format
      
      * modify common test
      
      * add tests
      
      * add PreTrainedTokenizerFast to AutoTokenizer
      
      * format
      
      * change tokenizer common test in order to be able to run test without a slow version
      
      * update tokenizer fast test in order to use `rust_tokenizer_class` attribute instead of `tokenizer_class`
      
      * add autokenizer test
      
      * replace  `if self.tokenizer_class is not None` with ` if self.tokenizer_class is None`
      
      * remove obsolete change in comment
      
      * Update src/transformers/tokenization_utils_base.py
      Co-authored-by: default avatarLysandre Debut <lysandre@huggingface.co>
      
      * Update src/transformers/tokenization_utils_fast.py
      Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>
      
      * change `get_main_tokenizer` into `get_tokenizers`
      
      * clarify `get_tokenizers` method
      
      * homogenize with `test_slow_tokenizer` and `test_rust_tokenizer`
      
      * add `test_rust_tokenizer = False` to tokenizer which don't define a fast version
      
      * `test_rust_tokenizer = False` for BertJapaneseTokenizer
      
      * `test_rust_tokenizer = False` for BertJapaneseCharacterTokenizationTest
      Co-authored-by: default avatarLysandre Debut <lysandre@huggingface.co>
      Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>
      476ba679
    • Daniel Stancl's avatar
      FlaxBart (#11537) · 4a51b1dd
      Daniel Stancl authored
      
      
      * Start working on FlaxBart
      
      * Create modeling_flax_bart.py
      
      * Write FlaxBartAttention
      
      * Add FlaxBartEncoderLayer
      
      * Add FlaxBartDecoderLayer and some typing
      
      * Add helepr function for FlaxBart
      
      * shift_tokens_right
      
      * _make_causal_mask
      
      * _expand_mask
      
      * Add PositionalEmbedding and fix init_std naming
      
      * Add FlaxBartPretrainedModel
      
      * Add FlaxBartEncoder
      
      * Add FlaxBartEncoder
      
      * Add FlaxBartEncoder among modules to be imported
      
      * YET WE CANNOT INITIALIZE THAT!! :(
      
      * Make BartEncoder working
      
      Change BartEncoder to instance of nn.Module so far
      
      * Add FlaxBartDecoder
      
      * Add FlaxBartModel
      
      * TODO to make model run -> Prepapre model inputs
      
      * Resolve padding
      
      * Add FlaxBartModel
      
      * Add FlaxBartModel into importable modules
      
      * Remove FlaxBartEncoder and FlaxBartDecoder from importable modules
      
      * make style; not properly working
      
      * make style; make quality not pass due to some import I left
      
      * Remove TODO for padding_idx in nn.Embed so far
      
      * Add FlaxBartForConditionalGeneration
      
      * Incorporate Flax model output classes, i.e. return_dict
      
      * Add another models and incorporate use_cache arg
      
      * Add FlaxBartForSequenceClassification and FlaxBartForQuestionAnswering
      
      * Incorporate use_cache arg from PyTorch implementation
      
      * Add all necessary Flax output utils
      
      * Add FlaxBartForCausalLM; not working yet'
      
      * Add minor improvements; still lacks some functionality
      
      * Update docs, src and tests
      
      * Add support of FlaxBart to docs/source
      
      * Fix some bugs in FlaxBart souce code
      
      * Add some neccessary tests for FlaxBart models - jit_compilation not passing
      
      * Fix tests and add test_head_masking
      
      * Fix tests for @jax.jit computation
      
      * Add test_head_masking
      
      * Migrate FlaxBart tests from jax.numpy to numpy
      
      * Remove FlaxBartForCausalLM
      
      * Clean repo
      
      * fix bart model weight structure
      
      * Fix FlaxBartForSequenceClassification
      
      Slicing is not possible to use below jit, therefore, selecting sentence
      representation from hidden_states must be changed.
      
      * Allow FlaxBartForSequenceClassification for testing pt_flax equivalence
      
      * Allow testing for FlaxBartForQA for pt_flax equivalence
      
      * Add a comment to FlaxBartForSequenceClassification + change noise from 1e-3 to 1e-6
      
      * remove past_key_values
      
      * remove inputs_mebeds and make input_ids required
      
      * add position ids
      
      * re-write attention layer
      
      * fix dataclass
      
      * fix pos embeds and attention output
      
      * fix pos embeds
      
      * expose encode method
      
      * expose decode method
      
      * move docstring to top
      
      * add cache for causal attn layer
      
      * remove head masking for now
      
      * s2s greedy search first pass
      
      * boom boom
      
      * fix typos
      
      * fix greedy generate for bart
      
      * use encoder, decoder layers instead of num_hidden_layers
      
      * handle encoder_outputs
      
      * cleanup
      
      * simplify decoding
      
      * more clean-up
      
      * typos
      
      * Change header + add {decoder_,}position_ids into 2 models
      
      * add BartConfig
      
      * fix existing tests
      
      * add encode, decode methods
      
      * Fix shift_tokens_right for JIT compilation + clarify one condition
      
      * fix decode
      
      * encoder => encode
      
      * simplify generate
      
      * add tests for encode and decode
      
      * style
      
      * add tests for cache
      
      * fix equivalence tests
      
      * sample generate now works with seq2seq
      
      * generation tests
      
      * initialize dense layers
      
      * docstring and cleanup
      
      * quality
      
      * remove get/set input_embeddings
      
      * address Patricks suggestions
      
      * decode for every model, remove encoder_outputs from call
      
      * update tests accordingly
      
      * decode returns only decoder outputs and logits
      
      * fix arguments
      
      * doc encode, decode methods
      
      * correct base_model_prefix
      
      * fix test for seq classif model
      
      * fix docs
      Co-authored-by: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
      Co-authored-by: default avatarSuraj Patil <surajp815@gmail.com>
      4a51b1dd
    • Guido Novati's avatar
      Fix megatron_gpt2 attention block's causal mask (#12007) · ecd6efe7
      Guido Novati authored
      
      
      * Fix megatron_gpt2 attention block's causal mask.
      
      * compatibility with checkpoints created with recent versions of Megatron-LM
      
      * added integration test for the released Megatron-GPT2 model
      
      * code style changes
      
      * added option to megatron conversion script to read from config file
      Co-authored-by: default avatarGuido Novati <gnovati@nvidia.com>
      ecd6efe7
  14. 11 Jun, 2021 1 commit