slicktune.tuner¶
High-level Tuner API composing model × strategy × objective × data × metrics.
Classes¶
Result of a completed |
|
Composable fine-tuning entry point. |
Module Contents¶
- class slicktune.tuner.FitResult[source]¶
Result of a completed
Tuner.fit()call.- Parameters:
output_dir (Path) – Directory containing the saved adapter / model and metrics.
metrics (TrainingMetrics) – Collected training metrics.
model (Any) – Trained model (PEFT or full).
tokenizer (PreTrainedTokenizerBase) – Tokenizer used during training.
- metrics: slicktune.metrics.TrainingMetrics¶
- model: Any¶
- output_dir: pathlib.Path¶
- tokenizer: transformers.PreTrainedTokenizerBase¶
- class slicktune.tuner.Tuner[source]¶
Composable fine-tuning entry point.
- Parameters:
model_id (str) – Hugging Face model id or local path.
strategy (Strategy) – Parameter-update strategy (LoRA, DoRA, AdaLoRA, QLoRA, full, …).
objective (Objective) – Training objective (SFT, DPO, ORPO, or KTO).
output_dir (str or Path) – Where checkpoints, adapter weights, and metrics are written.
max_seq_length (int, optional) – Maximum sequence length, by default 512.
num_train_epochs (float, optional) – Number of epochs, by default 3.0.
per_device_train_batch_size (int, optional) – Batch size per device, by default 1.
gradient_accumulation_steps (int, optional) – Gradient accumulation steps, by default 4.
learning_rate (float, optional) – Learning rate, by default 2e-4.
logging_steps (int, optional) – Logging frequency, by default 1.
save_steps (int, optional) – Checkpoint frequency, by default 50.
seed (int, optional) – Random seed, by default 42.
eval_data (str or Path or Dataset or None, optional) – Optional holdout SFT JSONL/dataset for perplexity after fit.
probe_path (str or Path or None, optional) – Optional probe JSONL judged after fit (substring or custom judge).
judge (Judge or None, optional) – Judge used with
probe_path; defaults toSubstringJudge.
- eval_data: str | pathlib.Path | datasets.Dataset | None = None¶
- fit(data: str | pathlib.Path | datasets.Dataset) FitResult[source]¶
Run fine-tuning for the configured objective.
- Parameters:
data (str or Path or Dataset) – Path to objective-specific JSONL, or an in-memory dataset.
- Returns:
FitResult – Trained artifacts and metrics.
- Raises:
TypeError – If the objective is not supported.
ValueError – If required dataset columns are missing.
- judge: slicktune.eval.Judge | None = None¶
- objective: slicktune.types.Objective¶
- output_dir: str | pathlib.Path¶
- probe_path: str | pathlib.Path | None = None¶
- strategy: slicktune.types.Strategy¶