Metadata-Version: 2.4
Name: peftfactory
Version: 0.9.4.6
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>


### Installation
⚠️ Currently, the best way is to install from this repository. This will change soon.

#### Clone the repository

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

#### Build the wheel
```bash
make build
```

#### Install wiht pip
```bash
pip install dist/llamafactory-0.9.4.dev0-py3-none-any.whl
```

### Quickstart
Quick start of prefix tuning with LLaMa3-8B-Instruct for CB dataset. We are using the template from examples directory, but feel free to use your own `config.yml`.


#### Create some variables for `envsubst`

```bash
TIMESTAMP=`date +%s`
OUTPUT_DIR="saves/prefix-tuning/llama-3-8b-instruct/train_cb_${TIMESTAMP}"
DATASET="cb"
SEED=123
WANDB_PROJECT="peft-factory-train-prefix-tuning"
WANDB_NAME="prefix-tuning_llama-3-8b-instruct_train_cb"

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](https://github.com/Wicwik/PEFT-Factory/blob/main/examples/peft/prefix-tuning/llama-3-8b-instruct/train.yaml)).

```bash
envsubst < examples/peft/prefix-tuning/llama-3-8b-instruct/train.yaml > ${OUTPUT_DIR}/train.yaml
```

#### Run the factory
```bash
llamafactory-cli train ${OUTPUT_DIR}/train.yaml
```

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

### Supported methods

| PEFT method name           | Support |
| -------------------------- | ------- |
| LoRA (including variants)  | ✅ 🦙  |
| Prefix Tuning              | ✅ 🤗  |
| Prompt Tuning              | ✅ 🤗  |
| P-Tuning                   | ✅ 🤗  |
| LNTuning                   | ✅ 🤗  |
| SVD                        | ✅ ⚙️  |
| BitFit                     | ✅ ⚙️  |


</div>
