Generate: remove deprecated code due to Cache and cache_position being default (#31898)

* tmp commit

* shorter

* nit

* explicit kwargs

* propagate changes

* mass propagation with a few manual touches (let's see how CI behaves)

* fix cacheless case

* Update src/transformers/generation/utils.py

Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>

* make fixup

---------

Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>
This commit is contained in:
Joao Gante
2024-07-14 15:16:58 +01:00
committed by GitHub
parent 8480fda6ee
commit 739a63166d
23 changed files with 213 additions and 966 deletions

View File

@@ -35,8 +35,8 @@ if is_torch_available():
AutoModelForCausalLM,
AutoTokenizer,
DynamicCache,
GPT2LMHeadModel,
LlamaConfig,
LlamaForCausalLM,
SinkCache,
StaticCache,
)
@@ -94,7 +94,7 @@ class CacheTest(unittest.TestCase):
def test_reorder_cache_retrocompatibility(self):
"""Tests that Cache.reorder_cache is retrocompatible with the legacy code path"""
legacy_reorder_fn = LlamaForCausalLM._reorder_cache # An example of a legacy `_reorder_cache` function
legacy_reorder_fn = GPT2LMHeadModel._reorder_cache # An example of a legacy `_reorder_cache` function
legacy_cache = ()
new_cache = DynamicCache()