mlc-ai / web-llm

High-performance In-browser LLM Inference Engine
https://webllm.mlc.ai
Apache License 2.0
13.59k stars 875 forks source link

Runing LLM in a webworker fails due to loglevel dependency #511

Open jauniusmentimeter opened 3 months ago

jauniusmentimeter commented 3 months ago

As for reproducing, can use a simple example defined here.

When creating CreateWebWorkerMLCEngine instance, loglevel is being executed in webworker and fails due to having references to window object. Here is one example of failure.

In earlier versions web workers were working fine, I was running 0.2.36 with no problems.

Neet-Nestor commented 3 months ago

@jauniusmentimeter I'm running the get-started-web-worker example and it didn't seem to fail or complain. Could you provide a minimal simple sample code with error output screenshot to help me understand the issue?

From the code samples you referenced here, I see the package is checking whether window is defined properly so it shouldn't crash anything if I understand the code correctly.