Run model downloads and split conversations independently

This commit is contained in:
Mark Gregory
2026-11-17 11:48:11 +00:00
parent 0b8a07b10f
commit 1f373d0ece
6 changed files with 267 additions and 55 deletions
+2 -2
View File
@@ -26,7 +26,7 @@
- [x] Verify the ZIP checksum, then extract it and verify the app signature and arm64-only executable.
- [ ] Run a smoke test against a real remote Ollama endpoint with a preinstalled model.
- [x] Run discovery, source inventory, and read-only search against the Pegasus MCP server over SSH stdio.
- [ ] Verify a real remote Streamable HTTP MCP endpoint when one is configured.
- [x] Verify discovery, inventory, and search against the live Pegasus Streamable HTTP endpoint at `https://kb.absdev.net/mcp`. Search and inventory passed before the indexed files were removed. A subsequent check needs a restored or rebuilt index.
- [x] Sign with Developer ID Application and verify the extracted app has hardened runtime.
- [ ] Notarize and staple with a configured notary profile.
@@ -42,7 +42,7 @@
- [x] Import text chats from the installed Msty Studio database schema, scan a chosen folder for AI Studio backups, and relocate a workspace. Msty attachments and non-chat resources are outside the importer.
- [x] Add editable appearance shortcuts, chat rendering options, and a side-by-side conversation comparison.
- [ ] Add independent composers and concurrent generation in split chats.
- [x] Add independent composers and concurrent generation across two conversations. Both panes use the current model configuration.
- [x] Extend Prompt Library with notes, tags, and version history. Add rendered web clip capture in an isolated WebKit session. Interactive sign-in has not been verified.
- [x] Document the ACP adapter, diff review, tool history, and compatible proxy configuration design.
- [ ] Implement and validate ACP adapters, diff review, and tool history. Verify a selected separate local proxy.
+109
View File
@@ -0,0 +1,109 @@
# Fine-tune a model for use in AI Studio
AI Studio can download and run MLX checkpoints from Hugging Face and register
local MLX model folders. Training is currently an external MLX LM workflow.
The app does not yet provide a Clone or Train button.
## 1. Choose the base model
On an Apple Silicon Mac, choose a small, supported MLX text-generation model.
In **Settings → Model Library → MLX**, download it and choose **Reveal** to
find its folder. The downloaded files are a snapshot from a specific Hugging
Face repository revision. Record the repository, revision, model card license
and runtime format. A Hugging Face repository can contain MLX weights, PyTorch
weights or GGUF files. Pick a working MLX checkpoint for this workflow.
A derived model does not need a second copy of the base weights during LoRA
training. Keep the base folder intact and create a separate project folder for
your dataset, adapter and experimental outputs. If you get the checkpoint
outside the app, use the Hugging Face Hub CLI or its snapshot downloader with
an explicit revision. For a gated repository, request access and authenticate
using the Hub CLI before downloading. AI Studio's built-in catalog currently
downloads public MLX Community checkpoints.
## 2. Prepare your local dataset
Create a dataset folder with `train.jsonl`, `valid.jsonl`, and `test.jsonl`.
Each line is one JSON object. For a chat model, use examples of the questions
and answers you want the model to learn. Use one example per line.
```json
{"messages":[{"role":"user","content":"Review this change for missing validation."},{"role":"assistant","content":"Validate the input at the boundary and add a test for invalid data."}]}
```
Keep related examples together in a single split so near duplicates cannot
inflate your test results. Remove credentials and private data you do not
want reproduced. Start with a small, hand-reviewed dataset. To answer from
changing internal standards or documents, keep using the Pegasus knowledge
base. Use fine-tuning for response style, task behavior and conventions that
you can demonstrate with examples.
Hugging Face can also host datasets. MLX LM supports a Hub dataset as an
input, alongside local JSONL. For an internal dataset, start with local files
and explicitly review access and retention before uploading anything.
## 3. Train and evaluate an adapter
In a dedicated project folder, create a Python environment and install MLX LM.
Record the installed version with the experiment so you can reproduce it.
```sh
python3 -m venv .venv
source .venv/bin/activate
python -m pip install mlx-lm
python -m pip show mlx-lm
```
Set `BASE` to the model folder from Reveal. The relative paths below are
inside the training project folder.
```sh
BASE="/absolute/path/to/downloaded-mlx-model"
mlx_lm.lora --model "$BASE" --train --data ./dataset \
--adapter-path ./adapter --iters 100 --batch-size 1
mlx_lm.lora --model "$BASE" --test --data ./dataset \
--adapter-path ./adapter
mlx_lm.generate --model "$BASE" --adapter-path ./adapter \
--prompt "Review this change for missing validation."
```
Compare base and adapter answers on the same held-out examples. Check
grounding, task accuracy, style, and regressions outside the target task.
Use a small first run to check memory and verify the checkpoint supports
LoRA. Adjust sequence length, batch size and iteration count based on the
measured run. Keep each adapter tied to the exact base weights it was trained
against.
## 4. Load the trained derivative
Fuse into a **new folder** and keep the original checkpoint available.
```sh
mlx_lm.fuse --model "$BASE" --adapter-path ./adapter --save-path ./trained-model
```
In **Settings → Model Library → MLX**, use **Register Model Folder…**, select
`trained-model`, and use **Load Model**. Verify a short reply before using the
derivative for real work. An Ollama tag is a packaged inference artifact.
For an Ollama deployment, train from a supported base checkpoint first, then
check whether the target Ollama model architecture supports the adapter or
whether a separate compatible export is needed.
Hugging Face publishing is optional. When sharing, check the original license
and organizational data rules. Document the base revision, dataset rights,
training configuration, evaluation and limitations in the model card. A Hub
repository can store the adapter or fused checkpoint separately from the base.
Keep it private unless you intend to publish it.
## Proposed AI Studio integration
A **Create Training Variant** action should create a new local record tied to
the pinned base revision. A dataset picker should validate JSONL and preview
the splits. A training screen should show settings, progress, loss, cancellation
and checkpoints. Once a run completes, present a side-by-side evaluation and
a **Register Trained Model** action. Start with the MLX LM worker in a dedicated
environment and record the runtime version and exact inputs. Set no automatic
upload destination.
Sources: [MLX LM LoRA guide](https://github.com/ml-explore/mlx-lm/blob/main/mlx_lm/LORA.md) ·
[Hugging Face Hub download guide](https://huggingface.co/docs/huggingface_hub/guides/download)