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

how to use mlc-llm-cli tools on android platform?

Open NullCarrier opened this issue 2 years ago • 0 comments

I tried to run the command line tools on the android system with cl enabled. I followed the instructions README file under android folder. But when I run the tools, it report the error:

Cannot find library "vicuna-v1-7b-q4f16_0-opencl.so" and other library candidate in /data/test_with_mlc-llm/dist/vicuna-v1-7b-q4f16_0

Then I found the problem should be the building models. I use the following command for building model, but only have static library exported for android platform.

python3 build.py --model=vicuna-v1-7b --quantization q4f16_0 --target android  --max-seq-len 768 --use-cache 1

Here is the output:

Using model path dist/models/vicuna-v1-7b
Load cached module from dist/vicuna-v1-7b-q4f16_0/mod_cache_before_build_android.pkl and skip tracing. You can use --use-cache=0 to retrace
19 static functions: [I.GlobalVar("divide1"), I.GlobalVar("transpose"), I.GlobalVar("fused_decode3_fused_matmul4_cast2"), I.GlobalVar("rms_norm1"), I.GlobalVar("fused_decode_fused_matmul_add"), I.GlobalVar("reshape1"), I.GlobalVar("softmax1"), I.GlobalVar("reshape"), I.GlobalVar("slice1"), I.GlobalVar("reshape2"), I.GlobalVar("fused_decode1_fused_matmul2_multiply"), I.GlobalVar("fused_decode2_fused_matmul3_add"), I.GlobalVar("squeeze"), I.GlobalVar("fused_decode1_fused_matmul2_silu"), I.GlobalVar("fused_decode_matmul"), I.GlobalVar("take_decode"), I.GlobalVar("fused_transpose2_reshape4"), I.GlobalVar("rotary_embedding1"), I.GlobalVar("fused_reshape2_squeeze")]
26 dynamic functions: [I.GlobalVar("rms_norm"), I.GlobalVar("transpose6"), I.GlobalVar("reshape7"), I.GlobalVar("matmul9"), I.GlobalVar("reshape3"), I.GlobalVar("reshape6"), I.GlobalVar("fused_decode5_fused_NT_matmul3_silu1"), I.GlobalVar("rotary_embedding"), I.GlobalVar("fused_decode5_fused_NT_matmul3_multiply1"), I.GlobalVar("fused_min_max_triu_te_broadcast_to"), I.GlobalVar("matmul1"), I.GlobalVar("fused_softmax2_cast4"), I.GlobalVar("fused_softmax_cast1"), I.GlobalVar("reshape5"), I.GlobalVar("take_decode1"), I.GlobalVar("transpose1"), I.GlobalVar("fused_decode4_fused_NT_matmul1_add1"), I.GlobalVar("fused_NT_matmul2_divide2_maximum1_minimum1_cast3"), I.GlobalVar("fused_decode6_fused_NT_matmul4_add1"), I.GlobalVar("fused_decode4_NT_matmul1"), I.GlobalVar("extend_te"), I.GlobalVar("reshape8"), I.GlobalVar("squeeze1"), I.GlobalVar("slice"), I.GlobalVar("full"), I.GlobalVar("fused_NT_matmul_divide_maximum_minimum_cast")]
Dump static shape TIR to dist/vicuna-v1-7b-q4f16_0/debug/mod_tir_static.py
Dump dynamic shape TIR to dist/vicuna-v1-7b-q4f16_0/debug/mod_tir_dynamic.py
- Dispatch to pre-scheduled op: rms_norm
- Dispatch to pre-scheduled op: fused_NT_matmul_divide_maximum_minimum_cast
- Dispatch to pre-scheduled op: matmul9
- Dispatch to pre-scheduled op: fused_min_max_triu_te_broadcast_to
- Dispatch to pre-scheduled op: fused_softmax_cast1
- Dispatch to pre-scheduled op: matmul1
- Dispatch to pre-scheduled op: fused_softmax2_cast4
- Dispatch to pre-scheduled op: fused_NT_matmul2_divide2_maximum1_minimum1_cast3
[11:32:27] /home/lc/Repo/mlc-llm/relax/src/runtime/opencl/opencl_device_api.cc:459: Warning: No OpenCL platform matched given existing options ...
Finish exporting to dist/vicuna-v1-7b-q4f16_0/vicuna-v1-7b-q4f16_0-android.a
Finish exporting chat config to dist/vicuna-v1-7b-q4f16_0/params/mlc-chat-config.json

Is there any way to build model for vicuna-v1-7b-q4f16_0-opencl.so? Thanks for the help.

mlc-llm commit id: 47a7a11

relax commit id: c0e455773

NullCarrier avatar May 18 '23 03:05 NullCarrier