"SORSA: Singular Values and Orthonormal Regularized Singular Vectors Adaptation of Large Language Models" implementation intergrated with Hugging Face transformers
Project description
SORSA Python Package
Initialize SORSA model:
from sorsa import SORSAConfig, SORSAModel, SORSATrainer, SORSATrainingArguments
config = SORSAConfig(
base_model_name_or_path="meta-llama/Llama-2-7b-hf",
target_modules=[
"q_proj",
"o_proj",
"k_proj",
"v_proj",
"gate_proj",
"up_proj",
"down_proj",
],
rank=16,
dropout=0,
)
sorsaModel = SORSAModel(config)
self.model.to("cuda")
self.model.sorsa_init() # Initialize SORSA adapters.
Train SORSA model:
trainingArguments = SORSATrainingArguments(
# ...
gamma=4e-4,
)
trainer = SORSATrainer(
model=sorsaModel,
args=trainingArguments,
train_dataset=train_dataset,
)
trainer.train()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sorsa-1.0.1.tar.gz
(56.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
sorsa-1.0.1-py3-none-any.whl
(58.9 kB
view details)
File details
Details for the file sorsa-1.0.1.tar.gz.
File metadata
- Download URL: sorsa-1.0.1.tar.gz
- Upload date:
- Size: 56.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02834961b03629b705b8ddeff5a4831411b4a9f03e789b53bf4daa6d973cb741
|
|
| MD5 |
4a11632b2a0c34dfcc158dce8f7a838e
|
|
| BLAKE2b-256 |
f2f6ebc3881c9efbc18439a273d80f8397ed58a7cf94f45ccd6a039a18c02858
|
File details
Details for the file sorsa-1.0.1-py3-none-any.whl.
File metadata
- Download URL: sorsa-1.0.1-py3-none-any.whl
- Upload date:
- Size: 58.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
175ccfdf9f54c1160ad64f6babf91ed6915f06d77cc8339cf6f8bdf493752414
|
|
| MD5 |
a957a97cfd410f7d2db308de830d35e3
|
|
| BLAKE2b-256 |
624c02854a54c42fed3471267ff28151f3e523728505a1562029404cbd54f01c
|