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.3.tar.gz (2.9 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.3-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ai_common_utilss-0.1.3.tar.gz
  • Upload date:
  • Size: 2.9 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.3.tar.gz
Algorithm Hash digest
SHA256 21faf23a8912d84c94ec5368d28de8015e0a2cedf91cc3593c3df963e901130c
MD5 98f7005194984dc1b446ec2ab19c66d9
BLAKE2b-256 92593840eefa3600350e50a91c293ca518c51db122e27e054096e9ce27d8b7e6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ai_common_utilss-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 4.5 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 845e6e7c57139f0725b3ebc4130b77e4bc5bf5253602d2948b295d9dbf367a6e
MD5 ccb26b3a519025562268d1660b4a3562
BLAKE2b-256 b5ebb5bc3ed80224154b02fc1544e9fd10145d796bb73d6f7eb0297461042ac2

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