Skip to main content

argus-logo

PyPI version Documentation Status Test CodeFactor codecov Downloads

Argus is a lightweight library for training neural networks in PyTorch.

Documentation

https://pytorch-argus.readthedocs.io

Installation

Requirements:

  • torch>=2.0.0

From pip:

pip install pytorch-argus

From source:

pip install -U git+https://github.com/lRomul/argus.git@dev

Example

Simple image classification example with create_model from pytorch-image-models:

from torch.utils.data import DataLoader
from torchvision.datasets import MNIST
from torchvision.transforms import Compose, ToTensor, Normalize

import timm

import argus
from argus.callbacks import MonitorCheckpoint, EarlyStopping, ReduceLROnPlateau


def get_data_loaders(batch_size):
    data_transform = Compose([ToTensor(), Normalize((0.1307,), (0.3081,))])
    train_mnist_dataset = MNIST(download=True, root="mnist_data",
                                transform=data_transform, train=True)
    val_mnist_dataset = MNIST(download=False, root="mnist_data",
                              transform=data_transform, train=False)
    train_loader = DataLoader(train_mnist_dataset,
                              batch_size=batch_size, shuffle=True)
    val_loader = DataLoader(val_mnist_dataset,
                            batch_size=batch_size * 2, shuffle=False)
    return train_loader, val_loader


class TimmModel(argus.Model):
    nn_module = timm.create_model


if __name__ == "__main__":
    train_loader, val_loader = get_data_loaders(batch_size=256)

    params = {
        'nn_module': {
            'model_name': 'tf_efficientnet_b0_ns',
            'pretrained': False,
            'num_classes': 10,
            'in_chans': 1,
            'drop_rate': 0.2,
            'drop_path_rate': 0.2
        },
        'optimizer': ('Adam', {'lr': 0.01}),
        'loss': 'CrossEntropyLoss',
        'device': 'cuda'
    }

    model = TimmModel(params)

    callbacks = [
        MonitorCheckpoint(dir_path='mnist', monitor='val_accuracy', max_saves=3),
        EarlyStopping(monitor='val_accuracy', patience=9),
        ReduceLROnPlateau(monitor='val_accuracy', factor=0.5, patience=3)
    ]

    model.fit(train_loader,
              val_loader=val_loader,
              num_epochs=50,
              metrics=['accuracy'],
              callbacks=callbacks,
              metrics_on_train=True)

More examples you can find here. Additional guides on how to customize and use argus component can be found in Guides section.

Why this name, Argus?

The library name is a reference to a planet from World of Warcraft. Argus is the original homeworld of the eredar (a race of supremely talented magic-wielders), now located within the Twisting Nether. It was once described as a utopian world whose inhabitants were both vastly intelligent and highly gifted in magic. It has since been twisted by demonic, chaotic energies and became the stronghold and homeworld of the Burning Legion.

Metadata

Release files for pytorch-argus 1.1.0

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

Source distribution (sdist)

Source distribution for pytorch-argus 1.1.0
File Size Uploaded Provenance
pytorch_argus-1.1.0.tar.gz 32.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pytorch-argus 1.1.0
File Interpreter ABI Platform
pytorch_argus-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 66.8 kB

Release files / pytorch_argus-1.1.0.tar.gz

Download URL pytorch_argus-1.1.0.tar.gz
Size 32.0 kB
Tags Source
SHA-256 checksum
How to use checksums
09bea32e826f0e922d362be99d924329a054d30d7fb83207bc6e41d37ac71643
BLAKE2b-256 checksum
How to use checksums
ca24d87967dcd1f8b0b5d23e16de908f308d94ccb82fd79c1fe36762088472f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / pytorch_argus-1.1.0-py3-none-any.whl

Download URL pytorch_argus-1.1.0-py3-none-any.whl
Size 34.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
175ef698ecff2794746a90917311280d1a7def478ef83049495678e96d656856
BLAKE2b-256 checksum
How to use checksums
18b3be52f9a87f76d2e1454cc40a523705b2831fc6610ccc227646910e012745
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Security for pytorch-argus 1.1.0

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.

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