web-llm icon indicating copy to clipboard operation
web-llm copied to clipboard

How to let the user cancel loading the model and stop it from fetching params

Open JohnReginaldShutler opened this issue 7 months ago • 3 comments

Hello quick question! I was wondering, after you create the engine (in the step below) and the cache starts getting populated, how do you code a cancel button for a user to cancel downloading the model/quit the task. Is there a method that can be called? In this example to stop the response llm.abort(); but I would like to understand what abort() is being called on and how can I get there from the simple implementation found below.

const engine = await CreateMLCEngine( selectedModel, { initProgressCallback: initProgressCallback }, // engineConfig );

Thank you!

@customautosys

JohnReginaldShutler avatar Jul 11 '24 04:07 JohnReginaldShutler