Metadata-Version: 2.4
Name: peftfactory
Version: 0.9.4.7
Summary: Unified Parameter-Efficient Fine-Tuning of 100+ LLMs
Home-page: https://github.com/kinit-sk/PEFT-Factory
Author: rbelanec
Author-email: robert.belanec@kinit.sk
License: Apache 2.0 License
Keywords: AI,LLM,GPT,ChatGPT,Llama,Transformer,DeepSeek,Pytorch
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
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.9.0
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: transformers!=4.52.0,<=4.56.2,>=4.49.0; python_version < "3.10"
Requires-Dist: transformers!=4.52.0,<=4.57.0,>=4.49.0; python_version >= "3.10"
Requires-Dist: datasets<=4.0.0,>=2.16.0
Requires-Dist: accelerate<=1.11.0,>=1.3.0
Requires-Dist: peft<=0.17.2,>=0.14.0
Requires-Dist: trl<=0.9.6,>=0.8.6
Requires-Dist: gradio<=5.45.0,>=4.38.0
Requires-Dist: matplotlib>=3.7.0
Requires-Dist: tyro<0.9.0
Requires-Dist: spaces
Requires-Dist: einops
Requires-Dist: numpy<2.0.0
Requires-Dist: pandas>=2.0.0
Requires-Dist: scipy
Requires-Dist: evaluate
Requires-Dist: codebleu
Requires-Dist: sentencepiece
Requires-Dist: tiktoken
Requires-Dist: modelscope>=1.14.0
Requires-Dist: hf-transfer
Requires-Dist: safetensors<=0.5.3
Requires-Dist: fire
Requires-Dist: omegaconf
Requires-Dist: packaging
Requires-Dist: protobuf
Requires-Dist: pyyaml
Requires-Dist: pydantic<=2.10.6
Requires-Dist: aenum
Requires-Dist: uvicorn
Requires-Dist: fastapi
Requires-Dist: sse-starlette
Requires-Dist: av
Requires-Dist: librosa
Requires-Dist: adapters
Provides-Extra: torch
Requires-Dist: torch>=2.0.0; extra == "torch"
Requires-Dist: torchvision>=0.15.0; extra == "torch"
Provides-Extra: torch-npu
Requires-Dist: torch-npu==2.5.1; extra == "torch-npu"
Requires-Dist: torchvision==0.20.1; extra == "torch-npu"
Requires-Dist: decorator; extra == "torch-npu"
Provides-Extra: metrics
Requires-Dist: nltk; extra == "metrics"
Requires-Dist: jieba; extra == "metrics"
Requires-Dist: rouge-chinese; extra == "metrics"
Provides-Extra: deepspeed
Requires-Dist: deepspeed<=0.16.9,>=0.10.0; extra == "deepspeed"
Provides-Extra: liger-kernel
Requires-Dist: liger-kernel>=0.5.5; extra == "liger-kernel"
Provides-Extra: bitsandbytes
Requires-Dist: bitsandbytes>=0.39.0; extra == "bitsandbytes"
Provides-Extra: hqq
Requires-Dist: hqq; extra == "hqq"
Provides-Extra: eetq
Requires-Dist: eetq; extra == "eetq"
Provides-Extra: gptq
Requires-Dist: optimum>=1.24.0; extra == "gptq"
Requires-Dist: gptqmodel>=2.0.0; extra == "gptq"
Provides-Extra: aqlm
Requires-Dist: aqlm[gpu]>=1.1.0; extra == "aqlm"
Provides-Extra: vllm
Requires-Dist: vllm<=0.10.2,>=0.4.3; extra == "vllm"
Provides-Extra: sglang
Requires-Dist: sglang[srt]>=0.4.5; extra == "sglang"
Requires-Dist: transformers==4.51.1; extra == "sglang"
Provides-Extra: galore
Requires-Dist: galore-torch; extra == "galore"
Provides-Extra: apollo
Requires-Dist: apollo-torch; extra == "apollo"
Provides-Extra: badam
Requires-Dist: badam>=1.2.1; extra == "badam"
Provides-Extra: adam-mini
Requires-Dist: adam-mini; extra == "adam-mini"
Provides-Extra: minicpm-v
Requires-Dist: soundfile; extra == "minicpm-v"
Requires-Dist: torchvision; extra == "minicpm-v"
Requires-Dist: torchaudio; extra == "minicpm-v"
Requires-Dist: vector_quantize_pytorch; extra == "minicpm-v"
Requires-Dist: vocos; extra == "minicpm-v"
Requires-Dist: msgpack; extra == "minicpm-v"
Requires-Dist: referencing; extra == "minicpm-v"
Requires-Dist: jsonschema_specifications; extra == "minicpm-v"
Provides-Extra: openmind
Requires-Dist: openmind; extra == "openmind"
Provides-Extra: swanlab
Requires-Dist: swanlab; extra == "swanlab"
Provides-Extra: fp8
Requires-Dist: torchao>=0.8.0; extra == "fp8"
Requires-Dist: accelerate>=1.10.0; extra == "fp8"
Provides-Extra: fp8-te
Requires-Dist: transformer_engine[pytorch]>=2.0.0; extra == "fp8-te"
Requires-Dist: accelerate>=1.10.0; extra == "fp8-te"
Provides-Extra: fp8-all
Requires-Dist: torchao>=0.8.0; extra == "fp8-all"
Requires-Dist: transformer_engine[pytorch]>=2.0.0; extra == "fp8-all"
Requires-Dist: accelerate>=1.10.0; extra == "fp8-all"
Provides-Extra: dev
Requires-Dist: pre-commit; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: build; extra == "dev"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

![# PEFT Factory](assets/logo.png)


<div align="center" markdown="1">

----

### Parameter-Efficient Fine-Tuning made easy

PEFT-Factory is a fork of [LLaMa-Factory](https://github.com/hiyouga/LLaMA-Factory) ❤️, upgraded with easy to use **PEFT interface**, support for **HuggingFace PEFT methods** and **datasets** for benchmarking PEFT.
</div>


---
<div align="center" markdown="1">

### Supported methods

| PEFT method name            | Support |
|-----------------------------|---------|
| LoRA (including variants)   | ✅ 🦙  |
| OFT                         | ✅ 🦙  |
| Prefix Tuning               | ✅ 🤗  |
| Prompt Tuning               | ✅ 🤗  |
| P-Tuning                    | ✅ 🤗  |
| P-Tuning v2                 | ✅ 🤗  |
| MPT                         | ✅ 🤗  |
| IA3                         | ✅ 🤗  |
| LNTuning                    | ✅ 🤗  |
| Bottleneck Adapter          | ✅ 🤖  |
| Parallal Adapter            | ✅ 🤖  |
| SeqBottleneck Adapter       | ✅ 🤖  |
| SVFT                        | ✅ ⚙️  |
| BitFit                      | ✅ ⚙️  |


</div>

# Usage

This section provides instructions on how to install PEFT-Factory, download necessary data and methods, and run training using both command line and web UI.

## Quickstart

For video example please visit the [PEFT-Factory Demonstration
Video](https://www.youtube.com/watch?v=Q3kxvlyO-XY).

``` bash
# install package
pip install peftfactory

# dowload repo that contains data, PEFT methods and examples
git clone https://github.com/kinit-sk/PEFT-Factory.git && cd PEFT-Factory

# start web UI
pf webui
```

Alternatively, you can run training from command line:

``` bash
# install package
pip install peftfactory

# dowload repo that contains data, PEFT methods and examples
git clone https://github.com/kinit-sk/PEFT-Factory.git && cd PEFT-Factory
```

### Create some variables for envsubst

``` bash
# run training with config file
TIMESTAMP=`date +%s`
OUTPUT_DIR="saves/bitfit/llama-3.2-1b-instruct/train_wsc_${TIMESTAMP}"
DATASET="wsc"
SEED=123
WANDB_PROJECT="peft-factory-train-bitfit"
WANDB_NAME="bitfit_llama-3.2-1b-instruct_train_wsc"

mkdir -p "${OUTPUT_DIR}"

export OUTPUT_DIR DATASET SEED WANDB_PROJECT WANDB_NAME
```

### Use the template

Utility `envsubst` replaces the occurances of env variables with their values (see the template).

```bash
envsubst < examples/peft/bitfit/llama-3.2-1b-instruct/train.yaml > ${OUTPUT_DIR}/train.yaml
```

### Run the factory

```bash
peftfactory-cli train ${OUTPUT_DIR}/train.yaml
```

## Installation

There are multiple ways to install PEFT-Factory. You can install
develelopment version from source or install the latest release from PyPI.

### Using pip

```bash
pip install peftfactory
```

### From Source

#### Clone the repository

```bash
git clone git@github.com:kinit-sk/PEFT-Factory.git
```

#### Build the wheel package

```bash
make build
```

#### Install with pip

```bash
pip install dist/[name of the built package].whl
```

## Get data and methods

To download data, methods and examples for training please download the
repository from GitHub.

```bash
git clone https://github.com/kinit-sk/PEFT-Factory.git && cd PEFT-Factory
```

## Run training

You can run training from command line or using web UI.

### From Command Line

To run training from command line use the following command:

```bash
pf train [path to config file].yaml
```

### Using web UI

To run the web UI use the following command:

```bash
pf webui
```
