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.1.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.1-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ai_common_utilss-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 ac5471baac948c21c4fc9cc7e4a64da7323d6f54450ec60ff0c71bee553af632
MD5 bbeb730848387b26bd6473ead7b54e72
BLAKE2b-256 2ae75c8e2d0790989327362be4070aa78510cf6ee297b1602e7f9c7c33dea157

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ai_common_utilss-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.6 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b7710d2b67837bcf5b5dbdbf155a859523bfb4c8b524f57983ff00a85c5a454d
MD5 1cb9be10d90ff4592af87efc53d6593f
BLAKE2b-256 59eb2cc3de736de781b659660a2ec112e62d99519b7d90773501eee6b5fff5fb

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