Skip to main content

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

Metadata

Release files for ai-common-utilss 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ai-common-utilss 0.1.3
File Size Uploaded Provenance Actions
ai_common_utilss-0.1.3.tar.gz 2.9 kB Without provenance Details for ai_common_utilss-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ai-common-utilss 0.1.3
File Interpreter ABI Platform Actions
ai_common_utilss-0.1.3-py3-none-any.whl Python 3 none any Details for ai_common_utilss-0.1.3-py3-none-any.whl

Total release size: 7.4 kB

Release files / ai_common_utilss-0.1.3.tar.gz

Download URL ai_common_utilss-0.1.3.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
21faf23a8912d84c94ec5368d28de8015e0a2cedf91cc3593c3df963e901130c
BLAKE2b-256 checksum
How to use checksums
92593840eefa3600350e50a91c293ca518c51db122e27e054096e9ce27d8b7e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.13.5 Windows/11

Release files / ai_common_utilss-0.1.3-py3-none-any.whl

Download URL ai_common_utilss-0.1.3-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
845e6e7c57139f0725b3ebc4130b77e4bc5bf5253602d2948b295d9dbf367a6e
BLAKE2b-256 checksum
How to use checksums
b5ebb5bc3ed80224154b02fc1544e9fd10145d796bb73d6f7eb0297461042ac2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.13.5 Windows/11

Security for ai-common-utilss 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page