<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[LLM module. how to use another llm model ?]]></title><description><![CDATA[<p dir="auto">Hi Everyone,</p>
<p dir="auto">I am new to the module.<br />
Want to switch llm model as new are available<br />
( ex: llama3.2-1b-prefill-ax630c or qwen2.5-1.5b-ax630c )<br />
in short can't succed to load other model</p>
<p dir="auto">Any suggestions ? or pointing to the proper documentation ? ( did not find any topic regarding changing model via Arduino )</p>
<hr />
<p dir="auto">What I did so far ?</p>
<ul>
<li>log into the llm module via serial</li>
<li>ip a</li>
<li>connect via ssh root@ip  (via the ethernet  compagnon board )</li>
<li>load my ssh public key and then ssh</li>
<li>proceed succesfully to install other models via apt-get install xxx</li>
<li>reboot (just in case )</li>
</ul>
<p dir="auto">Then test via serial text ( via a M5STACK core grey, with a simple forward serial &gt; serial2 app)<br />
the sequence :</p>
<p dir="auto">reset :</p>
<p dir="auto">{     "request_id": "11212155",         "work_id": "sys",             "action": "reset" }<br />
{"created":1746310691,"data":"None","error":{"code":0,"message":"llm server restarting ..."},"object":"None","request_id":"11212155","work_id":"sys"}<br />
{"request_id": "0","work_id": "sys","created": 1746310696,"error":{"code":0, "message":"reset over"}}<br />
then...</p>
<p dir="auto">load model :</p>
<p dir="auto">{     "request_id": "3",     "work_id": "llm",     "action": "setup","object": "llm.setup",     "data": {         "model": "qwen2.5-1.5b-ax630c",         "response_format": "llm.utf-8.stream",         "input": "llm.utf-8",         "enoutput": true,         "max_token_len": 256,         "prompt": "You are a knowledgeable assistant capable of answering various questions and providing information."         } }<br />
{"created":1746310710,"data":"None","error":{"code":-5,"message":"Model loading failed."},"object":"None","request_id":"3","work_id":"llm"}</p>
<p dir="auto">but it works with...</p>
<p dir="auto">{     "request_id": "3",     "work_id": "llm",     "action": "setup",     "object": "llm.setup",     "data": {         "model": "qwen2.5-0.5B-prefill-20e",         "response_format": "llm.utf-8.stream",         "input": "llm.utf-8",         "enoutput": true,         "max_token_len": 256,         "prompt": "You are a knowledgeable assistant capable of answering various questions and providing information."     } }<br />
{"created":1746310813,"data":"None","error":{"code":0,"message":""},"object":"None","request_id":"3","work_id":"llm.1004"}</p>
]]></description><link>https://community.m5stack.com/topic/7542/llm-module-how-to-use-another-llm-model</link><generator>RSS for Node</generator><lastBuildDate>Fri, 17 Apr 2026 21:54:49 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/7542.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 03 May 2025 22:40:39 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to LLM module. how to use another llm model ? on Sat, 10 May 2025 03:49:00 GMT]]></title><description><![CDATA[<p dir="auto"><img src="/assets/uploads/files/1746848937516-screen-capture-m5core-webserial.png" alt="screen capture M5core Webserial.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.m5stack.com/post/29045</link><guid isPermaLink="true">https://community.m5stack.com/post/29045</guid><dc:creator><![CDATA[erictiquet]]></dc:creator><pubDate>Sat, 10 May 2025 03:49:00 GMT</pubDate></item><item><title><![CDATA[Reply to LLM module. how to use another llm model ? on Sat, 10 May 2025 03:46:58 GMT]]></title><description><![CDATA[<p dir="auto">the .ino code I used :</p>
<p dir="auto">#include &lt;Arduino.h&gt;<br />
#include &lt;M5Unified.h&gt;<br />
#include &lt;WiFi.h&gt;<br />
#include &lt;WebServer.h&gt;</p>
<p dir="auto">// ⚙️ Configuration WiFi<br />
const char* ssid = "you ssid";<br />
const char* password = "you password";</p>
<p dir="auto">// UART2 pour le module LLM<br />
HardwareSerial LLM(2); // GPIO16 = RX, GPIO17 = TX</p>
<p dir="auto">WebServer server(80);<br />
String lastSerialMessage = "";</p>
<p dir="auto">// 🔐 Encodage simple pour éviter les problèmes d’affichage HTML<br />
String htmlEscape(String text) {<br />
text.replace("&amp;", "&amp;");<br />
text.replace("&lt;", "&lt;");<br />
text.replace("&gt;", "&gt;");<br />
text.replace(""", """);<br />
text.replace("'", "'");<br />
return text;<br />
}</p>
<p dir="auto">// 💻 Page HTML dynamique<br />
String getHTMLPage() {<br />
String html = R"rawliteral(<br />
&lt;!DOCTYPE html&gt;<br />
&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;meta charset="UTF-8"&gt;<br />
&lt;title&gt;M5Core Web Serial&lt;/title&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
&lt;h1&gt;M5Core Web Serial&lt;/h1&gt;<br />
&lt;textarea id="msg" rows="15" cols="70" placeholder="Votre message ici..."&gt;&lt;/textarea&gt;&lt;br&gt;<br />
&lt;button onclick="sendMessage()"&gt;Envoyer&lt;/button&gt;<br />
&lt;button onclick="clearOutput()"&gt;Effacer&lt;/button&gt;<br />
&lt;p&gt;&lt;strong&gt;Réponse série :&lt;/strong&gt;&lt;/p&gt;<br />
&lt;pre id="lastMessage" style="background:#eee; padding:10px; border:1px solid #ccc;"&gt;&lt;/pre&gt;</p>
<pre><code>  &lt;script&gt;
    function sendMessage() {
      const msg = document.getElementById("msg").value;
      fetch("/send", {
        method: "POST",
        headers: { "Content-Type": "application/x-www-form-urlencoded" },
        body: "msg=" + encodeURIComponent(msg)
      }).then(response =&gt; response.text())
        .then(text =&gt; {
          document.getElementById("lastMessage").innerText = text;
        });
    }

    function clearOutput() {
      fetch("/clear").then(r =&gt; r.text()).then(txt =&gt; {
        document.getElementById("lastMessage").innerText = "";
      });
    }

    setInterval(() =&gt; {
      fetch("/last").then(r =&gt; r.text()).then(txt =&gt; {
        document.getElementById("lastMessage").innerText = txt;
      });
    }, 2000);
  &lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
<p dir="auto">)rawliteral";<br />
html.replace("%LAST_MESSAGE%", htmlEscape(lastSerialMessage));<br />
return html;<br />
}</p>
<p dir="auto">void handleRoot() {<br />
server.send(200, "text/html", getHTMLPage());<br />
}</p>
<p dir="auto">void handleSend() {<br />
if (server.hasArg("msg")) {<br />
String msg = server.arg("msg");<br />
LLM.println(msg);<br />
lastSerialMessage = "Envoyé : " + msg;<br />
server.send(200, "text/plain", "Envoyé : " + msg);<br />
} else {<br />
server.send(400, "text/plain", "Argument 'msg' manquant");<br />
}<br />
}</p>
<p dir="auto">void handleLast() {<br />
server.send(200, "text/plain", lastSerialMessage);<br />
}</p>
<p dir="auto">void handleClear() {<br />
lastSerialMessage = "";<br />
server.send(200, "text/plain", "Effacé");<br />
}</p>
<p dir="auto">void setup() {<br />
M5.begin();<br />
M5.Lcd.setTextSize(2);<br />
M5.Lcd.println("Initialisation...");</p>
<p dir="auto">Serial.begin(115200);                    // PC USB<br />
LLM.begin(115200, SERIAL_8N1, 16, 17);   // RX2, TX2</p>
<p dir="auto">WiFi.begin(ssid, password);<br />
M5.Lcd.print("Connexion WiFi");<br />
while (WiFi.status() != WL_CONNECTED) {<br />
delay(500);<br />
M5.Lcd.print(".");<br />
}</p>
<p dir="auto">M5.Lcd.println("\nConnecté");<br />
M5.Lcd.println(WiFi.localIP());</p>
<p dir="auto">server.on("/", handleRoot);<br />
server.on("/send", HTTP_POST, handleSend);<br />
server.on("/last", handleLast);<br />
server.on("/clear", handleClear);<br />
server.begin();<br />
M5.Lcd.println("Serveur web actif !");<br />
}</p>
<p dir="auto">void loop() {<br />
server.handleClient();</p>
<p dir="auto">if (Serial.available()) {<br />
char c = Serial.read();<br />
LLM.write(c);<br />
Serial.print(c);<br />
}</p>
<p dir="auto">if (LLM.available()) {<br />
char c = LLM.read();<br />
Serial.print(c);<br />
lastSerialMessage += c;<br />
M5.Lcd.print(c);</p>
<pre><code>if (lastSerialMessage.length() &gt; 20000) {
  lastSerialMessage = lastSerialMessage.substring(lastSerialMessage.length() - 20000);
}
</code></pre>
<p dir="auto">}<br />
}</p>
]]></description><link>https://community.m5stack.com/post/29044</link><guid isPermaLink="true">https://community.m5stack.com/post/29044</guid><dc:creator><![CDATA[erictiquet]]></dc:creator><pubDate>Sat, 10 May 2025 03:46:58 GMT</pubDate></item><item><title><![CDATA[Reply to LLM module. how to use another llm model ? on Sat, 10 May 2025 03:46:05 GMT]]></title><description><![CDATA[<p dir="auto">Hello Kuriko, Everyone,</p>
<p dir="auto">Found the solutions ;)</p>
<p dir="auto">The best help came from :</p>
<ul>
<li><a href="http://chat.m5stack.com" target="_blank" rel="noopener noreferrer nofollow ugc">chat.m5stack.com</a> ( support you guys for making it stable )</li>
<li>chatgtp to write a little arduino ino code that display a web page. ( you've got the code below )</li>
<li>and the following page for the llm json syntax : ( that's what is exchange in the dialog )<br />
<a href="https://github.com/m5stack/StackFlow/blob/main/doc/projects_llm_framework_doc/llm_llm_en.md" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/m5stack/StackFlow/blob/main/doc/projects_llm_framework_doc/llm_llm_en.md</a></li>
</ul>
<p dir="auto">** First install the new models, they should appear in /opt/m5stack/data/</p>
<blockquote>
<p dir="auto">Connect via SSH: (as a normal linux server)</p>
</blockquote>
<ul>
<li>require that you plug the RJ45 and access the debug port via serial and type "ip a " to get the IP, or that you can sniff your dhcp server</li>
<li>to be safe and ease the work, suggest you upload your ssh-key on the llm module ( ssh-copy-id )</li>
<li>the default login is root@&lt;your ip&gt; and password "123456", change it after loading you key successfully.</li>
</ul>
<p dir="auto">**Then install the new models :  (for example)<br />
apt-get install llm-model-llama3.2-1b-prefill-ax630c llm-model-qwen2.5-1.5b-p256-ax630c</p>
<blockquote>
<p dir="auto">you should see something like :</p>
</blockquote>
<p dir="auto">root@m5stack-LLM:/# ls -la /opt/m5stack/data<br />
total 68<br />
drwxrwxr-x 17 root root 4096 May  4 07:23 .<br />
drwxrwxr-x  7 root root 4096 Feb 20 21:24 ..<br />
drwxrwxr-x  2 root root 4096 Dec  5 17:03 audio<br />
drwxrwxr-x  3 1000 1000 4096 May  4 04:48 llama3.2-1B-prefill-ax630c<br />
drwxrwxr-x  2 root root 4096 Dec  5 17:03 melotts_zh-cn<br />
drwxrwxr-x  2 root root 4096 May  4 07:25 models<br />
drwxrwxr-x  2 1000 1000 4096 May  4 05:50 qwen2.5-0.5B-prefill-20e<br />
drwxr-xr-x  3 1000 1000 4096 May  4 04:49 qwen2.5-1.5B-p256-ax630c<br />
drwxrwxr-x  2 root root 4096 Dec  5 17:03 sherpa-ncnn-streaming-zipformer-20M-2023-02-17<br />
drwxrwxr-x  2 root root 4096 Dec  5 17:03 sherpa-ncnn-streaming-zipformer-zh-14M-2023-02-23<br />
drwxrwxr-x  2 root root 4096 Dec  5 17:03 sherpa-onnx-kws-zipformer-gigaspeech-3.3M-2024-01-01<br />
drwxrwxr-x  2 root root 4096 Dec  5 17:03 sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01<br />
drwxrwxr-x  2 root root 4096 Dec  5 17:03 single_speaker_english_fast<br />
drwxrwxr-x  2 root root 4096 Dec  5 17:03 single_speaker_fast<br />
drwxrwxr-x  2 root root 4096 Dec  5 17:03 yolo11n<br />
drwxrwxr-x  2 root root 4096 Dec  5 17:03 yolo11n-pose<br />
drwxrwxr-x  2 root root 4096 Dec  5 17:03 yolo11n-seg</p>
<blockquote>
<p dir="auto">watch out the mmc space with "df" command", with 2 more models you are reaching 74% of the avail space.<br />
(another topic to tackle how to use and sdcard for additional storage space.. )</p>
</blockquote>
<p dir="auto">root@m5stack-LLM:/# df<br />
Filesystem     1K-blocks     Used Available Use% Mounted on<br />
/dev/root       29289340 21660980   7611976  74% /<br />
tmpfs             490876        0    490876   0% /dev/shm<br />
tmpfs             196352      876    195476   1% /run<br />
tmpfs               5120        0      5120   0% /run/lock<br />
tmpfs             490876        0    490876   0% /tmp<br />
/dev/mmcblk1p1  30554112     3424  30550688   1% /mnt/mmcblk1p1<br />
tmpfs              98172        0     98172   0% /run/user/0<br />
root@m5stack-LLM:/#</p>
<blockquote>
<p dir="auto">Then to use it, just name the llm name with the name of the model install in the folder<br />
ex : llama3.2-1B-prefill-ax630c<br />
To play with the model you could use ino page and enter the following json :</p>
</blockquote>
<p dir="auto">{<br />
"request_id": "2",<br />
"work_id": "llm",<br />
"action": "setup",<br />
"object": "llm.setup",<br />
"data": {<br />
"model": "llama3.2-1B-prefill-ax630c",<br />
"response_format": "llm.utf-8.stream",<br />
"input": "llm.utf-8",<br />
"enoutput": true,<br />
"max_token_len": 256,<br />
"prompt": "You are a helpful AI assistant."<br />
}<br />
}</p>
<blockquote>
<p dir="auto">should receive the following return code like :</p>
</blockquote>
<p dir="auto">{"created":1746846795,"data":"None","error":{"code":0,"message":""},"object":"None","request_id":"2","work_id":"llm.1004"}</p>
<blockquote>
<p dir="auto">pick the last value like "llm.xxxx" and create a prompt :</p>
</blockquote>
<p dir="auto">{<br />
"request_id": "2",<br />
"work_id": "llm.xxxx",<br />
"action": "inference",<br />
"object": "llm.utf-8.stream",<br />
"data": {<br />
"delta": "What's ur name?",<br />
"index": 0,<br />
"finish": true<br />
}<br />
}</p>
<blockquote>
<p dir="auto">then you will see something like... :</p>
</blockquote>
<p dir="auto">{"created":1746846972,"data":{"delta":"I'm an","finish":false,"index":0},"error":{"code":0,"message":""},"object":"llm.utf-8.stream","request_id":"2","work_id":"llm.1004"}<br />
{"created":1746846973,"data":{"delta":" artificial intelligence model","finish":false,"index":1},"error":{"code":0,"message":""},"object":"llm.utf-8.stream","request_id":"2","work_id":"llm.1004"}<br />
{"created":1746846974,"data":{"delta":" known as L","finish":false,"index":2},"error":{"code":0,"message":""},"object":"llm.utf-8.stream","request_id":"2","work_id":"llm.1004"}<br />
{"created":1746846974,"data":{"delta":"lama. L","finish":false,"index":3},"error":{"code":0,"message":""},"object":"llm.utf-8.stream","request_id":"2","work_id":"llm.1004"}<br />
{"created":1746846975,"data":{"delta":"lama stands for","finish":false,"index":4},"error":{"code":0,"message":""},"object":"llm.utf-8.stream","request_id":"2","work_id":"llm.1004"}<br />
{"created":1746846976,"data":{"delta":" "Large Language","finish":false,"index":5},"error":{"code":0,"message":""},"object":"llm.utf-8.stream","request_id":"2","work_id":"llm.1004"}<br />
{"created":1746846976,"data":{"delta":" Model Meta AI","finish":false,"index":6},"error":{"code":0,"message":""},"object":"llm.utf-8.stream","request_id":"2","work_id":"llm.1004"}<br />
{"created":1746846977,"data":{"delta":"."","finish":false,"index":7},"error":{"code":0,"message":""},"object":"llm.utf-8.stream","request_id":"2","work_id":"llm.1004"}<br />
{"created":1746846977,"data":{"delta":"","finish":true,"index":8},"error":{"code":0,"message":""},"object":"llm.utf-8.stream","request_id":"2","work_id":"llm.1004"}</p>
<p dir="auto">et voilà.</p>
]]></description><link>https://community.m5stack.com/post/29043</link><guid isPermaLink="true">https://community.m5stack.com/post/29043</guid><dc:creator><![CDATA[erictiquet]]></dc:creator><pubDate>Sat, 10 May 2025 03:46:05 GMT</pubDate></item><item><title><![CDATA[Reply to LLM module. how to use another llm model ? on Mon, 05 May 2025 00:03:55 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/41327">@erictiquet</a><br />
have you check this:<br />
<a href="https://pulsar2-docs.readthedocs.io/en/latest/appendix/build_llm.html" target="_blank" rel="noopener noreferrer nofollow ugc">https://pulsar2-docs.readthedocs.io/en/latest/appendix/build_llm.html</a></p>
]]></description><link>https://community.m5stack.com/post/29028</link><guid isPermaLink="true">https://community.m5stack.com/post/29028</guid><dc:creator><![CDATA[kuriko]]></dc:creator><pubDate>Mon, 05 May 2025 00:03:55 GMT</pubDate></item></channel></rss>