2026年10月27日火曜日

M2 pro mac mini + ollama + strix メモ

M2 pro mac mini + ollama + strix メモ

概要

結論としてはまともに動きません
公式にもありますがやはり 70b レベルのモデルが必要です

Compatibility Note: Strix relies on advanced agentic capabilities (tool use, multi-step planning, self-correction). Most local models, especially those under 70B parameters, struggle with these complex tasks.
For critical assessments, we strongly recommend using state-of-the-art cloud models like Claude 4.5 Sonnet or GPT-5. Use local models only when privacy is the absolute priority.

自分で検証した結果を記載します
どのモデルもコンテキストサイズは8192でnum_predictは-1に設定しています

環境

  • macOS 26.6.2
  • ollama 0.40.8

qwen3-vl:8b

time=2026-10-26T16:17:55.276+09:00 level=WARN source=qwen3vl.go:97 msg="qwen tool call parsing failed" error="invalid character 'X' looking for beginning of value"

でエラー

qwen3.5:9b-mlx

panic: mlx: [METAL] Command buffer execution failed: Insufficient Memory (00000008:kIOGPUCommandBufferCallbackErrorOutOfMemory). at mlx/c/transforms.cpp:73

でエラー

qwen3.5:4b-mlx

[GIN] 2026/10/26 - 18:44:01 | 500 |          5m0s |   192.168.1.100 | POST     "/api/chat"

でエラー

最後に

もう少し頑張りたい気もしますが厳しい状況です
最後の 500 エラーは推論時間が長過ぎるエラーなので何かしらのパラメータで調整できないか調査しています

2026年10月26日月曜日

strix + local ollama + qwen3-vl:8b

strix + local ollama + qwen3-vl:8b

概要

とりあえず動くけどマシンスペックかなりいります

環境

  • ollama 0.40.6
  • strix 1.7.0
  • Ubuntu 24.04

pull

  • ollama pull qwen3-vl:8b

ollama のコンテキストサイズは 65536 です

実行

  • export STRIX_LLM="ollama/qwen3-vl:8b"
  • export LLM_API_BASE="http://localhost:11434"
  • strix --target .

最後に

一応これで動きます
8b レベルだとそこまで精度が出ないのでスペックに余裕がある場合はもっとパラメータの多いモデルを使いましょう
strix 的にはローカル LLM では qwen がオススメのようです

参考サイト

2026年10月25日日曜日

ollama で num_predict を設定する方法

ollama で num_predict を設定する方法

概要

num_predict を設定しないと出力が途中で途切れてしまうので設定しましょう
おもに2つあります

環境

  • macOS 26.6.2
  • ollama 0.40.8

方法1: API をコールする

curl -s http://localhost:11434/api/generate \
  -H 'Content-Type: application/json' \
  -d "$(jq -n \
    --arg model 'gemma4' \
    --arg prompt 'このファイルの内容を要約してください' \
    --arg content "$(cat scripts/test.py)" \
    '{
      model: $model,
      prompt: ($prompt + "\n\n以下がファイルの内容です。\n\n" + $content),
      think: true,
      stream: false,
      options: {
        num_predict: -1
      }
    }')" \
  | jq -r '.response' > output.txt

方法2: カスタムモデルの作成

  • ollama run gemma4

インタラクティブモードに入る

  • /set parameter num_predict -1
  • /save my/gemma4

インタラクティブモードを抜けて保存したモデル名で実行する

  • ollama run my/gemma4

方法2 は Modelfile を使っても OK です

最後に

コンテキストサイズは環境変数で設定可能ですが出力サイズは環境変数で設定できないので注意です

2026年10月24日土曜日

Mac 上の ollama でコンテキストサイズを変更する方法

Mac 上の ollama でコンテキストサイズを変更する方法

概要

.env を変更しましょう
前回も紹介していますが方法が変わっていました

環境

  • macOS 26.6.2
  • ollama 0.40.5

env ファイル作成

OLLAMA_CONTEXT_LENGTH を追加します

  • mkdir -p ~/.homebrew/services
  • vim ~/.homebrew/services/ollama.env
OLLAMA_CONTEXT_LENGTH=10240

再起動

  • brew services restart ollama

これで ~/Library/LaunchAgents/sh.brew.ollama.plist が動的に生成されます

動作確認

適当に ollama run で起動し何か話かけて ollama ps で Context Size を確認しましょう

最後に

コンテキストサイズを大きくしたほうがエージェントが柔軟に動けます
ただしメモリが必要になります

2026年10月23日金曜日

Codex CLI を ssh したサーバ上の tmux 上で実行している場合に会話の履歴を過去にたどる方法

Codex CLI を ssh したサーバ上の tmux 上で実行している場合に会話の履歴を過去にたどる方法

概要

esc キーで Browsing transcript になるのであとは上下キーでレスポンスの履歴を確認できます

環境

  • Ubuntu 24.04
  • codex cli 0.163.0

最後に

tmux 上でコピーモードしても codex cli を実行する以前のシェルの履歴しか辿れないのでちゃんと codex cli の機能を使いましょう

2026年10月22日木曜日

Codex CLI + ollama + gemma4 設定メモ

Codex CLI + ollama + gemma4 設定メモ

概要

大事なのはコンテキストでした

環境

  • Ubuntu 24.04
  • 8vCPU 32GBメモリ
  • gemma4:26b

ollama インストール

  • curl -fsSL https://ollama.com/install.sh | sh

codex インストール

  • curl -fsSL https://chatgpt.com/codex/install.sh | sh

モデルダウンロード

  • ollama pull gemma4:26b

ollama 設定

  • sudo systemctl edit ollama.service
### Editing /etc/systemd/system/ollama.service.d/override.conf
### Anything between here and the comment below will become the contents of the drop-in file

[Service]
Environment="OLLAMA_CONTEXT_LENGTH=66536"


### Edits below this comment will be discarded


### /etc/systemd/system/ollama.service
# [Unit]
# Description=Ollama Service
# After=network-online.target
#
# [Service]
# ExecStart=/usr/local/bin/ollama serve
# User=ollama
# Group=ollama
# Restart=always
# RestartSec=3
# Environment="PATH="
#
# [Install]
# WantedBy=default.target
  • sudo systemctl daemon-reload
  • sudo systemctl restart ollama

サンドボックス設定

codex 起動

  • ollama launch codex

で gemma4:26b を選択

動作確認

あとは命令するだけです
コンテキストを長くしないと codex cli が命令を実行してくれません

最後に

メモリが十分にないとコンテキストを64kにできないのでメモリを潤沢にしましょう

2026年10月21日水曜日

apt の gpg キーを更新しよう

apt の gpg キーを更新しよう

概要

サードパーティのリポジトリを追加している場合は gpg キーが定期的に更新される場合があるので更新してあげましょう

環境

  • Ubuntu 24.04

エラーログ

Get:1 https://cli.github.com/packages stable InRelease [3,917 B]
Hit:2 https://aquasecurity.github.io/trivy-repo/deb generic InRelease
Err:1 https://cli.github.com/packages stable InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 5612B36462313325
Hit:3 https://download.docker.com/linux/ubuntu noble InRelease
Get:4 https://apt.releases.hashicorp.com noble InRelease [12.8 kB]
Err:4 https://apt.releases.hashicorp.com noble InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY FC9CA96ACA026560
Hit:5 http://repo.mysql.com/apt/ubuntu noble InRelease
Hit:6 http://security.ubuntu.com/ubuntu noble-security InRelease
Hit:7 http://archive.ubuntu.com/ubuntu noble InRelease
Hit:8 http://archive.ubuntu.com/ubuntu noble-updates InRelease
Hit:9 https://ppa.launchpadcontent.net/ansible/ansible/ubuntu noble InRelease
Hit:10 https://ppa.launchpadcontent.net/git-core/ppa/ubuntu noble InRelease
Get:11 https://esm.ubuntu.com/apps/ubuntu noble-apps-security InRelease [8,371 B]
Get:12 https://esm.ubuntu.com/apps/ubuntu noble-apps-updates InRelease [8,220 B]
Get:13 https://esm.ubuntu.com/infra/ubuntu noble-infra-security InRelease [8,235 B]
Get:14 https://esm.ubuntu.com/infra/ubuntu noble-infra-updates InRelease [8,213 B]
Fetched 49.8 kB in 4s (12.9 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
3 packages can be upgraded. Run 'apt list --upgradable' to see them.
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://cli.github.com/packages stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 5612B36462313325
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://apt.releases.hashicorp.com noble InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY FC9CA96ACA026560
W: Failed to fetch https://cli.github.com/packages/dists/stable/InRelease  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 5612B36462313325
W: Failed to fetch https://apt.releases.hashicorp.com/dists/noble/InRelease  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY FC9CA96ACA026560
W: Some index files failed to download. They have been ignored, or old ones used instead.

更新コマンド

# GitHub CLIの署名鍵を更新
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
  | sudo install -o root -g root -m 0644 /dev/stdin \
    /etc/apt/keyrings/githubcli-archive-keyring.gpg

# HashiCorpの署名鍵を更新
curl -fsSL https://apt.releases.hashicorp.com/gpg \
  | gpg --dearmor \
  | sudo install -o root -g root -m 0644 /dev/stdin \
    /usr/share/keyrings/hashicorp-archive-keyring.gpg

# 動作確認
sudo apt-get update

最後に

今回は github と hashicorp でしたが他でも同様に更新が必要になるケースがあります