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

[Model builder] Add option to exclude cache in inputs and outputs #1162

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

xenova
Copy link

@xenova xenova commented Dec 22, 2024

In certain cases (e.g., single-round conversations), it is not necessary to require past_key_values as inputs and present outputs, like with https://huggingface.co/livekit/turn-detector (and its usage here).

So, this PR adds an option to exclude these inputs and outputs from the graph.

Example usage:

python builder.py -m livekit/turn-detector -o converted -e cpu -p fp32 --extra_options exclude_cache=True

Output graph signature:
image

For comparison, graph signature w/ cache IO:
image

@xenova
Copy link
Author

xenova commented Dec 22, 2024

@microsoft-github-policy-service agree [company="{Hugging Face}"]

@xenova
Copy link
Author

xenova commented Dec 22, 2024

@microsoft-github-policy-service agree company="Hugging Face"

@xenova
Copy link
Author

xenova commented Dec 22, 2024

This modification only works for models w/ GQA. Maybe someone with a bit more experience with the model builder could help get it working for models w/ MHA? 😇

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.

1 participant