Skip to content

[Bug] DeepLense_Classification_Transformers: Missing dependencies, broken APIs, and deprecated calls prevent running #191

@Ganglet

Description

@Ganglet

Description

Attempting to run train.py and eval.py in DeepLense_Classification_Transformers_Archil_Srivastava/
fails due to multiple missing dependencies, breaking API changes, and deprecated function calls.

Tested on: macOS, Python 3.11, PyTorch 2.x

Issues Found

1. No requirements.txt

Running python train.py crashes repeatedly with missing modules:

  • ModuleNotFoundError: No module named 'wandb'
  • ModuleNotFoundError: No module named 'einops'
  • ModuleNotFoundError: No module named 'timm'
  • ModuleNotFoundError: No module named 'torchmetrics'

There is no requirements.txt or setup.py to install dependencies.

2. Broken torchmetrics API (eval.py:59-61)

torchmetrics >= 0.11 requires a task= argument for all functional calls. Current code:

accuracy_fn(logits, y, num_classes=NUM_CLASSES)
auroc_fn(logits, y, num_classes=NUM_CLASSES, average=None)

Both throw: TypeError: auroc() missing 1 required positional argument: 'task'

Fix: Add task="multiclass" to both calls.

3. Deprecated torch.has_mps (utils.py:32)

UserWarning: 'has_mps' is deprecated, please use 'torch.backends.mps.is_built()'

4. Removed verbose= param in CosineAnnealingWarmRestarts (train.py:322)

CosineAnnealingWarmRestarts(optimizer, T_0=15, T_mult=1, eta_min=1e-6, verbose=True)

verbose was removed in newer PyTorch versions. Running with --decay_lr crashes.

Proposed Fix

  • Add requirements.txt with pinned versions
  • Fix torchmetrics calls with task="multiclass"
  • Replace torch.has_mps with torch.backends.mps.is_built()
  • Remove verbose=True from scheduler

I'll submit a PR addressing all of these.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions