ml-explore / mlx-swift

Swift API for MLX
https://ml-explore.github.io/mlx-swift/
MIT License
663 stars 53 forks source link

Crash when quitting during generation #143

Closed DePasqualeOrg closed 1 month ago

DePasqualeOrg commented 1 month ago

@davidkoski menioned this in https://github.com/ml-explore/mlx-swift/issues/139, and I encountered it today: Quitting the app while generating text will result in a crash. You can easily reproduce this with LLMEval from mlx-swift-examples.

Screenshot 2024-10-05 at 13 28 32 Screenshot 2024-10-05 at 13 29 06

davidkoski commented 1 month ago

This is a tricky one -- you need to make sure there is no eval activity going on when you exit, including asyncEval. I think this means something like: