{"id":23671696,"url":"https://github.com/paraglondhe098/torchtrainer","last_synced_at":"2025-12-17T14:30:17.669Z","repository":{"id":252835836,"uuid":"841597962","full_name":"paraglondhe098/TorchTrainer","owner":"paraglondhe098","description":"PyTorch Training Framework: A customizable PyTorch training loop class with support for metrics tracking, early stopping, and callbacks. Includes methods for multi-class and binary accuracy, precision, recall, and R² score calculations.","archived":false,"fork":false,"pushed_at":"2024-12-10T19:10:24.000Z","size":65,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-29T10:19:34.937Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paraglondhe098.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-12T18:16:18.000Z","updated_at":"2024-12-10T19:10:27.000Z","dependencies_parsed_at":"2024-08-17T07:16:44.950Z","dependency_job_id":null,"html_url":"https://github.com/paraglondhe098/TorchTrainer","commit_stats":null,"previous_names":["paraglondhe098/torchtrainer"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paraglondhe098%2FTorchTrainer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paraglondhe098%2FTorchTrainer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paraglondhe098%2FTorchTrainer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paraglondhe098%2FTorchTrainer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paraglondhe098","download_url":"https://codeload.github.com/paraglondhe098/TorchTrainer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239690074,"owners_count":19681035,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-29T10:19:50.076Z","updated_at":"2025-12-17T14:30:17.622Z","avatar_url":"https://github.com/paraglondhe098.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PyTorch Training Framework\n\nThis repository provides a versatile PyTorch training framework to simplify and enhance the model training process. It includes support for metrics tracking, early stopping, and customizable callbacks.\n\n## Features\n\n- **Metrics Tracking:** Calculate and monitor multi-class and binary accuracy, precision, recall, and R² score.\n- **Custom Callbacks:** Implement and use custom callbacks for various training events.\n- **Early Stopping:** Automatically halt training based on validation loss to avoid overfitting.\n- **Mixed Precision Training:** Utilize mixed precision for improved performance on CUDA-enabled GPUs.\n- **Detailed Reporting:** Get clear and comprehensive reports of training and validation metrics.\n\n## Installation\n\n1. Clone the repository:\n\n    ```bash\n    git clone https://github.com/paraglondhe098/torchtrainer.git\n    cd torchtrainer\n    ```\n\n2. Install the required dependencies:\n\n    ```bash\n    pip install -r requirements.txt\n    ```\n\n## Usage\n\nHere is a basic example of how to use the `Trainer` class:\n\n```python\nimport torch\nimport torch.nn as nn\nimport torch.optim as optim\nfrom torchtrainer import Trainer, IntraEpochReport, EarlyStopping\n\n# Define model, criterion, and optimizer\nmodel = nn.Sequential(nn.Linear(10, 1))\ncriterion = nn.MSELoss()\noptimizer = optim.SGD(model.parameters(), lr=0.01)\n\n# Create the Trainer instance\ntrainer = Trainer(\n    model=model,\n    epochs=10,\n    criterion=criterion,\n    optimizer=optimizer,\n    metrics=['accuracy'],\n    mixed_precision_training=True\n)\n\n# Add callbacks\ntrainer.add_callback(IntraEpochReport(reports_per_epoch=10))\ntrainer.add_callback(EarlyStopping(basis='vloss', patience=3))\n\n# Prepare your data loaders\ntrain_loader = ...\nval_loader = ...\n\n# Train the model\ntrainer.fit(train_loader, val_loader)\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparaglondhe098%2Ftorchtrainer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparaglondhe098%2Ftorchtrainer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparaglondhe098%2Ftorchtrainer/lists"}