sage-finetune
Fine-tuning component implementations for SAGE L3.
Installation
pip install isage-finetune
For LoRA training:
pip install isage-finetune[peft]
Features
- LoRA Trainer: Parameter-efficient fine-tuning with Low-Rank Adaptation
- Mock Trainer: Testing trainer for pipeline validation
- JSON/JSONL Loader: Flexible data loading for instruction and chat formats
Boundary
FinetuneManageronly manages task scheduling and status lifecycle.- Trainers only implement training/evaluation behavior.
- Package registration is explicit and fail-fast.
Quick Start
from sage_libs.sage_finetune import MockTrainer, JSONDatasetLoader
# Load training data
loader = JSONDatasetLoader()
train_data = loader.load("train.jsonl")
# Train (mock for testing)
trainer = MockTrainer()
result = trainer.train(train_data)
print(f"Loss: {result['train_loss']:.4f}")
LoRA Fine-tuning
from sage_libs.sage_finetune import LoRATrainer
from sage_libs.sage_finetune.trainers.lora_trainer import LoRAConfig
trainer = LoRATrainer(
model_name="gpt2",
lora_config=LoRAConfig(r=8, lora_alpha=16),
)
result = trainer.train(train_dataset)
trainer.save_model("./my_lora_model")
Data Formats
Instruction Format
{"instruction": "Summarize this text", "input": "Long text...", "output": "Summary..."}
Chat Format
{"messages": [{"role": "user", "content": "Hello"}, {"role": "assistant", "content": "Hi"}]}
Integration with SAGE
Components register into the SAGE finetune factory on package import:
from sage.libs.finetune import create_trainer
trainer = create_trainer("lora", model_name="gpt2")
License
Apache 2.0
Metadata
Release files for isage-finetune 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| isage_finetune-0.2.0.tar.gz | 15.0 kB | Without provenance | Details for isage_finetune-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| isage_finetune-0.2.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for isage_finetune-0.2.0-py2.py3-none-any.whl |
Total release size: 44.7 kB
Release files / isage_finetune-0.2.0.tar.gz
| Download URL | isage_finetune-0.2.0.tar.gz |
|---|---|
| Size | 15.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f49d7163821aa36a746a79f79293b809f41ff5dd07e53ffb4e9c67738ef629b3
|
|
BLAKE2b-256 checksum How to use checksums |
c6949e5adad9655eb6a384b55621f263eadfc32547159080d98f874d8f2f7604
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / isage_finetune-0.2.0-py2.py3-none-any.whl
| Download URL | isage_finetune-0.2.0-py2.py3-none-any.whl |
|---|---|
| Size | 29.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
62dd058963419b279661ce06b0c5aff687fe6944345e6f1a85f05f3c6c7bef0c
|
|
BLAKE2b-256 checksum How to use checksums |
282b92816b4b593a975bb2dac979e71f56e1eaff3ab4df99bfde6507e8d143e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Security for isage-finetune 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.