fix: desactivar el thinking de Qwen3 (SYSTEM /no_think)

Qwen3 4B tiene el thinking mode ON por defecto: para 'Say hi in one
word' generaba 232 tokens de razonamiento interno antes de responder
(45+ s en una GTX 1660). Con /no_think: 7 tokens.

- SYSTEM /no_think en el Modelfile (import HF y re-create num_ctx)
- el re-create pasa SIEMPRE al validar el modelo ya presente (asi el
  tag existente del usuario hereda el fix sin re-descargar)
This commit is contained in:
hermes committed 2026-09-12 22:38:08 +02:00
1 parent fb3c3fdb67
commit fab69b521e
4 files changed
+12 -8

No files matched your search

+3 -2
View File
@@ -205,6 +205,7 @@ if ($env:HTTPS_PROXY) { $ProxyEnv = @('-e', "HTTPS_PROXY=$env:HTTPS_PROXY", '-e'
$ModelList = docker exec d0a1-wp-ollama ollama list 2>$null
if ("$ModelList" -match 'qwen3:4b') {
Info 'Modelo qwen3:4b ya descargado (volumen intacto). Omitiendo descarga.'
cmd /c docker exec d0a1-wp-ollama sh -c 'printf "FROM qwen3:4b\\nPARAMETER num_ctx 16384\\nSYSTEM /no_think\\n" > /tmp/mf && ollama create qwen3:4b -f /tmp/mf' '>' NUL '2>&1'
} else {
# --- Modelo: HF primero (CDN propio, rapido) y registry de Ollama como ultimo recurso ---
@@ -223,7 +224,7 @@ foreach ($Url in $HfUrls) {
if ((Test-Path $Gguf) -and (Get-Item $Gguf).Length -gt 2400000000) {
Info 'Importando modelo en Ollama...'
docker cp "$Gguf" d0a1-wp-ollama:/root/.ollama/import.gguf
docker exec d0a1-wp-ollama sh -c 'printf "FROM /root/.ollama/import.gguf\\nPARAMETER num_ctx 16384\\n" > /tmp/mf && ollama create qwen3:4b -f /tmp/mf'
docker exec d0a1-wp-ollama sh -c 'printf "FROM /root/.ollama/import.gguf\\nPARAMETER num_ctx 16384\\nSYSTEM /no_think\\n" > /tmp/mf && ollama create qwen3:4b -f /tmp/mf'
$CreateOk = ($LASTEXITCODE -eq 0)
docker exec d0a1-wp-ollama rm -f /root/.ollama/import.gguf | Out-Null
Remove-Item "$Gguf" -Force -ErrorAction SilentlyContinue
@@ -236,7 +237,7 @@ if ((Test-Path $Gguf) -and (Get-Item $Gguf).Length -gt 2400000000) {
if ($LASTEXITCODE -eq 0) {
$PullOk = $true
# Contexto ampliado (el default 4096 da 400 en Open WebUI con prompts largos)
docker exec d0a1-wp-ollama sh -c 'printf "FROM qwen3:4b\\nPARAMETER num_ctx 16384\\n" > /tmp/mf && ollama create qwen3:4b -f /tmp/mf'
docker exec d0a1-wp-ollama sh -c 'printf "FROM qwen3:4b\\nPARAMETER num_ctx 16384\\nSYSTEM /no_think\\n" > /tmp/mf && ollama create qwen3:4b -f /tmp/mf'
}
}
if (-not $PullOk) {