Skip to main content

"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


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sorsa-1.0.1-py3-none-any.whl (58.9 kB view details)

Uploaded Python 3

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

Hashes for sorsa-1.0.1.tar.gz
Algorithm Hash digest
SHA256 02834961b03629b705b8ddeff5a4831411b4a9f03e789b53bf4daa6d973cb741
MD5 4a11632b2a0c34dfcc158dce8f7a838e
BLAKE2b-256 f2f6ebc3881c9efbc18439a273d80f8397ed58a7cf94f45ccd6a039a18c02858

See more details on using hashes here.

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

Hashes for sorsa-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 175ccfdf9f54c1160ad64f6babf91ed6915f06d77cc8339cf6f8bdf493752414
MD5 a957a97cfd410f7d2db308de830d35e3
BLAKE2b-256 624c02854a54c42fed3471267ff28151f3e523728505a1562029404cbd54f01c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page