Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX Failing Llama tests due to new kv cache #1832

Merged

Conversation

BenjaminBossan
Copy link
Member

Requires to install transformers from source (so normal CI won't pick this up).

To replicate, run these tests:

pytest tests/test_multitask_prompt_tuning.py
pytest tests/test_decoder_models.py -k
"test_trl_internal_testing_tiny_random_LlamaForCausalLM and (prefix or prompt) and (generate or disable)"

This should result in 17 failing tests.

The issue is that past_key_values can now be an instance of DynamicCache. Therefore, just indexing into it won't work anymore. The solution is to check the type and if it's not a tuple, use the methods on the cache object instead.

Requires to install transformers from source (so normal CI won't pick
this up).

To replicate, run these tests:

pytest tests/test_multitask_prompt_tuning.py
pytest tests/test_decoder_models.py -k
"test_trl_internal_testing_tiny_random_LlamaForCausalLM and (prefix or
prompt) and (generate or disable)"

This should result in 17 failing tests.

The issue is that past_key_values can now be an instance of
DynamicCache. Therefore, just indexing into it won't work anymore. The
solution is to check the type and if it's not a tuple, use the methods
on the cache object instead.
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Contributor

@younesbelkada younesbelkada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for fixing !
Importing Cache class from transformers.cache_utils might make our code bloated since that object exists only on newer transformers versions. This solution looks great

@BenjaminBossan BenjaminBossan marked this pull request as ready for review June 6, 2024 13:47
@BenjaminBossan BenjaminBossan changed the title [WIP] FIX Failing Llama tests due to new kv cache FIX Failing Llama tests due to new kv cache Jun 6, 2024
@BenjaminBossan BenjaminBossan merged commit 03798a9 into huggingface:main Jun 6, 2024
14 checks passed
@BenjaminBossan BenjaminBossan deleted the fix-llama-tests-kv-cache branch June 6, 2024 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants