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

Interruptible Async Model Loading With Progress Monitoring #702

Merged

Conversation

martindevans
Copy link
Member

  • Added LLamaWeights.LoadFromFileAsync.
  • Updated examples to use LoadFromFileAsync
  • Async loading supports cancellation through a CancellationToken:
    • If loading is cancelled an OperationCanceledException is thrown.
    • If it fails for another reason a LoadWeightsFailedException is thrown.

This does not expose the progress callback on the ModelParams object. However the code as written does support custom callbacks being set so that can be easily exposed in the future.

Resolve #699

 - Async loading supports cancellation through a `CancellationToken`. If loading is cancelled an `OperationCanceledException` is thrown.  If it fails for another reason a `LoadWeightsFailedException` is thrown.
 - Updated examples to use `LoadFromFileAsync`
Copy link
Collaborator

@AsakusaRinne AsakusaRinne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! You are the flash!

LLama/Native/LLamaModelParams.cs Show resolved Hide resolved
@martindevans
Copy link
Member Author

I added an IProgress parameter to the LoadFromFileAsync from method as well.

It's not _quite) reporting the raw values. If there are LoRAs to apply it reports model loading in the [0 -> 0.9] range and then reports LoRA loading progress in the [0.9 -> 1.0] range.

@martindevans martindevans changed the title Interruptible Async Model Loading Interruptible Async Model Loading With Progress Monitoring Apr 27, 2024
@martindevans martindevans merged commit 84bb5a3 into SciSharp:master Apr 27, 2024
3 checks passed
@martindevans martindevans deleted the interruptible_async_model_load branch April 27, 2024 15:06
@martindevans martindevans mentioned this pull request Apr 27, 2024
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.

[Feature] Allow async model loading and cancellation
2 participants