Skip to main content

A training helper for LLM.

Project description

Using Singular Value Decomposition (SVD) to reduce the dimensionality of the trainable parameters in a neural network

Introduction

TBD

Usage

from transformers import AutoTokenizer, AutoModelForCausalLM
from svd_training.svd_model import SVDForCausalLM

filename = "mistralai/Mistral-7B-Instruct-v0.1"
tokenizer = AutoTokenizer.from_pretrained(filename)
model = AutoModelForCausalLM.from_pretrained(filename)

svd_model = SVDForCausalLM.create_from_model(model, rank_fraction=0.1) # Create the SVD model

### Train the model using your favourite training loop
...
###

svd_model.merge()  # Merge the SVD layers back into the model
svd_model.save_pretrained("svd_model/")  # Save the model

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

svd_training-0.0.2-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file svd_training-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: svd_training-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.10.0 requests/2.31.0 setuptools/52.0.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/3.9.2

File hashes

Hashes for svd_training-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f7263cf8aeda532678dd8e84ab57559033601e097e6c33b498c3c767952af7d1
MD5 fb9939afcbd937241867ad4e10feec4b
BLAKE2b-256 31b4d3d8bfa97c90704db405d5bcc418d1b8986283ca50af86a7451378bac9d9

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