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

Docs: add more cross-references to the KV cache docs #33323

Merged
merged 7 commits into from
Sep 6, 2024

Conversation

gante
Copy link
Member

@gante gante commented Sep 5, 2024

What does this PR do?

@zucchini-nlp wrote a great guide for our KV caches. This PR adds more cross-references to that guide in relevant places.

These references were added because:

  1. a docstring can't fully explain what a cache can be
  2. users have noticed that our cache classes are underdocumented/not easy to find (e.g. Static KV cache status: How to use it? Does it work for all models? #33270)

@@ -51,11 +51,11 @@ More concretely, key-value cache acts as a memory bank for these generative mode


See an example below for how to implement your own generation loop.

Copy link
Member Author

Choose a reason for hiding this comment

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

(my VSCode automatically removes any hanging space on save 🤗 )

Comment on lines +432 to +433
- a [`~cache_utils.Cache`] instance, see our
[kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache);
Copy link
Member Author

Choose a reason for hiding this comment

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

Update added to all models supporting Cache classes

Comment on lines -731 to -732
Two formats are allowed:
- a [`~cache_utils.Cache`] instance;
Copy link
Member Author

Choose a reason for hiding this comment

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

This is not true for TF models 👀

@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
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

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

Nice, very welcome cross-references. This looks exhaustive, LGTM

Copy link
Member

@zucchini-nlp zucchini-nlp left a comment

Choose a reason for hiding this comment

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

Thanks so much for adding this 💖

@gante gante merged commit 2b789f2 into huggingface:main Sep 6, 2024
23 checks passed
@gante gante deleted the kv_cache_docs branch September 6, 2024 09:22
zucchini-nlp pushed a commit to zucchini-nlp/transformers that referenced this pull request Sep 6, 2024
* add more cross-references

* nit

* import guard

* more import guards

* nit

* Update src/transformers/generation/configuration_utils.py
itazap pushed a commit to NielsRogge/transformers that referenced this pull request Sep 20, 2024
* add more cross-references

* nit

* import guard

* more import guards

* nit

* Update src/transformers/generation/configuration_utils.py
AlpinDale added a commit to AlpinDale/transformers that referenced this pull request Sep 26, 2024
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.

4 participants