ml-explore / mlx-examples

Examples in the MLX framework
MIT License
6.29k stars 897 forks source link

[MLX LM] Sampler refactor + a few improvements #1094

Closed awni closed 3 weeks ago

awni commented 3 weeks ago

This is part 1 of a potential second part diff to refactor samplers and logits processors outside of the generate_step function. The idea being that function is getting too fat.. and it will also be much more flexible to experiment with alternative samplers / logits processors without hacking generate_step.

To start this diff:

awni commented 3 weeks ago

I have some questions that you may or may not have opinions on. Mostly for a follow up PR:

At any rate.. I'll probably put together a PR for some of that soon and we can discuss more concretely. But that's kind of where this is heading in case you have early thoughts on it.