Skip to main content

No project description provided

Project description

AI Common Utils - Trainer Module

This repository contains a reusable trainer class for PyTorch model training.

Installation

pip install ai-common-utils

Usage:

from ai_common_utils.trainer import Trainer

trainer = Trainer()
train_losses, train_accuracies, val_losses, val_accuracies= trainer.train(model=model,
                                                                        train_dl=train_dl,
                                                                        val_dl=val_dl,
                                                                        epochs=epochs,
                                                                        loss_fn=loss_fn,
                                                                        optimizer=optimizer,
                                                                        status_freq=20,
                                                                        checkpoint_freq=40,
                                                                        chk_point_file='model_weights.pth',
                                                                        device=device
                                                                        )

Details

  • Returns: Lists of (train_losses, train_accuracies, val_losses, val_accuracies) per epoch
  • Progress: Prints train/val metrics every status_freq batches
  • Checkpoints: Saves model weights to chk_point_file every checkpoint_freq batches

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

ai_common_utilss-0.1.2.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

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

ai_common_utilss-0.1.2-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file ai_common_utilss-0.1.2.tar.gz.

File metadata

  • Download URL: ai_common_utilss-0.1.2.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.5 Windows/11

File hashes

Hashes for ai_common_utilss-0.1.2.tar.gz
Algorithm Hash digest
SHA256 1942bc5e08545389313b1622be92beecb582cd8b3e52ce4de7fad2b720d674b2
MD5 eb09232ff88f83e96ca4f235b3a6dece
BLAKE2b-256 899938767ed82e3eca6214be9f4190075709ed6ead0f0257a5ff1880be1225f0

See more details on using hashes here.

File details

Details for the file ai_common_utilss-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: ai_common_utilss-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.5 Windows/11

File hashes

Hashes for ai_common_utilss-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 345be4b1f862ffb8b425589b49edec87453b4186f63d9e2e6dd7e6ea22a9ad98
MD5 03f7bca4eef9de5899142acf74afc359
BLAKE2b-256 ec3e6ce3b8b03bf178e136b6cf9a2d3b721b02b4f9fe867bbe5d208e5e5218f2

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