Metadata-Version: 2.4
Name: pyrecall
Version: 0.11.11
Summary: Keep your models balanced. Continuous fine-tuning with automatic forgetting detection and skill rollback.
Project-URL: Homepage, https://github.com/Pyrecall/Pyrecall
Project-URL: Bug Tracker, https://github.com/Pyrecall/Pyrecall/issues
Project-URL: PyPI, https://pypi.org/project/pyrecall
Author: pyrecall contributors
License: MIT License
        
        Copyright (c) 2024 pyrecall contributors
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: catastrophic-forgetting,continual-learning,fine-tuning,llm,lora,peft,transformers
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.11
Requires-Dist: accelerate>=0.24.0
Requires-Dist: datasets>=2.14.0
Requires-Dist: filelock
Requires-Dist: peft>=0.6.0
Requires-Dist: rich>=13.0.0
Requires-Dist: torch>=2.0.0
Requires-Dist: transformers>=4.35.0
Requires-Dist: typer>=0.9.0
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
Requires-Dist: pytest-mock>=3.12.0; extra == 'dev'
Requires-Dist: pytest>=7.4.0; extra == 'dev'
Provides-Extra: mlflow
Requires-Dist: mlflow>=2.0.0; extra == 'mlflow'
Provides-Extra: neptune
Requires-Dist: neptune>=1.0.0; extra == 'neptune'
Provides-Extra: privacy
Requires-Dist: cryptography>=41.0.0; extra == 'privacy'
Provides-Extra: quantization
Requires-Dist: bitsandbytes>=0.41.0; extra == 'quantization'
Provides-Extra: serve
Requires-Dist: fastapi>=0.104.0; extra == 'serve'
Requires-Dist: uvicorn[standard]>=0.24.0; extra == 'serve'
Provides-Extra: trackers
Requires-Dist: mlflow>=2.0.0; extra == 'trackers'
Requires-Dist: neptune>=1.0.0; extra == 'trackers'
Requires-Dist: wandb>=0.16.0; extra == 'trackers'
Provides-Extra: wandb
Requires-Dist: wandb>=0.16.0; extra == 'wandb'
Description-Content-Type: text/markdown

# pyrecall

[![PyPI version](https://img.shields.io/pypi/v/pyrecall.svg)](https://pypi.org/project/pyrecall/)
[![CI](https://github.com/Arths17/Pyrecall/actions/workflows/ci.yml/badge.svg)](https://github.com/Arths17/Pyrecall/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
[![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-blue.svg)](https://www.python.org/)
[![PyPI Downloads](https://static.pepy.tech/personalized-badge/pyrecall?period=total&units=INTERNATIONAL_SYSTEM&left_color=BLACK&right_color=GREEN&left_text=downloads)](https://pepy.tech/projects/pyrecall)

**Forgetting detection and skill rollback for fine-tuned LLMs.**

Fine-tune on new data and your model quietly loses what it already knew — coding ability, reasoning, safety guardrails. pyrecall catches it before it ships.

---

## Install

```bash
pip install pyrecall   # Python 3.11–3.14 · CUDA, MPS, and CPU
```

---

## Quickstart

```python
from pyrecall import Model

model = Model("meta-llama/Llama-3.2-1B")
model.snapshot("before")
model.learn("data.jsonl", epochs=3)

if not model.check().is_healthy:
    model.rollback(to="before")
```

```bash
pyrecall init --model meta-llama/Llama-3.2-1B
pyrecall snapshot before_v1
pyrecall learn train.jsonl --snapshot-after after_v1
pyrecall check --before before_v1 --after after_v1
# exit 0 → ship   exit 2 → pyrecall rollback before_v1
```

---

## How it works

Benchmarks 180 prompts across 9 skill categories (reasoning, coding, safety, math, multilingual, and more) using log-likelihood scoring. After training, `check` diffs the scores and flags any category that drops past your threshold (default 10%). Only the LoRA adapter is stored per snapshot — a few hundred MB, not the full model.

Any causal LM on HuggingFace Hub is supported — Llama, Mistral, Phi, Gemma, Qwen, Falcon, GPT-2/Neo/J, and more. LoRA targets are auto-detected.

---

## Docs

Full CLI reference, Python API, experiment tracker integrations (W&B, MLflow, Neptune), custom benchmarks, per-category thresholds, and more:

**[pyrecall.github.io/Pyrecall](https://pyrecall.github.io/Pyrecall/)**

---

## Contributing

```bash
git clone https://github.com/Arths17/Pyrecall
pip install -e ".[dev]"
pytest
```

Open an issue before large changes. MIT — [LICENSE](LICENSE).
