makepad/tools/qwen38/convert_start.ps1
Admin 384d0e031c tools: the Builder replaces makepad_loader, the web server moves to makepad/webserver, fleet scripts, docs and the workspace members
tools/makepad_builder replaces tools/makepad_loader: one build target
shared across app builds, workspace package selection, checkout
progress on the public Git API, detached built apps with a completion
state, waits for Windows security scans, manual retry after compiler
locks, dedicated-folder installer checks, catalog and runtime fixes.
tools/web_server and its scripts leave for github.com/makepad/webserver.
Arch USB clone/restore scripts, the qwen38 box scripts and the G-belt
serial test join tools/. docs/agents records the agent workflow and the
remote-control handoff protocol; AGENTS.md forbids vendored sources and
bulk imports. Cargo.toml lists apps/wm-dyn, libs/code_language,
libs/search, libs/tar, libs/loader_bundle and tools/makepad_builder,
and drops the two removed crates.

Squashed from work:
- Share Builder target across Makepad app builds
- Fix Builder workspace package selection
- Align Builder checkout progress with public Git API
- Detach built apps and show completion state
- Wait for Windows security scans
- Offer manual retry after Windows compiler locks
- docs: the agent workflow of record and the remote-control handoff protocol
- builder: dedicated-folder installer checks, catalog and runtime fixes; Windows job objects hold c_void handles
- tools: Arch USB clone/restore scripts, the qwen38 box scripts, and the G-belt serial test
- tools: the web server moves to makepad/webserver
- AGENTS.md: no vendored sources or bulk imports in the tree

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-18 12:17:59 +02:00

56 lines
3.4 KiB
PowerShell

# Launch detached conversion pipeline (official ggml-org recipe, staged for disk headroom)
# Stage A: text BF16 -> Q4_K_M(recipe) + Q5_K_M(recipe) -> delete text BF16
# Stage B: mmproj BF16 + mmproj Q8_0
# Stage C: mtp BF16 -> mtp Q4_0 (--pure) -> delete mtp BF16
# All progress into C:\ai\models\qwen38\convert_ours.log
$ErrorActionPreference = 'Stop'
$work = @'
$ErrorActionPreference = 'Stop'
function Log($m) { Write-Output ("[" + (Get-Date -Format HH:mm:ss) + "] " + $m) }
function FreeGB { [math]::Round((Get-PSDrive C).Free/1GB,1) }
$src = 'C:\ai\qwen38\llamacpp-src'
$hf = 'C:\ai\models\qwen38\hf'
$out = 'C:\ai\models\qwen38'
$q = 'C:\ai\qwen38\bin\llama-quantize.exe'
Log ("start freeGB=" + (FreeGB))
Log "text bf16 convert"
python $src\convert_hf_to_gguf.py $hf --outtype bf16 --outfile $out\Qwen3.8-27B-BF16.gguf --no-mtp --model-name Qwen3.8-27B
if ($LASTEXITCODE -ne 0) { throw "text convert failed" }
Log ("text bf16 done freeGB=" + (FreeGB))
Log "quantize Q4_K_M (official recipe)"
& $q --pure --tensor-type output.weight=q6_k --tensor-type shexp=q8_0 --tensor-type latent=q8_0 --tensor-type attn_=q8_0 --tensor-type ssm_=q8_0 $out\Qwen3.8-27B-BF16.gguf $out\Qwen3.8-27B-Q4_K_M.gguf Q4_K_M
if ($LASTEXITCODE -ne 0) { throw "q4km failed" }
Log ("q4km done freeGB=" + (FreeGB))
Log "quantize Q5_K_M (same recipe, higher base)"
& $q --pure --tensor-type output.weight=q6_k --tensor-type shexp=q8_0 --tensor-type latent=q8_0 --tensor-type attn_=q8_0 --tensor-type ssm_=q8_0 $out\Qwen3.8-27B-BF16.gguf $out\Qwen3.8-27B-Q5_K_M.gguf Q5_K_M
if ($LASTEXITCODE -ne 0) { throw "q5km failed" }
Log ("q5km done freeGB=" + (FreeGB))
Log "smoke-load q4km header via llama-gguf-split --help skipped; deleting text BF16"
Remove-Item $out\Qwen3.8-27B-BF16.gguf
Log ("bf16 deleted freeGB=" + (FreeGB))
Log "mmproj bf16"
python $src\convert_hf_to_gguf.py $hf --outtype bf16 --outfile $out\mmproj-Qwen3.8-27B-BF16.gguf --mmproj --model-name Qwen3.8-27B
if ($LASTEXITCODE -ne 0) { throw "mmproj bf16 failed" }
Log "mmproj q8_0"
python $src\convert_hf_to_gguf.py $hf --outtype q8_0 --outfile $out\mmproj-Qwen3.8-27B-Q8_0.gguf --mmproj --model-name Qwen3.8-27B
if ($LASTEXITCODE -ne 0) { throw "mmproj q8 failed" }
Log "mtp bf16"
python $src\convert_hf_to_gguf.py $hf --outtype bf16 --outfile $out\mtp-Qwen3.8-27B-BF16.gguf --mtp --model-name Qwen3.8-27B
if ($LASTEXITCODE -ne 0) { throw "mtp bf16 failed" }
Log "mtp q4_0"
& $q --pure $out\mtp-Qwen3.8-27B-BF16.gguf $out\mtp-Qwen3.8-27B-Q4_0.gguf Q4_0
if ($LASTEXITCODE -ne 0) { throw "mtp q4_0 failed" }
Remove-Item $out\mtp-Qwen3.8-27B-BF16.gguf
Log ("mtp done freeGB=" + (FreeGB))
Log "sha256 artifacts"
foreach ($f in @("Qwen3.8-27B-Q4_K_M.gguf","Qwen3.8-27B-Q5_K_M.gguf","mmproj-Qwen3.8-27B-BF16.gguf","mmproj-Qwen3.8-27B-Q8_0.gguf","mtp-Qwen3.8-27B-Q4_0.gguf")) {
$h = (Get-FileHash -Algorithm SHA256 (Join-Path $out $f)).Hash.ToLower()
$len = (Get-Item (Join-Path $out $f)).Length
Write-Output ("SHA256 " + $f + " " + $h + " bytes=" + $len)
}
Log "CONVERT_ALL_DONE"
'@
Set-Content -Path C:\ai\models\qwen38\convert_job.ps1 -Value $work -Encoding UTF8
$cmd = 'cmd /c "powershell -NoProfile -ExecutionPolicy Bypass -File C:\ai\models\qwen38\convert_job.ps1 >> C:\ai\models\qwen38\convert_ours.log 2>&1"'
$r = Invoke-CimMethod -ClassName Win32_Process -MethodName Create -Arguments @{ CommandLine = $cmd }
Write-Output ("CONVERT_LAUNCH pid=" + $r.ProcessId + " rc=" + $r.ReturnValue)