![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
Googleが公開したローカルLLMのgemma.cppをLinuxとAndroidのTermuxで動かしてみた。とりあえず2bだけど日本語で返事が帰ってくる程度に賢い。llama.cppでGGUF版があるけどこちらもチャット形式で良い。NetBSD上でもビルドし動作しました
-
kapper1224
- 12072
- 22
- 47
- 4
![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
Googleが公開したローカルLLMのgemma.cppを参考サイトを見ながら動かしてみた。先駆者に感謝 とりあえず2bだけど日本語で返事が帰ってくる程度に賢い。llama.cppでGGUF版があるけどこちらもチャット形式で良い note.com/ngc_shj/n/n3f5… pic.twitter.com/8bfoGYRrnF
2024-02-26 22:28:22![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
Gemma.cppの使い方はまずこちらかGemma C++のタブからモデルデータを2b-it-sfpか7b-it-sfpを選択肢、右側アイコンよりダウンロードしarchive.tar.gzのファイル名にてホームフォルダかどこかに保存 kaggle.com/models/google/… pic.twitter.com/9TRRRmflSt
2024-02-27 02:06:29![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
次にGithubからgit cloneしてenv git clone github.com/google/gemma.c… gemma.cpp python3 -m venv env/ source env/bin/activate
2024-02-27 02:08:32![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
先程ダウンロードしたモデルデータを展開。ひとまず2b-it-sfpとする。7bの場合は2bの文字を修正 mkdir 2b-it-sfp tar zxvf ../archive.tar.gz -C 2b-it-sfp/
2024-02-27 02:10:17![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
入れ忘れた ソースコードをビルドする cmake -B build cd build make gemma cd .. ./build/gemma --tokenizer ./2b-it-sfp/tokenizer.spm --compressed_weights ./2b-it-sfp/2b-it-sfp.sbs --model 2b-it ファイル名が無いよエラーが出たらモデルデータのファイルとダウンロード確認
2024-02-27 05:26:22![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
という事で動いた。 pic.twitter.com/2cGJ9QuXvw
2024-02-27 04:41:57![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
なお、Gemmaで検索するとGGUFモデルも沢山変換されているのでllama.cppでも使用できる huggingface.co/models?search=… pic.twitter.com/AAZkkvoNwm
2024-02-27 04:59:13![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
もちろんAndroidのTermux上でもGemma.cpp動いた 問題無し。 pic.twitter.com/ikCBsLbDFF
2024-02-27 05:31:24![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
QemuのNetBSD上でもGemma.cppをビルド出来ました pic.twitter.com/N52LjwvvFZ
2024-02-27 07:27:04![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
Qemu上のNetBSDにSCPファイル転送 NetBSD側ユーザー追加、/etc/ssh/ssh_configを編集、#PasswordAuthentication yesのコメントアウト Qemu起動時に-net user,ipv6=off,hostfwd=tcp::60022-:22 へ修正し60022をQemu上の22に scp -P 60022 archive.tar.gz 127.0.0.1:/home/kapper でscp接続転送 pic.twitter.com/kab6JkNC5x
2024-02-27 19:57:42![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
Qemu上のNetBSDへモデルデータを転送・解凍して、そのままGemma.cppを起動。 無事動作しました・・・ コマンドは他と同じです。GoodJB pic.twitter.com/pFyJXROatW
2024-02-27 20:20:47![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)