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

[Fix][Grammar] Detach token table to prevent disposing it #571

Merged
merged 1 commit into from
Sep 23, 2024

Conversation

CharlieFRuan
Copy link
Contributor

Prior to this PR, when reusing the same engine but for different schema will run into error "Module has already been disposed". An example to reproduce this is included in #560.

This is because this.tokenTable is a tvmjs.TVMObject and will be disposed after the scope ends.

We fix this by wrapping the call with this.tvm.detachFromCurrentScope(), and only dispose this.tokenTable when we dispose the entire LLMChatPipeline.

@CharlieFRuan CharlieFRuan merged commit 6b4fa87 into main Sep 23, 2024
1 check passed
CharlieFRuan added a commit that referenced this pull request Sep 23, 2024
No breaking changes or API-related changes.

### Changes

- #571
- #570
- This is the major change in this version, where we now depend on the
packaged TVMjs: `@mlc-ai/web-runtime`. This only changes how users build
WebLLM from source
- Since `@mlc-ai/web-runtime` is not an official package from
`apache/tvm`, we record the commit that it is built upon in the WebLLM
version bump PR, like below

### TVMjs
- Version `0.18.0-dev0`
- Built at
apache/tvm@30fb16a
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.

1 participant