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

[BUG] App crashes when closed during GenAIModel initialization #29

Open
AndrewKeepCoding opened this issue Nov 22, 2024 · 2 comments · May be fixed by #39
Open

[BUG] App crashes when closed during GenAIModel initialization #29

AndrewKeepCoding opened this issue Nov 22, 2024 · 2 comments · May be fixed by #39
Labels
🐛bug Something isn't working 🤖 sample 🐚 app

Comments

@AndrewKeepCoding
Copy link
Contributor

AndrewKeepCoding commented Nov 22, 2024

Describe the bug
It takes a few seconds to instantiate Model. The app crashes if you close the app.

GenAIModel.cs

private Task InitializeAsync(string modelDir, CancellationToken cancellationToken = default)
{
    return Task.Run(
        () =>
        {
            _model = new Model(modelDir);
            _tokenizer = new Tokenizer(_model);
        },
        cancellationToken);
}

To Reproduce
Steps to reproduce the behavior:

  1. Run the app on the debugger and go to Generate Text.
  2. Download a model if you don't have any, restart the app then go to Generate Text again.
  3. Close the app while the progress ring is in progress.
  4. See error

Expected behavior
The app should close without any errors.

Screenshots
If applicable, add screenshots to help explain your problem.

Image

Please complete the following information:

  • App Version [e.g. 0.4.1 from the Microsoft Store]:

Additional context
This might be the same for other models.

@nmetulev nmetulev added 🐛bug Something isn't working 🤖 sample 🐚 app labels Nov 25, 2024
@nmetulev
Copy link
Member

We likely need to capture the close event and wait for the sample to clean up resources. @azchohfi ideas?

@azchohfi
Copy link
Contributor

Yes, that is pretty much it. Working on a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛bug Something isn't working 🤖 sample 🐚 app
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants