Metadata-Version: 2.4
Name: kailash-align
Version: 0.2.1
Summary: LLM fine-tuning and alignment framework for the Kailash platform
Project-URL: Documentation, https://docs.terrene.foundation/kailash-align
Project-URL: Repository, https://github.com/terrene-foundation/kailash-py/tree/main/packages/kailash-align
Project-URL: Issues, https://github.com/terrene-foundation/kailash-py/issues
Author-email: Terrene Foundation <engineering@terrene.foundation>
License-Expression: Apache-2.0
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Requires-Dist: accelerate>=1.4
Requires-Dist: click>=8.0
Requires-Dist: datasets>=4.0
Requires-Dist: httpx>=0.27
Requires-Dist: kailash-kaizen>=0.3.0
Requires-Dist: kailash-ml>=0.1.0
Requires-Dist: kailash>=0.4.0
Requires-Dist: peft>=0.10
Requires-Dist: torch<3.0,>=2.2
Requires-Dist: transformers<5.0,>=4.40
Requires-Dist: trl<2.0,>=1.0
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest-timeout>=2.0; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.3; extra == 'dev'
Provides-Extra: eval
Requires-Dist: lm-eval<1.0,>=0.4; extra == 'eval'
Provides-Extra: full
Requires-Dist: bitsandbytes<1.0,>=0.43; extra == 'full'
Requires-Dist: gguf>=0.10; extra == 'full'
Requires-Dist: llama-cpp-python>=0.3; extra == 'full'
Requires-Dist: lm-eval<1.0,>=0.4; extra == 'full'
Requires-Dist: vllm>=0.6; extra == 'full'
Provides-Extra: online
Requires-Dist: vllm>=0.6; extra == 'online'
Provides-Extra: rlhf
Requires-Dist: bitsandbytes<1.0,>=0.43; extra == 'rlhf'
Provides-Extra: serve
Requires-Dist: gguf>=0.10; extra == 'serve'
Requires-Dist: llama-cpp-python>=0.3; extra == 'serve'
Description-Content-Type: text/markdown

# kailash-align

LLM fine-tuning and alignment framework for the Kailash platform. Part of the [Kailash Python SDK](https://github.com/terrene-foundation/kailash-py) by the Terrene Foundation.

## Overview

kailash-align provides structured LoRA/QLoRA fine-tuning with full lifecycle tracking:

- **AdapterRegistry** -- Track adapters from training through evaluation, merge, GGUF export, and deployment
- **AlignmentPipeline** -- Thin wrappers around TRL SFTTrainer and DPOTrainer with checkpoint management
- **AlignmentConfig** -- Validated configuration dataclasses with NaN/Inf protection

## Installation

```bash
pip install kailash-align
```

### Optional Extras

```bash
pip install kailash-align[rlhf]    # QLoRA via bitsandbytes
pip install kailash-align[eval]    # Model evaluation via lm-eval
pip install kailash-align[serve]   # GGUF export via llama-cpp-python
pip install kailash-align[full]    # All extras
```

## Quick Start

```python
from kailash_align import AlignmentConfig, AlignmentPipeline, AdapterRegistry

# Configure
config = AlignmentConfig(
    base_model_id="meta-llama/Llama-3.1-8B",
    method="sft",
)

# Track adapters
registry = AdapterRegistry()

# Train
pipeline = AlignmentPipeline(config=config, adapter_registry=registry)
result = await pipeline.train(dataset=my_dataset, adapter_name="my-adapter")

# Result includes adapter path, metrics, and registry version
print(result.adapter_path)
print(result.training_metrics)
```

## License

Apache 2.0 -- see [LICENSE](../../LICENSE).
