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

batched inference #214

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

Conversation

varshith15
Copy link
Contributor

@varshith15 varshith15 commented Sep 10, 2024

Original PR: #108

It was built on top of older code, needs a lot of refactoring refactored now
currently on pause - need to think broadly for distributed training on exo

@AlexCheema
Copy link
Contributor

Does this work as expected? If you look at mlx_parallm, they use a BatchedKVCache implementation to handle the kv cache for batches https://github.com/willccbb/mlx_parallm/blob/80b18ab49b80e6f8d82d89347ab32f44b35f8942/mlx_parallm/utils.py#L201

I'm not sure how it would work with the current implementation. It looks like one cache is used for all the requests which is probably not want we want here.

@varshith15
Copy link
Contributor Author

varshith15 commented Sep 25, 2024

@AlexCheema https://github.com/willccbb/mlx_parallm/blob/80b18ab49b80e6f8d82d89347ab32f44b35f8942/mlx_parallm/utils.py#L201 is exactly the same as what I did, it's just that it stores batch_size as a variable, i just infer it from the input shape

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.

2 participants