1. 01 Apr, 2024 1 commit
  2. 27 Mar, 2024 1 commit
  3. 26 Mar, 2024 1 commit
  4. 21 Mar, 2024 1 commit
  5. 19 Mar, 2024 1 commit
  6. 08 Mar, 2024 2 commits
  7. 07 Mar, 2024 1 commit
  8. 06 Mar, 2024 1 commit
  9. 27 Feb, 2024 1 commit
  10. 26 Feb, 2024 1 commit
  11. 20 Feb, 2024 1 commit
  12. 19 Feb, 2024 1 commit
    • Max Baak's avatar
      ENH: added new output_logits option to generate function (#28667) · 08cd694e
      Max Baak authored
      output_logits option behaves like output_scores, but returns the raw, unprocessed prediction logit scores,
      ie. the values before they undergo logit processing and/or warping. The latter happens by default for the
      regular output scores.
      
      It's useful to have the unprocessed logit scores in certain circumstances. For example, unprocessed logit scores
      are very useful with causallm models when one wants to determine the probability of a certain answer, e.g.
      when asking a question with a yes/no answer. In that case getting the next-token probabilities of both "yes" and
      "no" (and/or their relative ratio) is of interest for classification. The reason for getting these _before_ logit
      processing and/or warping is b/c a) that can change the probabilities or b) reject the tokens of interest / reduce
      the number of tokens to just 1.
      
      For an example use-case see paper TabLLM: Few-shot Classification of Tabular Data with Large Language Models
      by Stefan Hegselmann, Alejandro Buendia, Hunter Lang, Monica Agrawal, Xiaoyi Jiang, and David Sontag.
      https://arxiv.org/abs/2210.10723
      
      
      
      In addition:
      - added dedicated unit test: tests/generation/test_utils/test_return_unprocessed_logit_scores
        which tests return of logics with output_logits=True in generation.
      - set output_logits=True in all other generation unit tests, that also have output_scores=True.
      
      Implemented @gante's and @amyeroberts review feedback
      Co-authored-by: default avatarkx79wq <max.baak@ing.com>
      08cd694e
  13. 16 Feb, 2024 3 commits
  14. 08 Feb, 2024 1 commit
  15. 30 Jan, 2024 1 commit
    • Matt's avatar
      Add tf_keras imports to prepare for Keras 3 (#28588) · 415e9a09
      Matt authored
      * Port core files + ESM (because ESM code is odd)
      
      * Search-replace in modelling code
      
      * Fix up transfo_xl as well
      
      * Fix other core files + tests (still need to add correct import to tests)
      
      * Fix cookiecutter
      
      * make fixup, fix imports in some more core files
      
      * Auto-add imports to tests
      
      * Cleanup, add imports to sagemaker tests
      
      * Use correct exception for importing tf_keras
      
      * Fixes in modeling_tf_utils
      
      * make fixup
      
      * Correct version parsing code
      
      * Ensure the pipeline tests correctly revert to float32 after each test
      
      * Ensure the pipeline tests correctly revert to float32 after each test
      
      * More tf.keras -> keras
      
      * Add dtype cast
      
      * Better imports of tf_keras
      
      * Add a cast for tf.assign, just in case
      
      * Fix callback imports
      415e9a09
  16. 29 Jan, 2024 1 commit
  17. 19 Jan, 2024 2 commits
  18. 16 Jan, 2024 1 commit
  19. 15 Jan, 2024 1 commit
  20. 13 Jan, 2024 1 commit
  21. 12 Jan, 2024 1 commit
  22. 10 Jan, 2024 1 commit
  23. 14 Dec, 2023 1 commit
  24. 08 Dec, 2023 3 commits
    • Xin Qiu's avatar
      Fix remaining issues in beam score calculation (#27808) · b31905d1
      Xin Qiu authored
      * Fix issues in add and is_done for BeamHypotheses
      
      * make newly added arguments optional for better compatibility
      
      * Directly use cur_len as generated_len, add note for retrocompatibility
      
      * update test expectation
      
      * make cur_len represents the length of the entire sequence including the decoder prompt
      
      * remove redundant if/else in testing
      b31905d1
    • Saibo-creator's avatar
      Fix: Raise informative exception when `prefix_allowed_tokens_fn` return empty... · 56be5e80
      Saibo-creator authored
      
      Fix: Raise informative exception when `prefix_allowed_tokens_fn` return empty set of tokens (#27797)
      Co-authored-by: default avatarArthur <48595927+ArthurZucker@users.noreply.github.com>
      56be5e80
    • Tom Aarsen's avatar
      Generate: New `Cache` abstraction and Attention Sinks support (#26681) · 633215ba
      Tom Aarsen authored
      * Draft version of new KV Caching
      
      This should allow Attention Sinks (https://github.com/tomaarsen/attention_sinks)
      / StreamingLLM (https://arxiv.org/abs/2309.17453) to be easily implemented
      in a third-party or in transformers directly
      
      * Address numerous PR suggestions
      
      1. Move layer_idx from cache to ...Attention. Removes confusing set_layer_idx magic.
      2. Always convert past_key_values to Cache instance at the start of ...Attention, removes all other isinstance calls.
      3. Remove __bool__ and __getitem__ magic as they're confusing.
      4. past_key_values.update(key, value, idx) now returns key, value.
      5. Add use_legacy_cache flag, defaults to None, i.e. Falsey. This breaks generate for now, until 1) the cache is used is generate() or 2) use_legacy_cache is defaulted to True in generate() until we change it in another PR.
      6. Separate key_cache and value_cache.
      
      Some work is still needed to see if the SinkCache can conveniently be implemented with just one update method.
      
      * Implement the SinkCache through backward+forward rotations
      
      * Integrate (Sink)Cache with Llama FA2
      
      * Set use_legacy_cache=True as default, allows for test passes
      
      * Move from/to_legacy_cache to ...Model class
      
      * Undo unnecessary newline change
      
      * Remove copy utility from deprecated OpenLlama
      
      * Match import style
      
      * manual rebase with main
      
      * Cache class working with generate (#1)
      
      * Draft version of new KV Caching
      
      This should allow Attention Sinks (https://github.com/tomaarsen/attention_sinks)
      / StreamingLLM (https://arxiv.org/abs/2309.17453
      
      ) to be easily implemented
      in a third-party or in transformers directly
      
      * Address numerous PR suggestions
      
      1. Move layer_idx from cache to ...Attention. Removes confusing set_layer_idx magic.
      2. Always convert past_key_values to Cache instance at the start of ...Attention, removes all other isinstance calls.
      3. Remove __bool__ and __getitem__ magic as they're confusing.
      4. past_key_values.update(key, value, idx) now returns key, value.
      5. Add use_legacy_cache flag, defaults to None, i.e. Falsey. This breaks generate for now, until 1) the cache is used is generate() or 2) use_legacy_cache is defaulted to True in generate() until we change it in another PR.
      6. Separate key_cache and value_cache.
      
      Some work is still needed to see if the SinkCache can conveniently be implemented with just one update method.
      
      * Integrate (Sink)Cache with Llama FA2
      
      * Move from/to_legacy_cache to ...Model class
      
      * Undo unnecessary newline change
      
      * Match import style
      
      * working generate
      
      * Add tests; Simplify code; Apply changes to Mistral and Persimmon
      
      * fix rebase mess
      
      * a few more manual fixes
      
      * last manual fix
      
      * propagate changes to phi
      
      * upgrade test
      
      * add use_legacy_cache docstring; beef up tests
      
      * reintroduce unwanted deletes
      
      ---------
      Co-authored-by: default avatarTom Aarsen <Cubiegamedev@gmail.com>
      
      * move import
      
      * add default to model_kwargs.get('use_legacy_cache')
      
      * correct failing test
      
      * Apply suggestions from code review
      Co-authored-by: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
      
      * apply PR suggestions
      
      * fix failing test
      
      * Apply suggestions from code review
      Co-authored-by: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
      Co-authored-by: default avatarTom Aarsen <37621491+tomaarsen@users.noreply.github.com>
      
      * PR comments
      
      * tmp commit
      
      * add docstrings
      
      * more tests, more docstrings, add to docs
      
      * derp
      
      * tmp commit
      
      * tmp dbg
      
      * more dbg
      
      * fix beam search bug
      
      * cache can be a list of tuples in some models
      
      * fix group beam search
      
      * all but sinkcache integration tests
      
      * fix sink cache and add hard integration test
      
      * now also compatible with input_embeds input
      
      * PR comments
      
      * add Cache support to Phi+FA2
      
      * make fixup
      
      ---------
      Co-authored-by: default avatarJoao Gante <joao@huggingface.co>
      Co-authored-by: default avatarJoao Gante <joaofranciscocardosogante@gmail.com>
      Co-authored-by: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
      633215ba
  25. 30 Nov, 2023 1 commit
  26. 24 Nov, 2023 1 commit
  27. 17 Nov, 2023 1 commit
  28. 16 Nov, 2023 1 commit
  29. 15 Nov, 2023 2 commits
  30. 07 Nov, 2023 1 commit
  31. 02 Nov, 2023 1 commit
  32. 01 Nov, 2023 1 commit
  33. 31 Oct, 2023 1 commit
    • Hz, Ji's avatar
      device agnostic models testing (#27146) · 50378cbf
      Hz, Ji authored
      * device agnostic models testing
      
      * add decorator `require_torch_fp16`
      
      * make style
      
      * apply review suggestion
      
      * Oops, the fp16 decorator was misused
      50378cbf