mlc-ai / mlc-llm

Universal LLM Deployment Engine with ML Compilation
https://llm.mlc.ai/
Apache License 2.0
17.83k stars 1.42k forks source link

Android MLCChat failed ,[Bug] #2302

Open View999888 opened 2 months ago

View999888 commented 2 months ago

1d61b3b81f3a81ff1e3399f529ac703

How can this error be resolved?

Stack trace: org.apache.tvm.Base$TVMError: InternalError: Check failed: (chat_ != nullptr) is false: Chat is not initialized via reload Stack trace: File "/Users/rageshantonyd/Documents/working_prj/mlc-llm/cpp/llm_chat.cc", line 1744

at org.apache.tvm.Base.checkCall(Base.java:173)
at org.apache.tvm.Function.invoke(Function.java:130)
at ai.mlc.mlcllm.ChatModule.prefill(ChatModule.java:54)
at ai.mlc.mlcchat.AppViewModel$ChatState$requestGenerate$1$1.invoke(AppViewModel.kt:666)
at ai.mlc.mlcchat.AppViewModel$ChatState$requestGenerate$1$1.invoke(AppViewModel.kt:666)
at ai.mlc.mlcchat.AppViewModel$ChatState.callBackend(AppViewModel.kt:548)
at ai.mlc.mlcchat.AppViewModel$ChatState.requestGenerate$lambda$4(AppViewModel.kt:666)
at ai.mlc.mlcchat.AppViewModel$ChatState.$r8$lambda$lluIrcsPALEW5nCb2tohZYadhTY(Unknown Source:0)
at ai.mlc.mlcchat.AppViewModel$ChatState$$ExternalSyntheticLambda3.run(Unknown Source:6)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:929)

Error message: InternalError: Check failed: (chat_ != nullptr) is false: Chat is not initialized via reload Stack trace: File "/Users/rageshantonyd/Documents/working_prj/mlc-llm/cpp/llm_chat.cc", line 1744

View999888 commented 2 months ago

问题 1 :如何获取到app_config.json 中的model_lib_path_for_prepare_libs中的模型文件 问题 2 :apk 怎么和模型文件相互联系的

abhishekdewan101 commented 2 months ago

I had the same issue running on both emulator and device.

BlindDeveloper commented 2 months ago

@View999888 Good day, if you try 7 or 8b models you need 8 gb ram. @abhishekdewan101 Mlc llm working on device only.

View999888 commented 2 months ago

ERROR: No module named ‘tvm’

tvm

How to generate 'tvm' ? Please have a workaround address

MasterJH5574 commented 2 months ago

Hi folks, we just did an android build flow refactor yesterday. The new android build flow requires fewer steps. The documentation has been revamped to the new flow https://llm.mlc.ai/docs/deploy/android.html. Could you check out and try again?

Before doing that, please also upgrade your mlc-llm and tvm to use the latest nightly by following instructions in https://llm.mlc.ai/docs/install/mlc_llm.html.

MasterJH5574 commented 2 months ago

ERROR: No module named ‘tvm’

tvm

How to generate 'tvm' ? Please have a workaround address

@View999888 You need to install tvm by following https://llm.mlc.ai/docs/install/mlc_llm.html.

lengjing606 commented 2 months ago

@View999888 你的已经ok了吗 我发现demo apk都有问题