SAFT: Self-Attention Factor-Tuning for Parameter-Efficient Fine-Tuning
Project description
SAFT: Self-Attention Factor-Tuning
A highly efficient fine-tuning technique for large-scale neural networks.
Table of Contents
Quickstart
Easily install SAFT using pip and get started with a simple example.
Installation
pip install saft
Example Usage
from saft.saft import saft
if __name__ == "__main__":
saft_instance = saft(
model='vit_base_patch16_224',
num_classes=get_classes_num('oxford_flowers102'),
validation_interval=1,
rank=3,
scale=10
)
# Replace with your PyTorch DataLoader objects
# train_dl, test_dl = [your data in a pytorch dataloader]
# saft_instance.upload_data(train_dl, test_dl)
saft_instance.train(10)
trained_model = saft_instance.model
VTAB-1k Test
To run tests on the VTAB-1K dataset, follow these steps:
- Visit the SSF Data Preparation page to download the VTAB-1K dataset.
- Place the downloaded dataset folders in
<YOUR PATH>/SAFT/data/
.
Pretrained Model
For a quick start, download the pretrained ViT-B/16 model:
- Download ViT-B/16
- Place the downloaded model in
<YOUR PATH>/SAFT/ViT-B_16.npz
.
Results
Achieve remarkable performance with only 0.055 million trainable backbone parameters using ViT-B/16.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
saft-1.2.0.tar.gz
(5.5 kB
view details)
Built Distribution
saft-1.2.0-py3-none-any.whl
(8.5 kB
view details)
File details
Details for the file saft-1.2.0.tar.gz
.
File metadata
- Download URL: saft-1.2.0.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a5e91c16aa28fe202ad1cb7412f35a30c9011df9f70c4107ea3b5472a532f85 |
|
MD5 | 86a0d8bfcf829688ed67676009316cf0 |
|
BLAKE2b-256 | f45dbee81d18b213602e34d342f7d92ee68fdb396a4db17c980ce22c3169f1a4 |
File details
Details for the file saft-1.2.0-py3-none-any.whl
.
File metadata
- Download URL: saft-1.2.0-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 05cb716e281e3595735b541110e4f3da96ca7fef396ebf665345f6c52c1ed42c |
|
MD5 | a9c0fd956f6e9ec4107b202a75312e50 |
|
BLAKE2b-256 | 471ef319c0bd3431159d5e7f98d47656a64344537fc60c37530f5c35b0850f3a |