web-llm
web-llm copied to clipboard
Cannot find module 'tvmjs' or its corresponding type declarations EVEN has ‘npm install tvmjs’ done
(gh_web-llm) amd00@asus00:~/llm_dev/web-llm$ npm run build
@mlc-ai/[email protected] build rollup -c
src/index.ts → lib/index.js... [!] (plugin rpt2) Error: src/chat_module.ts:1:24 - error TS2307: Cannot find module 'tvmjs' or its corresponding type declarations.
1 import * as tvmjs from "tvmjs"; ~~~~~~~
src/index.ts
at error (/home/amd00/llm_dev/web-llm/node_modules/rollup/dist/shared/rollup.js:198:30)
at throwPluginError (/home/amd00/llm_dev/web-llm/node_modules/rollup/dist/shared/rollup.js:21718:12)
at Object.error (/home/amd00/llm_dev/web-llm/node_modules/rollup/dist/shared/rollup.js:22672:20)
at RollupContext.error (/home/amd00/llm_dev/web-llm/node_modules/rollup-plugin-typescript2/src/context.ts:35:17)
at /home/amd00/llm_dev/web-llm/node_modules/rollup-plugin-typescript2/src/diagnostics.ts:70:17
at Array.forEach (<anonymous>)
at printDiagnostics (/home/amd00/llm_dev/web-llm/node_modules/rollup-plugin-typescript2/src/diagnostics.ts:42:14)
at typecheckFile (/home/amd00/llm_dev/web-llm/node_modules/rollup-plugin-typescript2/src/index.ts:67:3)
at Object.<anonymous> (/home/amd00/llm_dev/web-llm/node_modules/rollup-plugin-typescript2/src/index.ts:257:5)
at Generator.next (<anonymous>)
(gh_web-llm) amd00@asus00:~/llm_dev/web-llm$ tvmjs
@SeekPoint
Same problem here... Did you find the solutions already???
If you would only like to use webllm, you do not need to run npm run build, instead, follow instructions in examples to directly install WebLLM from npm.
See https://github.com/mlc-ai/web-llm/tree/main/examples/get-started and other examples https://github.com/mlc-ai/web-llm/tree/main/examples
Try this only if you would like to develop WebLLM package. Please follow https://github.com/mlc-ai/web-llm#build-webllm-package-from-source (there are steps before you can run npm run build)
@tqchen
Thanks for the reply... But...
> [email protected] start
> parcel src/get_started.html --port 8888
Server running at http://localhost:8888
🚨 Build failed.
@parcel/core: Failed to resolve '@mlc-ai/web-llm' from './src/get_started.ts'
....../web-llm/examples/get-started/src/get_started.ts:1:25
> 1 | import * as webllm from "@mlc-ai/web-llm";
> | ^^^^^^^^^^^^^^^^^
2 |
3 | function setLabel(id: string, text: string) {
@parcel/resolver-default: Could not load './lib/index.js' from module '@mlc-ai/web-llm' found in package.json#main
....../web-llm/examples/get-started/node_modules/@mlc-ai/web-llm/package.json:5:11
4 | "description": "Hardware accelerated language model chats on browsers",
> 5 | "main": "lib/index.js",
> | ^^^^^^^^^^^^^^ './lib/index.js' does not exist, did you mean './src/index.ts'?'
6 | "types": "lib/index.d.ts",
7 | "type": "module",
Looks like it's a parcel issue.
And if I move examples folder out of web-llm itself, I'm still getting:
➜ get-started npm start
> [email protected] start
> parcel src/get_started.html --port 8888
Server running at http://localhost:8888
🚨 Build failed.
@parcel/core: Failed to resolve '@mlc-ai/web-llm' from './src/get_started.ts'
....../examples/get-started/src/get_started.ts:1:25
> 1 | import * as webllm from "@mlc-ai/web-llm";
> | ^^^^^^^^^^^^^^^^^
2 |
3 | function setLabel(id: string, text: string) {
@parcel/resolver-default: Cannot find module '@mlc-ai/web-llm'
💡 Did you mean '@mlc-ai/web-llm'?
And, I can see @mlc-ai/web-llm has been installed locally.
➜ get-started npm list @mlc-ai/web-llm
[email protected] ....../examples/get-started
└── @mlc-ai/[email protected] -> ./../..
Any further suggestions? Thank you ...
Make sure you run npm install first to install web-llm, you would need to change the web-llm dependency to 0.2.0 instead of file as being suggested.
If you have already done that differently, remove the node_modules folder locally first
try to do a fresh clone of the repo and try out commands in https://github.com/mlc-ai/web-llm/tree/main/examples/get-started
@tqchen
Great... It finally runs successfully.... However, the same as https://mlc.ai/web-llm/ :
Init error, Error: Cannot find adapter that matches the request
[System Initalize]
Init error, Error: Cannot find adapter that matches the request
Any further suggestions??
Thanks
That likely mean that you do not have a device that have enough GPU RAM
@tqchen
What? I got a Geforce 3090 24G. Won't that do?
And, BTW, you know any llm that can be easily deployed on a cellphone?
Thanks...
hmm, that seems to be sufficient, maybe you can try out https://webgpureport.org/ to see if you can find the GPU.
That could be an issue of your browser, make sure you use the latest chrome
For mobile deployment, checkout https://mlc.ai/mlc-llm/
Do you have your parameters downloaded into the specified path?
still failed:
(base) amd01@mz32-01:~/llm_dev/web-llm/examples/get-started$ npm install
npm ERR! Maximum call stack size exceeded
npm ERR! A complete log of this run can be found in: npm ERR! /home/amd01/.npm/_logs/2023-07-09T04_15_49_122Z-debug.log (base) amd01@mz32-01:~/llm_dev/web-llm/examples/get-started$
(gh_web-llm) amd00@asus00:~/llm_dev/web-llm$ npm run build(gh_web-llm) amd00@asus00:~/llm_dev/web-llm$ npm run build
@mlc-ai/[email protected] build@mlc-ai/[email protected] 构建 rollup -c 汇总 -c
src/index.ts → lib/index.js... [!] (plugin rpt2) Error: src/chat_module.ts:1:24 - error TS2307: Cannot find module 'tvmjs' or its corresponding type declarations.[!](插件 rpt2)错误:src/chat_module.ts:1:24 - 错误 TS2307:找不到模块“tvmjs”或其相应的类型声明。
1 import * as tvmjs from "tvmjs";1 从“tvmjs”导入 * 作为 tvmjs; ~~~~~~~
src/index.ts
at error (/home/amd00/llm_dev/web-llm/node_modules/rollup/dist/shared/rollup.js:198:30) at throwPluginError (/home/amd00/llm_dev/web-llm/node_modules/rollup/dist/shared/rollup.js:21718:12) at Object.error (/home/amd00/llm_dev/web-llm/node_modules/rollup/dist/shared/rollup.js:22672:20) at RollupContext.error (/home/amd00/llm_dev/web-llm/node_modules/rollup-plugin-typescript2/src/context.ts:35:17) at /home/amd00/llm_dev/web-llm/node_modules/rollup-plugin-typescript2/src/diagnostics.ts:70:17 at Array.forEach (<anonymous>) at printDiagnostics (/home/amd00/llm_dev/web-llm/node_modules/rollup-plugin-typescript2/src/diagnostics.ts:42:14) at typecheckFile (/home/amd00/llm_dev/web-llm/node_modules/rollup-plugin-typescript2/src/index.ts:67:3) at Object.<anonymous> (/home/amd00/llm_dev/web-llm/node_modules/rollup-plugin-typescript2/src/index.ts:257:5) at Generator.next (<anonymous>)(gh_web-llm) amd00@asus00:~/llm_dev/web-llm$ tvmjs(gh_web-LLM) amd00@asus00:~/llm_dev/web-llm$ tvmjs
The same issue persists even after installing the previous command. Have you resolved it?