Skip to content

Develop#2

Merged
Arvindhbabu merged 3 commits into
mainfrom
develop
Jul 8, 2026
Merged

Develop#2
Arvindhbabu merged 3 commits into
mainfrom
develop

Conversation

@Arvindhbabu

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings July 8, 2026 09:32
@Arvindhbabu
Arvindhbabu merged commit 1721f5c into main Jul 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds core training utilities (trainer loop, early stopping, checkpointing, logging) and introduces several tests/ smoke-test scripts intended to exercise these components, plus a config update for dataloader settings.

Changes:

  • Added Trainer, EarlyStopping, and CheckpointManager implementations under src/training/.
  • Added a reusable logger helper in src/utils/logger.py.
  • Added multiple tests/test_*.py scripts and introduced a new dataloader section in configs/default.yaml.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
tests/test_trainer.py Smoke script to run a minimal training loop using the new trainer/checkpoint/early-stopping/logger utilities.
tests/test_split_generator.py Script intended to exercise dataset split generation (currently imports a missing module).
tests/test_sampler.py Script intended to exercise balanced sampling (currently imports missing modules).
tests/test_logger.py Script to validate logger output paths/handlers.
tests/test_early_stopping.py Script to demonstrate early-stopping behavior over a synthetic loss curve.
tests/test_dataloader.py Script intended to validate dataloader creation from config (currently imports a missing module).
tests/test_checkpoint.py Script to validate checkpoint artifact writing (models/metrics/config).
src/utils/logger.py Adds create_logger() helper that logs to file + console.
src/training/trainer.py Adds a generic training loop with validation, checkpointing, and early stopping.
src/training/early_stopping.py Adds an early-stopping utility based on validation loss improvements.
src/training/checkpoint.py Adds a checkpoint manager for run directories, model weights, metrics, and config persistence.
configs/default.yaml Adds a top-level dataloader config block (duplicates existing dataset batch/worker settings).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -0,0 +1,12 @@
from src.datasets.split_generator import DatasetSplitGenerator
Comment thread tests/test_sampler.py
Comment on lines +1 to +2
from src.datasets.sequence_dataset import SequenceDataset
from src.datasets.balanced_sampler import create_balanced_sampler
Comment thread tests/test_dataloader.py
@@ -0,0 +1,26 @@
from src.utils.config import load_config
from src.datasets.dataloader import create_dataloaders
Comment thread src/training/trainer.py
Comment on lines +7 to +9
from pathlib import Path

import torch
Comment thread src/training/trainer.py
Comment on lines +60 to +66
images = batch["sequence"].to(self.device)

labels = batch["label"].to(self.device)

self.optimizer.zero_grad()

outputs = self.model(images)
Comment thread src/training/trainer.py
Comment on lines +118 to +122
epoch_loss = running_loss / len(self.val_loader)

epoch_acc = 100 * correct / total

return epoch_loss, epoch_acc
Comment thread src/utils/logger.py
Comment on lines +28 to +31
logger.setLevel(logging.INFO)

logger.handlers.clear()


def __init__(self, root_dir="outputs/runs"):

timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
"w",
) as f:

yaml.dump(config, f)
Comment thread configs/default.yaml
Comment on lines +36 to +40
dataloader:
batch_size: 8
num_workers: 4
pin_memory: true
drop_last: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants