Skip to content

Commit 4b02f04

Browse files
committed
v1.0.45: メモリ使用の自動調整(num_ctx を RAM に連動: 8GB未満=2048/8-16GB=4096/16GB以上=8192)+モデル選択画面とREADMEにメモリ案内を追加(他アプリへの影響を抑制)
1 parent 17fbadb commit 4b02f04

3 files changed

Lines changed: 25 additions & 5 deletions

File tree

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,20 @@
2424
- 空き容量 15GB 以上
2525
- インストール時のみインターネット接続(Ollama本体1.5GB+AIモデル約3.4GBなど、**合計約6GB**のダウンロードのため。所要約30〜90分)
2626

27+
## メモリ使用量と他アプリへの影響
28+
29+
AI モデルの実行にはメモリを使用しますが、**他のアプリへの影響を抑えるための自動調整**が入っています:
30+
31+
| 項目 | 内容 |
32+
|------|------|
33+
| モデルの同時常駐 | 1つに制限(LLM と検索用モデルは切り替え方式) |
34+
| 並列処理 | 1リクエストずつ処理(KV キャッシュのメモリを節約) |
35+
| コンテキストサイズ | RAM に応じて自動調整(8GB未満=2048 / 8〜16GB=4096 / 16GB以上=8192) |
36+
| アプリを閉じたとき | モデルを即アンロードしメモリを解放 |
37+
| モデル選択 | メモリが少ない PC では「軽量(1.5b)」を選ぶと使用量約1GBに抑制 |
38+
39+
目安: 推奨モデル(3b・RAM 8〜16GB)の使用メモリは **約2GB** です。8GB メモリの PC で他のアプリを多用する場合は、軽量モデル(1.5b・約1GB)を選択してください。
40+
2741
## ダウンロード
2842

2943
[![Latest Release](https://img.shields.io/github/v/release/Shineos/shineos-qa-assistant?sort=semver&label=Latest%20Release)](https://github.com/Shineos/shineos-qa-assistant/releases/latest)

installer/installer.iss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
; ============================================================================
1010

1111
#define MyAppName "社内知恵袋"
12-
#define MyAppVersion "1.0.44"
12+
#define MyAppVersion "1.0.45"
1313
#define MyAppPublisher "Shineos Inc."
1414
#define MyAppURL "https://shineos.com"
1515
#define MyAppExeName "open-webui.exe"
@@ -185,7 +185,7 @@ begin
185185
'AIモデルの選択',
186186
'インストールするAIモデルを選択してください',
187187
'検出メモリ: ' + IntToStr(RamGB) + ' GB。使用ポート: ' + IntToStr(SelectedPort) + '(8080 が空いていれば 8080)。' + #13#10 +
188-
'動作が重い場合は下の「軽量」を選択してください。',
188+
'メモリが少ない PC では「軽量」を選ぶと、他のアプリへの影響を抑えられます。動作が重い場合は下の「軽量」を選択してください。',
189189
True, False);
190190
ModelPage.Add('qwen2.5:3b(推奨) 高速・確実・約1.9GB・応答約1秒(8GB機でも快適)');
191191
ModelPage.Add('qwen2.5:7b(高品質) 16GB以上のメモリ推奨・約4.7GB・応答数秒');
@@ -365,7 +365,7 @@ begin
365365
366366
{ AIモデル設定(qwen3系の思考モード無効化とコンテキスト長の最適化) }
367367
ProgressPage.SetText('AIモデルを設定しています...', '');
368-
if not (RunPowerShell('configure_model.ps1', '-BaseUrl "http://localhost:' + IntToStr(SelectedPort) + '" -Model "' + SelectedModel + '" -LogFile "' + AppDir + '\logs\configure_model.log"', RC) and (RC = 0)) then
368+
if not (RunPowerShell('configure_model.ps1', '-BaseUrl "http://localhost:' + IntToStr(SelectedPort) + '" -Model "' + SelectedModel + '" -RamGB ' + IntToStr(RamGB) + ' -LogFile "' + AppDir + '\logs\configure_model.log"', RC) and (RC = 0)) then
369369
MsgBox('モデル設定に失敗しました。' + #13#10 +
370370
'qwen3系モデルの場合、思考モードが無効化されないため応答が遅くなることがあります。' + #13#10 +
371371
'ログ: ' + AppDir + '\logs\openwebui.err.log', mbInformation, MB_OK);

scripts/configure_model.ps1

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
# ツールがあるとモデルが関数呼び出しを選び、チャットにテキスト回答が残らず
88
# 「応答なし」になるため(実機検証済み)。
99
# - params.think=false で qwen3系の思考モードを無効化(応答なし防止)
10-
# - 全モデルに num_ctx 4096 を設定(長文・RAG 対応
10+
# - 全モデルに num_ctx を設定(RAM に応じて自動調整し、他アプリへのメモリ影響を抑制
1111
# 冪等: 同一モデル id の設定は上書きされる
1212
# 終了コード: 0 = 成功 / 非0 = 失敗
1313
param(
1414
[string]$BaseUrl = 'http://localhost:8080',
1515
[string]$Model = 'qwen2.5:3b',
16+
[int]$RamGB = 16,
1617
[string]$Email = 'admin@localhost',
1718
[string]$Password = 'admin',
1819
[string]$LogFile = ''
@@ -108,10 +109,15 @@ try {
108109
}
109110
)
110111

112+
# num_ctx を RAM に応じて自動調整(KV キャッシュのメモリ使用量を抑え、
113+
# 低メモリ機でも他のアプリへの影響を防ぐ)
114+
# 8GB 未満: 2048(メモリ節約優先) / 8〜16GB: 4096 / 16GB 以上: 8192(品質優先)
115+
$numCtx = if ($RamGB -lt 8) { 2048 } elseif ($RamGB -lt 16) { 4096 } else { 8192 }
116+
111117
foreach ($preset in $presets) {
112118
$params = @{
113119
think = $false
114-
num_ctx = 4096
120+
num_ctx = $numCtx
115121
# 応答の安定性向上(表記ブレ・揺らぎ・幻覚の抑制のため温度を低くする。
116122
# Q&A用途では決定論的な回答が望ましい)
117123
temperature = 0.2

0 commit comments

Comments
 (0)