[Mistral][SWA] Add Mistral sliding window support #208
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for Mistral. The implementation follows the Mistral paper, specifically including sliding window attention (SWA), rolling buffer cache, and chunking, as discussed in Section 2 in the paper.
This PR is largely analogous to the changes in
llm_chat.cc
in mlc-llm's PR mlc-ai/mlc-llm#1087.Different from the approaches in #202, this PR's implementation takes advantage of SWA, so that there is no max window size anymore--one of the main benefits of Mistral.
Tested:
Irrelevantly, we also make wizard models reuse llama model libraries given the dynamic vocab size support (updated just now due to shuffle support).
cc @tqchen