What happened:
examples/MOT17/multiedge_inference_bench/pedestrian_tracking/testalgorithms/reid/m3l/basemodel.py contains multiple issues that affect portability, reliability, and PyTorch compatibility:
- Checkpoint architecture parsing assumes filenames follow a strict pattern and crashes with
AttributeError when they do not.
- Hardcoded
.cuda() calls fail on CPU-only and Apple Silicon (MPS) environments.
- Deprecated
addmm_() overload triggers warnings on PyTorch 2.x.
- Runtime messages use
print() instead of the project's logging infrastructure.
These issues were reproduced on macOS Apple Silicon using PyTorch 2.8.0.
What you expected to happen:
- Invalid checkpoint filenames should raise a clear error message instead of an unhandled exception.
- Device selection should automatically support
CUDA, MPS, and CPU environments.
- Distance computation should run without PyTorch deprecation warnings.
- Runtime output should use the project's logger rather than direct
print() statements.
How to reproduce it (as minimally and precisely as possible):
Bug 1: Invalid checkpoint filename crash
Current code:
arch = re.compile("_([a-zA-Z]+).pth").search(model_url).group(1)
Reproduction:
import re
for url in [
"model_v2.pth",
"checkpoint.pth",
"/path/to/model.pth",
]:
re.compile("_([a-zA-Z]+).pth").search(url).group(1)
Result:
AttributeError: 'NoneType' object has no attribute 'group'
Bug 2: Hardcoded CUDA dependency
Current code:
self.model.cuda()
inputs = to_torch(inputs).cuda()
Reproduction:
import torch
x = torch.tensor([1])
x.cuda()
Result:
AssertionError: Torch not compiled with CUDA enabled
Bug 3: Deprecated addmm_() overload
Current code:
dist_m.addmm_(1, -2, x, y.t())
Result:
UserWarning: This overload of addmm_ is deprecated:
addmm_(Number beta, Number alpha, Tensor mat1, Tensor mat2)
Bug 4: Direct print() statements
Current code:
print("=> Loaded checkpoint '{}'".format(model_url))
print("Extract Features: [{}/{}]\t"...)
These bypass the project's logging framework and produce inconsistent runtime output.
Anything else we need to know?:
Environment:
- OS: macOS 14 (Apple Silicon ARM64)
- Python: 3.9
- PyTorch: 2.8.0
- CUDA: Not available
- MPS: Available
I have prepared fixes and regression tests covering all four issues in basemodel.py.
What happened:
examples/MOT17/multiedge_inference_bench/pedestrian_tracking/testalgorithms/reid/m3l/basemodel.pycontains multiple issues that affect portability, reliability, and PyTorch compatibility:AttributeErrorwhen they do not..cuda()calls fail on CPU-only and Apple Silicon (MPS) environments.addmm_()overload triggers warnings on PyTorch 2.x.print()instead of the project's logging infrastructure.These issues were reproduced on macOS Apple Silicon using PyTorch 2.8.0.
What you expected to happen:
CUDA,MPS, andCPUenvironments.print()statements.How to reproduce it (as minimally and precisely as possible):
Bug 1: Invalid checkpoint filename crash
Current code:
Reproduction:
Result:
Bug 2: Hardcoded CUDA dependency
Current code:
Reproduction:
Result:
Bug 3: Deprecated
addmm_()overloadCurrent code:
Result:
Bug 4: Direct
print()statementsCurrent code:
These bypass the project's logging framework and produce inconsistent runtime output.
Anything else we need to know?:
Environment:
I have prepared fixes and regression tests covering all four issues in
basemodel.py.