Views
No views yet
Status: built and verified end-to-end on Windows 11 + RTX 4060 (8 GB). The fine-tuned model answers strictly from provided context and honestly refuses when the answer isn't there.
| Property | Detail |
|---|---|
| Base | SLERP merge of TinyLlama-1.1B-Chat-v1.0 + TinyDolphin-2.8-1.1b |
| Fine-tune | LoRA rank 32 (bf16) on 30k SQuAD v2 examples, incl. unanswerable Qs for refusal (eval loss 1.50) |
| Size | 1.1B params · 668 MB as Q4_K_M GGUF |
| Runtime | Ollama (CPU or GPU) — also a FastAPI server + web chat UI |
| Task | Grounded document Q&A / RAG |
| License | Apache 2.0 |
<|system|>
{system}</s>
<|user|>
Context:
{context}
Question: {question}</s>
<|assistant|>1# 1. The model is registered in Ollama as `pecanai-x1`
2ollama run pecanai-x1 "Context: The sky is blue. Question: What color is the sky?"
3
4# 2. Or launch the server + web UI
5powershell -ExecutionPolicy Bypass -File start_pecanai.ps1setup → merge → fine-tune → quantize → serve.
Tested on Python 3.13 + an NVIDIA GPU. Uses uv.1uv venv --python 3.13 .venv
2# GPU torch matched to your driver. Driver <550 (CUDA <=12.2)? use cu118:
3uv pip install --python .venv\Scripts\python.exe torch --index-url https://download.pytorch.org/whl/cu118
4uv pip install --python .venv\Scripts\python.exe -r finetune\requirements_train.txt1uv venv --python 3.13 merge\.venv
2uv pip install --python merge\.venv\Scripts\python.exe mergekit "pydantic==2.9.2"
3merge\.venv\Scripts\python.exe merge\run_merge.py merge\merge_config.yaml merge\pecanai_x1_baserun_merge.py wraps a mergekit 0.1.4 bug (an unresolved torch forward-ref in a
pydantic model) and drives the SLERP merge via the Python API.1.venv\Scripts\python.exe finetune\finetune.py `
2 --base_model merge\pecanai_x1_base `
3 --output finetune\pecanai_x1_ft_v2 `
4 --max_samples 30000 --epochs 1 --batch_size 8 --grad_accum 2 --max_seq_len 1024 `
5 --lora_r 32 --save_steps 50 --resume --mergefinetune\pecanai_x1_ft_v2_merged (standalone fp16 HF model). bf16 LoRA — no
bitsandbytes needed (add --load_4bit only if you're VRAM-constrained).--save_steps 50 checkpoints frequently and --resume continues from
the latest checkpoint, so an interrupted run picks up where it left off (re-run the same
command). Prefer a bigger, resumable run? train_v2.ps1 wraps this.
Sanity check: python finetune\eval_pecanai.py finetune\pecanai_x1_ft_v2_merged1# IMPORTANT: the SentencePiece tokenizer.model must be in the model dir, or the
2# GGUF tokenizer breaks (UNK byte artifacts). run_merge copies tokenizer.json only,
3# so copy tokenizer.model from the base model:
4copy merge\pecanai_x1_base\tokenizer.model finetune\pecanai_x1_ft_v2_merged\
5
6powershell -ExecutionPolicy Bypass -File quantize\quantize.ps1 `
7 -ModelDir finetune\pecanai_x1_ft_v2_merged -ModelName pecanai-x1 -Quant q4_K_M1uv pip install --python .venv\Scripts\python.exe -r server\requirements_server.txt
2powershell -ExecutionPolicy Bypass -File start_pecanai.ps11# Upload a document
2curl -X POST http://localhost:8000/v1/documents -F "file=@report.pdf"
3
4# Ask a question
5curl -X POST http://localhost:8000/v1/chat/completions \
6 -H "Content-Type: application/json" \
7 -d '{"model":"pecanai-x1","messages":[{"role":"user","content":"Summarize the report"}]}'1uv pip install --python .venv\Scripts\python.exe huggingface_hub
2$env:HF_TOKEN="hf_..."
3.venv\Scripts\python.exe distribute\upload_to_hf.py --repo PecanAi-LLC/PecanAi-X1 --model_dir finetune\pecanai_x1_ft_merged
4ollama push pecanai/pecanai-x1 # after `ollama cp pecanai-x1 pecanai/pecanai-x1`PecanAi-X1/
├── merge/ # SLERP merge (mergekit) + run_merge.py workaround
├── finetune/ # LoRA fine-tune (PEFT+TRL), eval, requirements
├── inference/ # RAG pipeline (ChromaDB + Ollama backend) + tests
├── quantize/ # Ollama import/quantize (quantize.ps1) + Modelfile
├── server/ # FastAPI OpenAI-compatible server
├── web/ # Single-file chat UI
├── distribute/ # HuggingFace uploader
└── start_pecanai.ps1cu124+
fails to init — use cu118.bitsandbytes, sentencepiece
builds, and llama-cpp-python — Ollama handles GGUF conversion/quantization.tokenizer.model with the HF dir before GGUF conversion.pydantic<2.10 and the run_merge.py rebuild shim.merge/merge_config.yaml: swap to mistralai/Mistral-7B-Instruct-v0.3 +
teknium/OpenHermes-2.5-Mistral-7B, set layer_range: [0, 32]. ~4.1 GB GGUF,
runs on 8 GB RAM.