Repository navigation
v0.4.5 — Quickstart Layer (Phase 10.5)
Added
Quickstart Layer (Phase 10.5) — One-command bundled templates with opinionated defaults. Primary community-growth driver: closes the gap between "I just installed ForgeLM" and "I have a fine-tuned model running locally."
-
forgelm/quickstart.py— Template registry + orchestrator:Template(frozen dataclass) —name,title,description,primary_model,fallback_model,trainer_type,estimated_minutes,min_vram_for_primary_gb,bundled_dataset,license_note.TEMPLATES: Dict[str, Template]— 5 entries:customer-support,code-assistant,domain-expert,medical-qa-tr,grpo-math.auto_select_model(template, available_vram_gb)— picks primary model when VRAM ≥ threshold (10–12 GB), fallback otherwise; explicitno-gpu-detectedreason when CUDA is absent._detect_available_vram_gb()— wrapstorch.cuda.mem_get_info(); returnsNonewhen no GPU (test mock point).run_quickstart(template_name, *, model_override, dataset_override, output_path, dry_run, available_vram_gb)→QuickstartResult— copies seed dataset, substitutesmodel.name_or_pathanddata.dataset_name_or_path, writesconfigs/<template>-YYYYMMDDHHMMSS.yaml. Generated YAML is identical in shape to a hand-written one — same trainer, same schema.format_template_list(),summarize_result(result)— text/JSON renderers for CLI use.
-
forgelm quickstart <template>CLI subcommand (inforgelm/cli.py):--list— prints the registry; honors top-level--output-format jsonfor CI.--model <id>— override auto-selected model.--dataset <path>— override the bundled seed dataset (required fordomain-expert).--output <path>— custom YAML output path (default:./configs/<template>-<timestamp>.yaml).--dry-run— generate config only; skip training and chat.--no-chat— train but skip the post-training chat REPL.- On a successful run, subprocess-invokes
forgelm --config <out>and thenforgelm chat <output_dir>(unless--no-chat).
-
Wizard integration —
forgelm --wizardnow opens with "Start from a template?":- Yes → routes to the quickstart selector; the wizard becomes a thin shell over
run_quickstart(). - No → falls through to the existing 8-step interactive flow.
- No bifurcation: identical code paths and YAML schema downstream.
- Yes → routes to the quickstart selector; the wizard becomes a thin shell over
-
5 bundled templates under
forgelm/templates/:customer-support/— Qwen2.5-7B-Instruct primary, SmolLM2-1.7B-Instruct fallback. SFT trainer. 58-example seed JSONL in{"messages": [...]}format.code-assistant/— Qwen2.5-Coder-7B-Instruct primary, Qwen2.5-Coder-1.5B-Instruct fallback (code-tuned smaller variant, not generic SmolLM2). SFT. 59-example Python/programming Q&A.domain-expert/— Qwen2.5-7B-Instruct primary, SmolLM2-1.7B-Instruct fallback. BYOD; empty data with a README explaining how to pair withforgelm ingest(Phase 11) or a custom JSONL.medical-qa-tr/— Qwen2.5-7B-Instruct primary, Qwen2.5-1.5B-Instruct fallback (Turkish-capable, not English-only SmolLM2). SFT, 49 Turkish Q&A; every answer ends with "Tıbbi acil durumlarda 112'yi arayın..." (medical-disclaimer guardrail).grpo-math/— Qwen2.5-Math-7B-Instruct primary, Qwen2.5-Math-1.5B-Instruct fallback. GRPO trainer (grpo_num_generations: 4). 40 grade-school math word problems in prompt-only format, each carrying agold_answerfield for the built-in regex correctness reward.
-
Conservative defaults in every template config:
- QLoRA 4-bit NF4, LoRA rank=8,
per_device_train_batch_size=1, gradient checkpointing on, safety eval / compliance artifacts opt-in only. - Designed so the smallest fallback model + the bundled seed dataset run end-to-end on a 12 GB consumer GPU.
- QLoRA 4-bit NF4, LoRA rank=8,
-
forgelm/templates/LICENSES.md— Full attribution for bundled seed datasets (CC-BY-SA 4.0, author-original); contributing guide for new templates; medical-disclaimer note formedical-qa-tr. -
pyproject.toml[tool.setuptools.package-data]— bundles*.yaml,*.jsonl,*.mdunderforgelm.templatesinto the wheel sopip install forgelmusers get the templates without a source checkout. -
GRPO baseline reward —
forgelm/grpo_rewards.pyships a default reward bundle so prompt-only datasets don't crash insidetrl.GRPOTrainer. Whengrpo_reward_modelis unset the trainer wirescombined_format_length_reward(0.8 × format-match + 0.2 × length-shaping); if the dataset additionally carries agold_answerfield (the bundledgrpo-mathseed does),_math_reward_fnis appended so TRL sums correctness on top of format teaching. -
Tests — All GPU-independent via TRL/torch FSDP-aware skip-if pattern:
tests/test_quickstart.py— registry consistency, bundled-asset shape,auto_select_modelprimary/fallback/no-gpu, end-to-endrun_quickstart, CLI dispatch, regression test that loads every generated YAML throughload_config(strongest guard against template drift).tests/test_quickstart_hardening.py— PR review hardening (path validation, model override edges, dry-run wiring).tests/test_grpo_math_reward.py— pure-Python unit tests for_normalize_answer,_answers_match,_math_reward_fn,_dataset_has_gold_answers.tests/test_grpo_format_reward.py—format_match_reward,length_shaping_reward,combined_format_length_reward, plus trainer integration.tests/test_wizard_byod.py— wizard BYOD dataset path validation (existence, directory, malformed JSONL, valid JSONL, HF Hub IDs,~expansion).tests/test_cli_quickstart_wiring.py—--offlinepropagation, separate chat inheritance, chat exit-code 0/130 handling.tests/test_packaging.py— wheelpackage_datasmoke (catches editable-install-only template paths).tests/test_grpo_reward.py— extended with no-reward-model + gold-answer wiring assertions.
-
CI —
.github/workflows/nightly.yml:- Per-template quickstart smoke (4 of 5 —
domain-expertis BYOD and covered by pytest). - New
wheel-install-smokejob: builds the wheel, installs it into a fresh venv from/tmp(so the source tree is offsys.path), and rerunsquickstart --list+quickstart --dry-runto catch brokenpackage_dataglobs that editable installs hide.
- Per-template quickstart smoke (4 of 5 —
Documentation
- New "Option 0: One-Command Quickstart Template" section at the top of
docs/guides/quickstart.md. docs/roadmap.md,docs/roadmap-tr.md,docs/roadmap/phase-12-quickstart.md,docs/roadmap/releases.mdupdated to mark Phase 10.5 as Done.README.mdquickstart section updated to lead withforgelm quickstart.