M5stack LLM Module買う -4-

 なんか、いろいろと先は長いな...

有線LANを接続:

 何かするにも、ネット接続がないと不便なので、デバッグモジュール側から有線LANを接続する。DHCPでのアドレスの割り当てが確認できた。

root@m5stack-LLM:~# ip addr show dev eth0

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group def0

link/ether 86:b4:1b:aa:d2:21 brd ff:ff:ff:ff:ff:ff

inet 192.168.0.10/24 brd 192.168.0.255 scope global dynamic eth0

valid_lft 86266sec preferred_lft 86266sec

inet6 240f:a3:8bb5:1:84b4:1bff:feaa:d221/64 scope global dynamic mngtmpaddr

valid_lft 291sec preferred_lft 291sec

inet6 fe80::84b4:1bff:feaa:d221/64 scope link

valid_lft forever preferred_lft forever

ssh接続する:

 sshdは動いているので、ssh接続ができる。

 デフォルトでログインできるアカウントはrootのみ、パスワードは「123456」になっている。

% ssh root@192.168.0.10

The authenticity of host '192.168.0.10 (192.168.0.10)' can't be established.

ECDSA key fingerprint is SHA256:jIJ1pujfpVvSrlWY1ux9C+hKNuYcDpQY95/5nuV3UYQ.

Are you sure you want to continue connecting (yes/no/[fingerprint])? yes

Warning: Permanently added '192.168.0.10' (ECDSA) to the list of known hosts.

root@192.168.0.10's password:

Welcome to Ubuntu 22.04 LTS (GNU/Linux 4.19.125 aarch64)

  • Documentation: https://help.ubuntu.com

  • Management: https://landscape.canonical.com

  • Support: https://ubuntu.com/advantage

This system has been minimized by removing packages and content that are

not required on a system that users do not log into.

To restore this content, you can run the 'unminimize' command.

Last login: Tue Aug 22 05:11:46 2023

root@m5stack-LLM:~#

jqを入れる:

 jsonを扱うことになるので、あらかじめjqコマンドをインストールしておく。

root@m5stack-LLM:~# sudo apt-get install jq

Reading package lists... Done

Building dependency tree... Done

Reading state information... Done

The following additional packages will be installed:

libjq1 libonig5

The following NEW packages will be installed:

jq libjq1 libonig5

0 upgraded, 3 newly installed, 0 to remove and 120 not upgraded.

Need to get 346 kB of archives.

After this operation, 1043 kB of additional disk space will be used.

Do you want to continue? [Y/n] y

(snip)

lsofをインストールする:

 lsofがないのはいろいろ不便なので入れておく。

root@m5stack-LLM:~# sudo apt-get install lsof

Reading package lists... Done

Building dependency tree... Done

Reading state information... Done

The following NEW packages will be installed:

lsof

0 upgraded, 1 newly installed, 0 to remove and 120 not upgraded.

Need to get 251 kB of archives.

After this operation, 454 kB of additional disk space will be used.

llm-sysがつかんでいるシリアルポートを調べる:

 lsofで調べると、llm-sysがttyS1をつかんでいるのがわかった。

root@m5stack-LLM:~# lsof /dev/ttyS*

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME

llm_sys 1730 root 10u CHR 4,65 0t0 168 /dev/ttyS1

 ttyS1とCoreが通信しているのはわかった。

ser2netでシリアルを仮想化してみる(失敗):

 ttyS1をser2netで仮想化して、コンソール側から割り込み利用できるようにしてみようとしたけど失敗。

Core側のコードを調べる:

 Core側のコードは、ブロック言語のUIFlow2.0用になっている。これってchromeでしか動かないので嫌いなのよね。できればさわりたくないけど。

 get_model_listのPythonコードはこんな感じ。

import os, sys, io

import M5

from M5 import *

from module import LlmModule

import time

label0 = None

label1 = None

llm_0 = None

line0 = None

line1 = None

k = None

model = None

type2 = None

def setup():

global label0, label1, llm_0, line0, line1, model, type2, k

M5.begin()

Widgets.fillScreen(0x222222)

label0 = Widgets.Label("State", 10, 10, 1.0, 0xffffff, 0x222222, Widgets.FONTS.DejaVu18)

label1 = Widgets.Label("~", 10, 40, 1.0, 0xffffff, 0x222222, Widgets.FONTS.DejaVu18)

llm_0 = LlmModule(2, tx=17, rx=18)

label1.setText(str('Wait ModuleLLM connection..'))

while not (llm_0.check_connection()):

time.sleep(1)

label1.setText(str('Get the List of models'))

print('List of models')

line0 = '-'

line1 = '='

print(line1 * 60)

for k in (llm_0.ls_mode()):

model = k['mode']

type2 = k['type']

print((str('Type: ') + str(type2)))

print(line0 * 60)

print((str('Model: ') + str(model)))

print(line1 * 60)

label1.setText(str('OK'))

def loop():

global label0, label1, llm_0, line0, line1, model, type2, k

M5.update()

if name == 'main':

try:

setup()

while True:

loop()

except (Exception, KeyboardInterrupt) as e:

try:

from utility import print_error_msg

print_error_msg(e)

except ImportError:

print("please update to latest firmware")

 LlmModuleのインスタンスをシリアルポートと紐づけてllm_0という名前をつけて作り、llm_0.ls_mode()で対応モデルのリストを取得、取得したリストを整形してプリントという感じ。うーん、処理はLlmModuleで隠蔽されているのね。

 LlmModuleの仕様はこちら。

 LLM Module — UIFlow2 Programming Guide master documentation

 https://uiflow-micropython.readthedocs.io/en/latest/module/llm.html

 モジュールの御本体はこれかな? 追っかけるのは面倒だな...

 uiflow-micropython/m5stack/libs/module/llm.py at master · m5stack/uiflow-micropython · GitHub

 https://github.com/m5stack/uiflow-micropython/blob/master/m5stack/libs/module/llm.py

 なんか、そこまで根気が出ないな...

設定ファイルがないか調べる:

 どうやら、/opt/m5stack/あたりにデータと実行ファイルがあるようだ。

 binにはバイナリ。

root@m5stack-LLM:~# ls /opt/m5stack/bin

llm_asr llm_camera llm_llm llm_skel llm_tts llm_yolo

llm_audio llm_kws llm_melotts llm_sys llm_vlm

 dataにもなんかあるな。

root@m5stack-LLM:~# ls /opt/m5stack/data/

audio

melotts_zh-cn

models

qwen2.5-0.5B-prefill-20e

sherpa-ncnn-streaming-zipformer-20M-2023-02-17

sherpa-ncnn-streaming-zipformer-zh-14M-2023-02-23

sherpa-onnx-kws-zipformer-gigaspeech-3.3M-2024-01-01

sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01

single_speaker_english_fast

single_speaker_fast

yolo11n

yolo11n-pose

yolo11n-seg

 etcがなんかで参照されていたけど、デフォルトにはない。

root@m5stack-LLM:~# ls /opt/m5stack/etc/

ls: cannot access '/opt/m5stack/etc/': No such file or directory

 scriptsはトークナイザー系が入っている。

root@m5stack-LLM:~# ls /opt/m5stack/scripts/

hashes.txt

internvl2-1b-ax630c_tokenizer.py

llama3.2-1B-prefill-ax630c_tokenizer.py

openbuddy-llama3.2-1B-ax630c_tokenizer.py

qwen2.5-coder-0.5B-ax630c_tokenizer.py

text2token.py

 scriptsには設定ファイルなどがある感じ。

root@m5stack-LLM:~# ls /opt/m5stack/scripts/

hashes.txt

internvl2-1b-ax630c_tokenizer.py

llama3.2-1B-prefill-ax630c_tokenizer.py

openbuddy-llama3.2-1B-ax630c_tokenizer.py

qwen2.5-coder-0.5B-ax630c_tokenizer.py

text2token.py

root@m5stack-LLM:~# ls /opt/m5stack/share/

_tokenizer.py

audio.json

camera.json

internvl2-1B-ax630c_tokenizer.py

llama3.2-1B-prefill-ax630c_tokenizer.py

openbuddy-llama3.2-1B-ax630c_tokenizer.py

qwen2.5-coder-0.5B-ax630c_tokenizer.py

static_file

sys_config.json

sysの設定ファイルを調べる:

 sys_config.jsonが怪しいので見る。

root@m5stack-LLM:~# cat /opt/m5stack/share/sys_config.json

{

"config_enable_tcp": 1

}

llm-sysはIPからの利用も許可されているっぽいね。

llm-sysの動いているポートを調べる:

 現在開いているポートを調べる。2000でser2netの残骸を放置しているのはご容赦くださいw

root@m5stack-LLM:~# sudo ss -tuln

Netid State Recv-Q Send-Q Local Address:Port

udp UNCONN 0 0 127.0.0.53:53

udp UNCONN 0 0 0.0.0.0:68

udp UNCONN 0 0 0.0.0.0:111

udp UNCONN 0 0 192.168.0.10:123

udp UNCONN 0 0 127.0.0.1:123

udp UNCONN 0 0 0.0.0.0:123

udp UNCONN 0 0 0.0.0.0:5353

udp UNCONN 0 0 0.0.0.0:56644

udp UNCONN 0 0 *:111

udp UNCONN 0 0 [fe80::f816:67ff:fead:567b]:123

udp UNCONN 0 0 [240f:a3:8bb5:1:f816:67ff:fead:567b]:123

udp UNCONN 0 0 [::1]:123

udp UNCONN 0 0 *:123

udp UNCONN 0 0 *:5353

udp UNCONN 0 0 *:45892

tcp LISTEN 0 128 0.0.0.0:10001

tcp LISTEN 0 128 127.0.0.53%lo:53

tcp LISTEN 0 128 0.0.0.0:22

tcp LISTEN 0 128 0.0.0.0:23

tcp LISTEN 0 4 127.0.0.1:5037

tcp LISTEN 0 128 0.0.0.0:111

tcp LISTEN 0 5 *:2000

tcp LISTEN 0 128 [::]:22

tcp LISTEN 0 128 [::]:111

 10001とかなんか怪しくない? 何がつかんでいるのか調べる。

root@m5stack-LLM:~# sudo lsof -i | grep llm_sys

llm_sys 1730 root 25u IPv4 9221 0t0 TCP *:10001 (LISTEN)

 ビンゴ。

ポート10001と通信してみる:

 これと、どうやって通信したらいいのかな?

 とりあえず、telnetで叩けばいいかw

 さすがにtelnetは入ってないな... telnet入れるか...

root@m5stack-LLM:~# sudo apt-get install telnet

Reading package lists... Done

Building dependency tree... Done

Reading state information... Done

The following NEW packages will be installed:

telnet

0 upgraded, 1 newly installed, 0 to remove and 120 not upgraded.

Need to get 65.5 kB of archives.

After this operation, 150 kB of additional disk space will be used.

(snip)

 叩く。

root@m5stack-LLM:~# telnet localhost 10001

Trying 127.0.0.1...

Connected to localhost.

Escape character is '^]'.

 特にコネクション開始の情報は返ってこない。やりとりはjsonフォーマットで行われるようなので、空のjsonを送ってみる。おっ、エラーの応答来た!

{}

{"created":1735099878,"data":"None","error":{"code":-2,"message":"json format e}

んで、何を送れば?:

 んで、何をどう送ればちゃんと応答してくれるのかな?

 LLM Module APIなんてPDFを見つけた。

 https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/protocol/M140/LLM_Module_API_v1.0.0_CN.pdf

 送るのは以下でいいようだ。

request_id: 会話の識別子。サービスの呼び出しと応答を区別するために使用。

work_id: 呼び出すサービスユニットの識別子。サービス初期化時はユニット名のキーワードのみを指定(例: llm)。

action: 実行するメソッド。各ユニットのメソッドリストを参照。

object: 送信するデータの構造体。パラメータがない場合は省略可能。

data: 転送するパラメータ。データがない場合は省略可能。

 エラーコードはこんな感じ。

エラーコード 説明 メッセージ 備考

0 操作成功! Operation Successful!

-1 通信チャネル受信状態機リセット reace reset JSON受信状態機のリセット。連続で"}を送ると発生。

-2 JSON解析エラー json format error JSON形式が正しくない場合に発生。

-3 システムアクションの一致エラー action match false 実行しようとしたアクションが一致しない場合に発生。

-4 推論データ送信エラー inference data push false 推論データの送信に失敗。

-5 モデルのロード失敗 Model loading failed.

-6 ユニットが存在しない Unit Does Not Exist 呼び出されたユニットが存在しない場合に発生。

-7 不明な操作 Unknown Operation サポートされていない操作。

-8 ユニットリソースの取得失敗 Unit Resource Allocation Failed

-9 ユニット呼び出し失敗 unit call false

-10 モデル初期化失敗 Model init failed.

-11 モデル実行エラー Model run failed.

-12 モジュール未初期化 Module has not been initialised.

-13 モジュールがすでに動作中 Module already working.

-14 モジュールが動作していない Module is not working.

-19 ユニットリソース解放失敗 Unit Resource Free Failed

SYS(システムユニット):

SYSユニットは、モジュールの動作パラメータの設定や、モジュールの動作情報の取得に使用されます。

メソッド一覧

メソッド 機能 入力タイプ 出力タイプ

lsmode 利用可能なモデルを取得 無し sys.lsmode

hwinfo CPU負荷、メモリ負荷、チップ温度を取得 無し sys.hwinfo

reset ユニットを再起動 無し 再起動完了のJSON

reboot システム全体を再起動 無し 無し

ping システムの利用可能性を確認 無し 無し

lsmode(利用可能なモデルを取得)

利用可能なモデルをリストします。

{"request_id": "001","work_id": "sys","action": "lsmode"}

 なんかすげー返ってきた。シリアルからだと後ろが切れてる可能性があるので注意。

{"created":1735102386,"data":[{"capabilities":["tts"],"input_type":["tts.utf-8"],"mode":"melotts_zh-cn","mode_param":{"audio_rate":16000,"awake_delay":1000,"decoder":"decoder.axmodel","encoder":"encoder.onnx","gbin":"g.bin","lexicon":"lexicon.txt","mode_rate":44100,"spacker_speed":1.0,"tokens":"tokens.txt"},"output_type":["tts.wav","sys.play.0_1"],"type":"tts"},{"capabilities":["text_generation","chat"],"input_type":["llm.utf-8","llm.utf-8.stream","llm.chat_completion","llm.chat_completion.stream"],"mode":"qwen2.5-0.5B-prefill-20e","mode_param":{"axmodel_num":24,"b_bos":false,"b_dynamic_load_axmodel_layer":false,"b_eos":false,"b_use_mmap_load_embed":true,"b_use_topk":false,"filename_post_axmodel":"qwen2_post.axmodel","filename_tokenizer_model":"qwen.tiktoken","filename_tokens_embed":"model.embed_tokens.weight.bfloat16.bin","template_filename_axmodel":"qwen2_p128_l%d_together.axmodel","tokenizer_type":1,"tokens_embed_num":151936,"tokens_embed_size":896},"output_type":["llm.utf-8","llm.utf-8.stream"],"type":"llm"},{"capabilities":["Automatic_Speech_Recognition","English"],"input_type":["sys.pcm","sys.cap.0_0"],"mode":"sherpa-ncnn-streaming-zipformer-20M-2023-02-17","mode_param":{"awake_delay":50,"enable_endpoint":true,"endpoint_config.rule1.min_trailing_silence":2.4,"endpoint_config.rule2.min_trailing_silence":1.2,"endpoint_config.rule3.min_utterance_length":30,"feat_config.feature_dim":80,"feat_config.sampling_rate":16000,"model_config.decoder_bin":"decoder_jit_trace-pnnx.ncnn.bin","model_config.decoder_param":"decoder_jit_trace-pnnx.ncnn.param","model_config.encoder_bin":"encoder_jit_trace-pnnx.ncnn.bin","model_config.encoder_param":"encoder_jit_trace-pnnx.ncnn.param","model_config.joiner_bin":"joiner_jit_trace-pnnx.ncnn.bin","model_config.joiner_param":"joiner_jit_trace-pnnx.ncnn.param","model_config.tokens":"tokens.txt"},"mode_param_bak":{"decoder_config.method":"greedy_search","decoder_config.num_active_paths":4,"endpoint_config.rule1.min_utterance_length":0,"endpoint_config.rule1.must_contain_nonsilence":false,"endpoint_config.rule2.min_utterance_length":0,"endpoint_config.rule2.must_contain_nonsilence":true,"endpoint_config.rule3.min_trailing_silence":0,"endpoint_config.rule3.must_contain_nonsilence":false,"hotwords_file":"","hotwords_score":1.5,"model_config.decoder_opt.num_threads":2,"model_config.encoder_opt.num_threads":2,"model_config.joiner_opt.num_threads":2},"output_type":["asr.utf-8","asr.bool"],"type":"asr"},{"capabilities":["Automatic_Speech_Recognition","Chinese"],"input_type":["sys.pcm","sys.cap.0_0"],"mode":"sherpa-ncnn-streaming-zipformer-zh-14M-2023-02-23","mode_param":{"awake_delay":50,"enable_endpoint":true,"endpoint_config.rule1.min_trailing_silence":2.4,"endpoint_config.rule2.min_trailing_silence":1.2,"endpoint_config.rule3.min_utterance_length":30,"feat_config.feature_dim":80,"feat_config.sampling_rate":16000,"model_config.decoder_bin":"decoder_jit_trace-pnnx.ncnn.bin","model_config.decoder_param":"decoder_jit_trace-pnnx.ncnn.param","model_config.encoder_bin":"encoder_jit_trace-pnnx.ncnn.bin","model_config.encoder_param":"encoder_jit_trace-pnnx.ncnn.param","model_config.joiner_bin":"joiner_jit_trace-pnnx.ncnn.bin","model_config.joiner_param":"joiner_jit_trace-pnnx.ncnn.param","model_config.tokens":"tokens.txt"},"mode_param_bak":{"decoder_config.method":"greedy_search","decoder_config.num_active_paths":4,"endpoint_config.rule1.min_utterance_length":0,"endpoint_config.rule1.must_contain_nonsilence":false,"endpoint_config.rule2.min_utterance_length":0,"endpoint_config.rule2.must_contain_nonsilence":true,"endpoint_config.rule3.min_trailing_silence":0,"endpoint_config.rule3.must_contain_nonsilence":false,"hotwords_file":"","hotwords_score":1.5,"model_config.decoder_opt.num_threads":2,"model_config.encoder_opt.num_threads":2,"model_config.joiner_opt.num_threads":2},"output_type":["asr.utf-8","asr.bool"],"type":"asr"},{"capabilities":["Keyword_spotting","English"],"input_type":["sys.pcm","sys.cap.0_0"],"mode":"sherpa-onnx-kws-zipformer-gigaspeech-3.3M-2024-01-01","mode_param":{"keywords_file":"keywords.txt","model_config.modeling_unit":"cjkchar","model_config.tokens":"tokens.txt","model_config.transducer.decoder":"decoder-epoch-12-avg-2-chunk-16-left-64.onnx","model_config.transducer.encoder":"encoder-epoch-12-avg-2-chunk-16-left-64.int8.onnx","model_config.transducer.joiner":"joiner-epoch-12-avg-2-chunk-16-left-64.int8.onnx","text2token-bpe-model":"bpe.model","text2token-tokens-type":"cjkchar+bpe","wake_wav_file":"/opt/m5stack/data/audio/wakeup_en_us.wav"},"mode_param_bak":{"feat_config.dither":0,"feat_config.feature_dim":80,"feat_config.high_freq":-400,"feat_config.low_freq":20,"feat_config.sampling_rate":16000,"keywords_file":"keywords.txt","keywords_score":1,"keywords_threshold":0.25,"max_active_paths":4,"model_config.bpe_vocab":"","model_config.debug":false,"model_config.model_type":"","model_config.modeling_unit":"cjkchar","model_config.nemo_ctc.model":"","model_config.num_threads":2,"model_config.paraformer.decoder":"","model_config.paraformer.encoder":"","model_config.provider_config.cuda_config.cudnn_conv_algo_search":1,"model_config.provider_config.device":0,"model_config.provider_config.provider":"cpu","model_config.provider_config.trt_config.trt_detailed_build_log":false,"model_config.provider_config.trt_config.trt_dump_subgraphs":false,"model_config.provider_config.trt_config.trt_engine_cache_enable":true,"model_config.provider_config.trt_config.trt_engine_cache_path":".","model_config.provider_config.trt_config.trt_fp16_enable":true,"model_config.provider_config.trt_config.trt_max_partition_iterations":10,"model_config.provider_config.trt_config.trt_max_workspace_size":2147483647,"model_config.provider_config.trt_config.trt_min_subgraph_size":5,"model_config.provider_config.trt_config.trt_timing_cache_enable":true,"model_config.provider_config.trt_config.trt_timing_cache_path":".","model_config.tokens":"tokens.txt","model_config.transducer.decoder":"decoder-epoch-12-avg-2-chunk-16-left-64.onnx","model_config.transducer.encoder":"encoder-epoch-12-avg-2-chunk-16-left-64.int8.onnx","model_config.transducer.joiner":"joiner-epoch-12-avg-2-chunk-16-left-64.int8.onnx","model_config.warm_up":0,"model_config.wenet_ctc.chunk_size":16,"model_config.wenet_ctc.model":"","model_config.wenet_ctc.num_left_chunks":4,"model_config.zipformer2_ctc.model":"","num_trailing_blanks":1,"text2token-bpe-model":"bpe.model","text2token-tokens-type":"cjkchar+bpe"},"output_type":["kws.bool"],"type":"kws"},{"capabilities":["Keyword_spotting","Chinese"],"input_type":["sys.pcm","sys.cap.0_0"],"mode":"sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01","mode_param":{"keywords_file":"keywords.txt","model_config.modeling_unit":"cjkchar","model_config.tokens":"tokens.txt","model_config.transducer.decoder":"decoder-epoch-12-avg-2-chunk-16-left-64.onnx","model_config.transducer.encoder":"encoder-epoch-12-avg-2-chunk-16-left-64.int8.onnx","model_config.transducer.joiner":"joiner-epoch-12-avg-2-chunk-16-left-64.int8.onnx","text2token-tokens-type":"ppinyin","wake_wav_file":"/opt/m5stack/data/audio/wakeup_zh_cn.wav"},"mode_param_bak":{"feat_config.dither":0,"feat_config.feature_dim":80,"feat_config.high_freq":-400,"feat_config.low_freq":20,"feat_config.sampling_rate":16000,"keywords_file":"keywords.txt","keywords_score":1,"keywords_threshold":0.25,"max_active_paths":4,"model_config.bpe_vocab":"","model_config.debug":false,"model_config.model_type":"","model_config.modeling_unit":"cjkchar","model_config.nemo_ctc.model":"","model_config.num_threads":1,"model_config.paraformer.decoder":"","model_config.paraformer.encoder":"","model_config.provider_config.cuda_config.cudnn_conv_algo_search":1,"model_config.provider_config.device":0,"model_config.provider_config.provider":"cpu","model_config.provider_config.trt_config.trt_detailed_build_log":false,"model_config.provider_config.trt_config.trt_dump_subgraphs":false,"model_config.provider_config.trt_config.trt_engine_cache_enable":true,"model_config.provider_config.trt_config.trt_engine_cache_path":".","model_config.provider_config.trt_config.trt_fp16_enable":true,"model_config.provider_config.trt_config.trt_max_partition_iterations":10,"model_config.provider_config.trt_config.trt_max_workspace_size":2147483647,"model_config.provider_config.trt_config.trt_min_subgraph_size":5,"model_config.provider_config.trt_config.trt_timing_cache_enable":true,"model_config.provider_config.trt_config.trt_timing_cache_path":".","model_config.tokens":"tokens.txt","model_config.transducer.decoder":"decoder-epoch-12-avg-2-chunk-16-left-64.onnx","model_config.transducer.encoder":"encoder-epoch-12-avg-2-chunk-16-left-64.int8.onnx","model_config.transducer.joiner":"joiner-epoch-12-avg-2-chunk-16-left-64.int8.onnx","model_config.warm_up":0,"model_config.wenet_ctc.chunk_size":16,"model_config.wenet_ctc.model":"","model_config.wenet_ctc.num_left_chunks":4,"model_config.zipformer2_ctc.model":"","num_trailing_blanks":1,"text2token-tokens-type":"ppinyin"},"output_type":["kws.bool"],"type":"kws"},{"capabilities":["tts","English"],"input_type":["tts.utf-8"],"mode":"single_speaker_english_fast","mode_param":{"awake_delay":1000,"ttsModelName":"single_speaker_english_fast.bin"},"output_type":["tts.wav","sys.play.0_1"],"type":"tts"},{"capabilities":["tts","Chinese"],"input_type":["tts.utf-8"],"mode":"single_speaker_fast","mode_param":{"awake_delay":1000,"ttsModelName":"single_speaker_fast.bin"},"output_type":["tts.wav","sys.play.0_1"],"type":"tts"},{"capabilities":["Pose"],"input_type":["yolo.jpeg.base64"],"mode":"yolo11n-pose","mode_param":{"cls_name":["person","bicycle","car","motorcycle","airplane","bus","train","truck","boat","traffic light","fire hydrant","stop sign","parking meter","bench","bird","cat","dog","horse","sheep","cow","elephant","bear","zebra","giraffe","backpack","umbrella","handbag","tie","suitcase","frisbee","skis","snowboard","sports ball","kite","baseball bat","baseball glove","skateboard","surfboard","tennis racket","bottle","wine glass","cup","fork","knife","spoon","bowl","banana","apple","sandwich","orange","broccoli","carrot","hot dog","pizza","donut","cake","chair","couch","potted plant","bed","dining table","toilet","tv","laptop","mouse","remote","keyboard","cell phone","microwave","oven","toaster","sink","refrigerator","book","clock","vase","scissors","teddy bear","hair drier","toothbrush"],"cls_num":1,"img_h":320,"img_w":320,"model_type":"pose","nms_threshold":0.45,"pron_threshold":0.45,"yolo_model":"yolo11n-pose.axmodel"},"mode_param_bak":{},"output_type":["yolo.yolobox"],"type":"cv"},{"capabilities":["Segmentation"],"input_type":["yolo.jpeg.base64"],"mode":"yolo11s-seg","mode_param":{"cls_name":["person","bicycle","car","motorcycle","airplane","bus","train","truck","boat","traffic light","fire hydrant","stop sign","parking meter","bench","bird","cat","dog","horse","sheep","cow","elephant","bear","zebra","giraffe","backpack","umbrella","handbag","tie","suitcase","frisbee","skis","snowboard","sports ball","kite","baseball bat","baseball glove","skateboard","surfboard","tennis racket","bottle","wine glass","cup","fork","knife","spoon","bowl","banana","apple","sandwich","orange","broccoli","carrot","hot dog","pizza","donut","cake","chair","couch","potted plant","bed","dining table","toilet","tv","laptop","mouse","remote","keyboard","cell phone","microwave","oven","toaster","sink","refrigerator","book","clock","vase","scissors","teddy bear","hair drier","toothbrush"],"cls_num":80,"img_h":320,"img_w":320,"model_type":"segment","nms_threshold":0.45,"pron_threshold":0.45,"yolo_model":"yolo11n-seg.axmodel"},"mode_param_bak":{},"output_type":["yolo.yolobox"],"type":"cv"},{"capabilities":["Detection"],"input_type":["yolo.jpeg.base64"],"mode":"yolo11n","mode_param":{"cls_name":["person","bicycle","car","motorcycle","airplane","bus","train","truck","boat","traffic light","fire hydrant","stop sign","parking meter","bench","bird","cat","dog","horse","sheep","cow","elephant","bear","zebra","giraffe","backpack","umbrella","handbag","tie","suitcase","frisbee","skis","snowboard","sports ball","kite","baseball bat","baseball glove","skateboard","surfboard","tennis racket","bottle","wine glass","cup","fork","knife","spoon","bowl","banana","apple","sandwich","orange","broccoli","carrot","hot dog","pizza","donut","cake","chair","couch","potted plant","bed","dining table","toilet","tv","laptop","mouse","remote","keyboard","cell phone","microwave","oven","toaster","sink","refrigerator","book","clock","vase","scissors","teddy bear","hair drier","toothbrush"],"cls_num":80,"img_h":320,"img_w":320,"model_type":"detect","nms_threshold":0.45,"pron_threshold":0.45,"yolo_model":"yolo11n.axmodel"},"mode_param_bak":{},"output_type":["yolo.yolobox"],"type":"cv"}],"error":{"code":0,"message":""},"object":"sys.lsmode","request_id":"001","work_id":"sys"}

 整形しておく。なげーな...

root@m5stack-LLM:~# cat data.json | jq

{

"created": 1735102386,

"data": [

{

"capabilities": [

"tts"

],

"input_type": [

"tts.utf-8"

],

"mode": "melotts_zh-cn",

"mode_param": {

"audio_rate": 16000,

"awake_delay": 1000,

"decoder": "decoder.axmodel",

"encoder": "encoder.onnx",

"gbin": "g.bin",

"lexicon": "lexicon.txt",

"mode_rate": 44100,

"spacker_speed": 1,

"tokens": "tokens.txt"

},

"output_type": [

"tts.wav",

"sys.play.0_1"

],

"type": "tts"

},

{

"capabilities": [

"text_generation",

"chat"

],

"input_type": [

"llm.utf-8",

"llm.utf-8.stream",

"llm.chat_completion",

"llm.chat_completion.stream"

],

"mode": "qwen2.5-0.5B-prefill-20e",

"mode_param": {

"axmodel_num": 24,

"b_bos": false,

"b_dynamic_load_axmodel_layer": false,

"b_eos": false,

"b_use_mmap_load_embed": true,

"b_use_topk": false,

"filename_post_axmodel": "qwen2_post.axmodel",

"filename_tokenizer_model": "qwen.tiktoken",

"filename_tokens_embed": "model.embed_tokens.weight.bfloat16.bin",

"template_filename_axmodel": "qwen2_p128_l%d_together.axmodel",

"tokenizer_type": 1,

"tokens_embed_num": 151936,

"tokens_embed_size": 896

},

"output_type": [

"llm.utf-8",

"llm.utf-8.stream"

],

"type": "llm"

},

{

"capabilities": [

"Automatic_Speech_Recognition",

"English"

],

"input_type": [

"sys.pcm",

"sys.cap.0_0"

],

"mode": "sherpa-ncnn-streaming-zipformer-20M-2023-02-17",

"mode_param": {

"awake_delay": 50,

"enable_endpoint": true,

"endpoint_config.rule1.min_trailing_silence": 2.4,

"endpoint_config.rule2.min_trailing_silence": 1.2,

"endpoint_config.rule3.min_utterance_length": 30,

"feat_config.feature_dim": 80,

"feat_config.sampling_rate": 16000,

"model_config.decoder_bin": "decoder_jit_trace-pnnx.ncnn.bin",

"model_config.decoder_param": "decoder_jit_trace-pnnx.ncnn.param",

"model_config.encoder_bin": "encoder_jit_trace-pnnx.ncnn.bin",

"model_config.encoder_param": "encoder_jit_trace-pnnx.ncnn.param",

"model_config.joiner_bin": "joiner_jit_trace-pnnx.ncnn.bin",

"model_config.joiner_param": "joiner_jit_trace-pnnx.ncnn.param",

"model_config.tokens": "tokens.txt"

},

"mode_param_bak": {

"decoder_config.method": "greedy_search",

"decoder_config.num_active_paths": 4,

"endpoint_config.rule1.min_utterance_length": 0,

"endpoint_config.rule1.must_contain_nonsilence": false,

"endpoint_config.rule2.min_utterance_length": 0,

"endpoint_config.rule2.must_contain_nonsilence": true,

"endpoint_config.rule3.min_trailing_silence": 0,

"endpoint_config.rule3.must_contain_nonsilence": false,

"hotwords_file": "",

"hotwords_score": 1.5,

"model_config.decoder_opt.num_threads": 2,

"model_config.encoder_opt.num_threads": 2,

"model_config.joiner_opt.num_threads": 2

},

"output_type": [

"asr.utf-8",

"asr.bool"

],

"type": "asr"

},

{

"capabilities": [

"Automatic_Speech_Recognition",

"Chinese"

],

"input_type": [

"sys.pcm",

"sys.cap.0_0"

],

"mode": "sherpa-ncnn-streaming-zipformer-zh-14M-2023-02-23",

"mode_param": {

"awake_delay": 50,

"enable_endpoint": true,

"endpoint_config.rule1.min_trailing_silence": 2.4,

"endpoint_config.rule2.min_trailing_silence": 1.2,

"endpoint_config.rule3.min_utterance_length": 30,

"feat_config.feature_dim": 80,

"feat_config.sampling_rate": 16000,

"model_config.decoder_bin": "decoder_jit_trace-pnnx.ncnn.bin",

"model_config.decoder_param": "decoder_jit_trace-pnnx.ncnn.param",

"model_config.encoder_bin": "encoder_jit_trace-pnnx.ncnn.bin",

"model_config.encoder_param": "encoder_jit_trace-pnnx.ncnn.param",

"model_config.joiner_bin": "joiner_jit_trace-pnnx.ncnn.bin",

"model_config.joiner_param": "joiner_jit_trace-pnnx.ncnn.param",

"model_config.tokens": "tokens.txt"

},

"mode_param_bak": {

"decoder_config.method": "greedy_search",

"decoder_config.num_active_paths": 4,

"endpoint_config.rule1.min_utterance_length": 0,

"endpoint_config.rule1.must_contain_nonsilence": false,

"endpoint_config.rule2.min_utterance_length": 0,

"endpoint_config.rule2.must_contain_nonsilence": true,

"endpoint_config.rule3.min_trailing_silence": 0,

"endpoint_config.rule3.must_contain_nonsilence": false,

"hotwords_file": "",

"hotwords_score": 1.5,

"model_config.decoder_opt.num_threads": 2,

"model_config.encoder_opt.num_threads": 2,

"model_config.joiner_opt.num_threads": 2

},

"output_type": [

"asr.utf-8",

"asr.bool"

],

"type": "asr"

},

{

"capabilities": [

"Keyword_spotting",

"English"

],

"input_type": [

"sys.pcm",

"sys.cap.0_0"

],

"mode": "sherpa-onnx-kws-zipformer-gigaspeech-3.3M-2024-01-01",

"mode_param": {

"keywords_file": "keywords.txt",

"model_config.modeling_unit": "cjkchar",

"model_config.tokens": "tokens.txt",

"model_config.transducer.decoder": "decoder-epoch-12-avg-2-chunk-16-left-64.onnx",

"model_config.transducer.encoder": "encoder-epoch-12-avg-2-chunk-16-left-64.int8.onnx",

"model_config.transducer.joiner": "joiner-epoch-12-avg-2-chunk-16-left-64.int8.onnx",

"text2token-bpe-model": "bpe.model",

"text2token-tokens-type": "cjkchar+bpe",

"wake_wav_file": "/opt/m5stack/data/audio/wakeup_en_us.wav"

},

"mode_param_bak": {

"feat_config.dither": 0,

"feat_config.feature_dim": 80,

"feat_config.high_freq": -400,

"feat_config.low_freq": 20,

"feat_config.sampling_rate": 16000,

"keywords_file": "keywords.txt",

"keywords_score": 1,

"keywords_threshold": 0.25,

"max_active_paths": 4,

"model_config.bpe_vocab": "",

"model_config.debug": false,

"model_config.model_type": "",

"model_config.modeling_unit": "cjkchar",

"model_config.nemo_ctc.model": "",

"model_config.num_threads": 2,

"model_config.paraformer.decoder": "",

"model_config.paraformer.encoder": "",

"model_config.provider_config.cuda_config.cudnn_conv_algo_search": 1,

"model_config.provider_config.device": 0,

"model_config.provider_config.provider": "cpu",

"model_config.provider_config.trt_config.trt_detailed_build_log": false,

"model_config.provider_config.trt_config.trt_dump_subgraphs": false,

"model_config.provider_config.trt_config.trt_engine_cache_enable": true,

"model_config.provider_config.trt_config.trt_engine_cache_path": ".",

"model_config.provider_config.trt_config.trt_fp16_enable": true,

"model_config.provider_config.trt_config.trt_max_partition_iterations": 10,

"model_config.provider_config.trt_config.trt_max_workspace_size": 2147483647,

"model_config.provider_config.trt_config.trt_min_subgraph_size": 5,

"model_config.provider_config.trt_config.trt_timing_cache_enable": true,

"model_config.provider_config.trt_config.trt_timing_cache_path": ".",

"model_config.tokens": "tokens.txt",

"model_config.transducer.decoder": "decoder-epoch-12-avg-2-chunk-16-left-64.onnx",

"model_config.transducer.encoder": "encoder-epoch-12-avg-2-chunk-16-left-64.int8.onnx",

"model_config.transducer.joiner": "joiner-epoch-12-avg-2-chunk-16-left-64.int8.onnx",

"model_config.warm_up": 0,

"model_config.wenet_ctc.chunk_size": 16,

"model_config.wenet_ctc.model": "",

"model_config.wenet_ctc.num_left_chunks": 4,

"model_config.zipformer2_ctc.model": "",

"num_trailing_blanks": 1,

"text2token-bpe-model": "bpe.model",

"text2token-tokens-type": "cjkchar+bpe"

},

"output_type": [

"kws.bool"

],

"type": "kws"

},

{

"capabilities": [

"Keyword_spotting",

"Chinese"

],

"input_type": [

"sys.pcm",

"sys.cap.0_0"

],

"mode": "sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01",

"mode_param": {

"keywords_file": "keywords.txt",

"model_config.modeling_unit": "cjkchar",

"model_config.tokens": "tokens.txt",

"model_config.transducer.decoder": "decoder-epoch-12-avg-2-chunk-16-left-64.onnx",

"model_config.transducer.encoder": "encoder-epoch-12-avg-2-chunk-16-left-64.int8.onnx",

"model_config.transducer.joiner": "joiner-epoch-12-avg-2-chunk-16-left-64.int8.onnx",

"text2token-tokens-type": "ppinyin",

"wake_wav_file": "/opt/m5stack/data/audio/wakeup_zh_cn.wav"

},

"mode_param_bak": {

"feat_config.dither": 0,

"feat_config.feature_dim": 80,

"feat_config.high_freq": -400,

"feat_config.low_freq": 20,

"feat_config.sampling_rate": 16000,

"keywords_file": "keywords.txt",

"keywords_score": 1,

"keywords_threshold": 0.25,

"max_active_paths": 4,

"model_config.bpe_vocab": "",

"model_config.debug": false,

"model_config.model_type": "",

"model_config.modeling_unit": "cjkchar",

"model_config.nemo_ctc.model": "",

"model_config.num_threads": 1,

"model_config.paraformer.decoder": "",

"model_config.paraformer.encoder": "",

"model_config.provider_config.cuda_config.cudnn_conv_algo_search": 1,

"model_config.provider_config.device": 0,

"model_config.provider_config.provider": "cpu",

"model_config.provider_config.trt_config.trt_detailed_build_log": false,

"model_config.provider_config.trt_config.trt_dump_subgraphs": false,

"model_config.provider_config.trt_config.trt_engine_cache_enable": true,

"model_config.provider_config.trt_config.trt_engine_cache_path": ".",

"model_config.provider_config.trt_config.trt_fp16_enable": true,

"model_config.provider_config.trt_config.trt_max_partition_iterations": 10,

"model_config.provider_config.trt_config.trt_max_workspace_size": 2147483647,

"model_config.provider_config.trt_config.trt_min_subgraph_size": 5,

"model_config.provider_config.trt_config.trt_timing_cache_enable": true,

"model_config.provider_config.trt_config.trt_timing_cache_path": ".",

"model_config.tokens": "tokens.txt",

"model_config.transducer.decoder": "decoder-epoch-12-avg-2-chunk-16-left-64.onnx",

"model_config.transducer.encoder": "encoder-epoch-12-avg-2-chunk-16-left-64.int8.onnx",

"model_config.transducer.joiner": "joiner-epoch-12-avg-2-chunk-16-left-64.int8.onnx",

"model_config.warm_up": 0,

"model_config.wenet_ctc.chunk_size": 16,

"model_config.wenet_ctc.model": "",

"model_config.wenet_ctc.num_left_chunks": 4,

"model_config.zipformer2_ctc.model": "",

"num_trailing_blanks": 1,

"text2token-tokens-type": "ppinyin"

},

"output_type": [

"kws.bool"

],

"type": "kws"

},

{

"capabilities": [

"tts",

"English"

],

"input_type": [

"tts.utf-8"

],

"mode": "single_speaker_english_fast",

"mode_param": {

"awake_delay": 1000,

"ttsModelName": "single_speaker_english_fast.bin"

},

"output_type": [

"tts.wav",

"sys.play.0_1"

],

"type": "tts"

},

{

"capabilities": [

"tts",

"Chinese"

],

"input_type": [

"tts.utf-8"

],

"mode": "single_speaker_fast",

"mode_param": {

"awake_delay": 1000,

"ttsModelName": "single_speaker_fast.bin"

},

"output_type": [

"tts.wav",

"sys.play.0_1"

],

"type": "tts"

},

{

"capabilities": [

"Pose"

],

"input_type": [

"yolo.jpeg.base64"

],

"mode": "yolo11n-pose",

"mode_param": {

"cls_name": [

"person",

"bicycle",

"car",

"motorcycle",

"airplane",

"bus",

"train",

"truck",

"boat",

"traffic light",

"fire hydrant",

"stop sign",

"parking meter",

"bench",

"bird",

"cat",

"dog",

"horse",

"sheep",

"cow",

"elephant",

"bear",

"zebra",

"giraffe",

"backpack",

"umbrella",

"handbag",

"tie",

"suitcase",

"frisbee",

"skis",

"snowboard",

"sports ball",

"kite",

"baseball bat",

"baseball glove",

"skateboard",

"surfboard",

"tennis racket",

"bottle",

"wine glass",

"cup",

"fork",

"knife",

"spoon",

"bowl",

"banana",

"apple",

"sandwich",

"orange",

"broccoli",

"carrot",

"hot dog",

"pizza",

"donut",

"cake",

"chair",

"couch",

"potted plant",

"bed",

"dining table",

"toilet",

"tv",

"laptop",

"mouse",

"remote",

"keyboard",

"cell phone",

"microwave",

"oven",

"toaster",

"sink",

"refrigerator",

"book",

"clock",

"vase",

"scissors",

"teddy bear",

"hair drier",

"toothbrush"

],

"cls_num": 1,

"img_h": 320,

"img_w": 320,

"model_type": "pose",

"nms_threshold": 0.45,

"pron_threshold": 0.45,

"yolo_model": "yolo11n-pose.axmodel"

},

"mode_param_bak": {},

"output_type": [

"yolo.yolobox"

],

"type": "cv"

},

{

"capabilities": [

"Segmentation"

],

"input_type": [

"yolo.jpeg.base64"

],

"mode": "yolo11s-seg",

"mode_param": {

"cls_name": [

"person",

"bicycle",

"car",

"motorcycle",

"airplane",

"bus",

"train",

"truck",

"boat",

"traffic light",

"fire hydrant",

"stop sign",

"parking meter",

"bench",

"bird",

"cat",

"dog",

"horse",

"sheep",

"cow",

"elephant",

"bear",

"zebra",

"giraffe",

"backpack",

"umbrella",

"handbag",

"tie",

"suitcase",

"frisbee",

"skis",

"snowboard",

"sports ball",

"kite",

"baseball bat",

"baseball glove",

"skateboard",

"surfboard",

"tennis racket",

"bottle",

"wine glass",

"cup",

"fork",

"knife",

"spoon",

"bowl",

"banana",

"apple",

"sandwich",

"orange",

"broccoli",

"carrot",

"hot dog",

"pizza",

"donut",

"cake",

"chair",

"couch",

"potted plant",

"bed",

"dining table",

"toilet",

"tv",

"laptop",

"mouse",

"remote",

"keyboard",

"cell phone",

"microwave",

"oven",

"toaster",

"sink",

"refrigerator",

"book",

"clock",

"vase",

"scissors",

"teddy bear",

"hair drier",

"toothbrush"

],

"cls_num": 80,

"img_h": 320,

"img_w": 320,

"model_type": "segment",

"nms_threshold": 0.45,

"pron_threshold": 0.45,

"yolo_model": "yolo11n-seg.axmodel"

},

"mode_param_bak": {},

"output_type": [

"yolo.yolobox"

],

"type": "cv"

},

{

"capabilities": [

"Detection"

],

"input_type": [

"yolo.jpeg.base64"

],

"mode": "yolo11n",

"mode_param": {

"cls_name": [

"person",

"bicycle",

"car",

"motorcycle",

"airplane",

"bus",

"train",

"truck",

"boat",

"traffic light",

"fire hydrant",

"stop sign",

"parking meter",

"bench",

"bird",

"cat",

"dog",

"horse",

"sheep",

"cow",

"elephant",

"bear",

"zebra",

"giraffe",

"backpack",

"umbrella",

"handbag",

"tie",

"suitcase",

"frisbee",

"skis",

"snowboard",

"sports ball",

"kite",

"baseball bat",

"baseball glove",

"skateboard",

"surfboard",

"tennis racket",

"bottle",

"wine glass",

"cup",

"fork",

"knife",

"spoon",

"bowl",

"banana",

"apple",

"sandwich",

"orange",

"broccoli",

"carrot",

"hot dog",

"pizza",

"donut",

"cake",

"chair",

"couch",

"potted plant",

"bed",

"dining table",

"toilet",

"tv",

"laptop",

"mouse",

"remote",

"keyboard",

"cell phone",

"microwave",

"oven",

"toaster",

"sink",

"refrigerator",

"book",

"clock",

"vase",

"scissors",

"teddy bear",

"hair drier",

"toothbrush"

],

"cls_num": 80,

"img_h": 320,

"img_w": 320,

"model_type": "detect",

"nms_threshold": 0.45,

"pron_threshold": 0.45,

"yolo_model": "yolo11n.axmodel"

},

"mode_param_bak": {},

"output_type": [

"yolo.yolobox"

],

"type": "cv"

}

],

"error": {

"code": 0,

"message": ""

},

"object": "sys.lsmode",

"request_id": "001",

"work_id": "sys"

}


オリジナル投稿:
M5stack LLM Module買う -4-|kinneko|pixivFANBOX
https://kinneko.fanbox.cc/posts/9088305