feat: modelo por defecto qwen3:4b (llama3.2 3B enredaba con las tools) (#20)
Co-authored-by: Hermes Agent <hermes@d0a1.es>
This commit was merged in pull request #20.
This commit is contained in:
1 parent
51258f6889
commit
6adbd966a0
11 files changed
+59
-59
No files matched your search
+12
-12
@@ -139,33 +139,33 @@ while ($true) {
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
Warn ' Descargando modelo (llama3.2:3b, ~2 GB)...'
|
||||
Warn ' Descargando modelo (qwen3:4b, ~2.5 GB)...'
|
||||
# Si el usuario define $env:HTTPS_PROXY, Ollama lo usa para el pull (doc oficial):
|
||||
$ProxyEnv = @()
|
||||
if ($env:HTTPS_PROXY) { $ProxyEnv = @('-e', "HTTPS_PROXY=$env:HTTPS_PROXY", '-e', "HTTP_PROXY=$env:HTTP_PROXY") }
|
||||
# --- Modelo ya presente? (volumen persistente: no re-descargar) ------------
|
||||
$ModelList = docker exec d0a1-hermes-ollama ollama list 2>$null
|
||||
if ("$ModelList" -match 'llama3.2:3b') {
|
||||
Info 'Modelo llama3.2:3b ya descargado (volumen intacto). Omitiendo descarga.'
|
||||
if ("$ModelList" -match 'qwen3:4b') {
|
||||
Info 'Modelo qwen3:4b ya descargado (volumen intacto). Omitiendo descarga.'
|
||||
} else {
|
||||
# --- Modelo: HF primero (CDN propio, rapido) y registry de Ollama como ultimo recurso ---
|
||||
|
||||
$Gguf = Join-Path $ScriptDir 'llama3.2-3b-q4.gguf'
|
||||
$Gguf = Join-Path $ScriptDir 'qwen3-4b-q4.gguf'
|
||||
$HfUrls = @(
|
||||
'https://huggingface.co/bartowski/Llama-3.2-3B-Instruct-GGUF/resolve/main/Llama-3.2-3B-Instruct-Q4_K_M.gguf',
|
||||
'https://huggingface.co/unsloth/Llama-3.2-3B-Instruct-GGUF/resolve/main/Llama-3.2-3B-Instruct-Q4_K_M.gguf'
|
||||
'https://huggingface.co/Qwen/Qwen3-4B-GGUF/resolve/main/Qwen3-4B-Q4_K_M.gguf',
|
||||
'https://huggingface.co/unsloth/Qwen3-4B-GGUF/resolve/main/Qwen3-4B-Q4_K_M.gguf'
|
||||
)
|
||||
Info 'Descargando modelo de IA (llama3.2:3b, ~2 GB)...'
|
||||
Info 'Descargando modelo de IA (qwen3:4b, ~2.5 GB)...'
|
||||
foreach ($Url in $HfUrls) {
|
||||
curl.exe -# -L --retry 3 --max-time 1800 -o "$Gguf" $Url
|
||||
if ($LASTEXITCODE -eq 0 -and (Test-Path $Gguf) -and (Get-Item $Gguf).Length -gt 1900000000) { break }
|
||||
if ($LASTEXITCODE -eq 0 -and (Test-Path $Gguf) -and (Get-Item $Gguf).Length -gt 2400000000) { break }
|
||||
Remove-Item "$Gguf" -Force -ErrorAction SilentlyContinue
|
||||
if ($Url -ne $HfUrls[-1]) { Warn 'Mirror no accesible, probando el siguiente...' }
|
||||
}
|
||||
if ((Test-Path $Gguf) -and (Get-Item $Gguf).Length -gt 1900000000) {
|
||||
if ((Test-Path $Gguf) -and (Get-Item $Gguf).Length -gt 2400000000) {
|
||||
Info 'Importando modelo en Ollama...'
|
||||
docker cp "$Gguf" d0a1-hermes-ollama:/root/.ollama/import.gguf
|
||||
docker exec d0a1-hermes-ollama sh -c 'printf "FROM /root/.ollama/import.gguf\\nPARAMETER num_ctx 16384\\n" > /tmp/mf && ollama create llama3.2:3b -f /tmp/mf'
|
||||
docker exec d0a1-hermes-ollama sh -c 'printf "FROM /root/.ollama/import.gguf\\nPARAMETER num_ctx 16384\\n" > /tmp/mf && ollama create qwen3:4b -f /tmp/mf'
|
||||
$CreateOk = ($LASTEXITCODE -eq 0)
|
||||
docker exec d0a1-hermes-ollama rm -f /root/.ollama/import.gguf | Out-Null
|
||||
Remove-Item "$Gguf" -Force -ErrorAction SilentlyContinue
|
||||
@@ -174,11 +174,11 @@ if ((Test-Path $Gguf) -and (Get-Item $Gguf).Length -gt 1900000000) {
|
||||
} else {
|
||||
# Ultimo recurso: pull directo (1 intento, ya sin esperar 3 rondas)
|
||||
Warn 'HuggingFace no accesible. Probando el registry de Ollama (ultimo recurso)...'
|
||||
docker exec @ProxyEnv d0a1-hermes-ollama ollama pull llama3.2:3b
|
||||
docker exec @ProxyEnv d0a1-hermes-ollama ollama pull qwen3:4b
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
$PullOk = $true
|
||||
# Contexto ampliado (el default 4096 da 400 en Open WebUI con prompts largos)
|
||||
docker exec d0a1-hermes-ollama sh -c 'printf "FROM llama3.2:3b\\nPARAMETER num_ctx 16384\\n" > /tmp/mf && ollama create llama3.2:3b -f /tmp/mf'
|
||||
docker exec d0a1-hermes-ollama sh -c 'printf "FROM qwen3:4b\\nPARAMETER num_ctx 16384\\n" > /tmp/mf && ollama create qwen3:4b -f /tmp/mf'
|
||||
}
|
||||
}
|
||||
if (-not $PullOk) {
|
||||
|
||||
Reference in new issue
Block a user