Skip to main content

No project description provided

Project description

SmolHub

A lightweight package for fine-tuning language models using LoRA (Low-Rank Adaptation).

Installation

pip install smolhub

Usage

from smolhub.scripts.finetune import SFTTrainer
from smolhub.scripts.lora import LoRAModel
from transformers import AutoModelForCausalLM, AutoTokenizer

# Load model and tokenizer
model = AutoModelForCausalLM.from_pretrained("openai-community/gpt2")
tokenizer = AutoTokenizer.from_pretrained("openai-community/gpt2")

# Apply LoRA
lora_model = LoRAModel(model)

# Initialize trainer and train
trainer = SFTTrainer(
    model=lora_model,
    train_dataloader=train_dataloader,
    val_dataloader=val_dataloader,
    test_dataloader=test_dataloader,
    optimizer=optimizer,
    scheduler=scheduler
)

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

smolhub-0.5.0.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

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

smolhub-0.5.0-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file smolhub-0.5.0.tar.gz.

File metadata

  • Download URL: smolhub-0.5.0.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for smolhub-0.5.0.tar.gz
Algorithm Hash digest
SHA256 0277c182e2a3ef208eef3eb7c00ed309d0c6d8edc1cf18c702336dc50f2ae019
MD5 9d90fa974ad61f81c8163e0e2ad9f88a
BLAKE2b-256 b86c7c7e1fbe6a3d244ab1540089374418c71e7ebbc3288bc59a41032c9100f5

See more details on using hashes here.

File details

Details for the file smolhub-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: smolhub-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for smolhub-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 808d8a7f5cc2b5267d00cfa203d98bbb1cbdbf77d116df605519082d2acb3323
MD5 90b985c0c233a5cae6d5801e592e3360
BLAKE2b-256 d6afff3e23fd5d9a2fcb900e0720f0ad18e3a9bcf3b280c7af5d6e7caf0af30e

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