Summary
Two bugs in the M3L ReID algorithm implementation (testalgorithms/reid/m3l/basemodel.py)
block the ReID benchmark job from completing. First, the architecture-inference regex
in load() has no None guard and will crash with AttributeError on any model
filename that does not match a narrow implicit pattern. Second, the pairwise distance
computation in predict() uses the three-positional-float signature of addmm_(), which
was removed in PyTorch 2.0 and raises TypeError on any modern GPU environment.
Environment
- Example:
MOT17/multiedge_inference_bench
- Branch:
main (as of 2026-05-21)
- Files affected:
examples/MOT17/multiedge_inference_bench/pedestrian_tracking/testalgorithms/reid/m3l/basemodel.py
Findings
Finding 1 — Unguarded regex in load() crashes on non-standard model filenames
File: testalgorithms/reid/m3l/basemodel.py
Line: 56
Code:
arch = re.compile("_([a-zA-Z]+).pth").search(model_url).group(1)
Problem:
The load() method attempts to infer the model architecture name from the checkpoint
filename using a regex. There are two compounding issues:
-
No None guard: If model_url does not contain a substring matching
_<letters>.pth, re.search() returns None. Calling .group(1) on None
raises:
AttributeError: 'NoneType' object has no attribute 'group'
Any alternative checkpoint — a fine-tuned model, a renamed download, or a path like
market_best_model.bin — triggers this immediately.
-
Unescaped dot in regex: The pattern "_([a-zA-Z]+).pth" uses an unescaped .
which matches any character, not a literal dot. This is a latent correctness issue
that widens the match unintentionally (e.g., _IBNMeta_pth would match when it
should not).
The current default filename market_IBNMeta.pth.tar happens to satisfy the pattern,
so the bug is invisible unless users bring their own checkpoints.
Impact:
The error occurs at model load time, before any inference runs. Users who provide
alternative checkpoints receive an AttributeError with no indication of which
filename caused the problem or what naming convention is required.
Proposed Fix:
match = re.compile(r"_([a-zA-Z]+)\.pth").search(model_url)
if match is None:
raise ValueError(
f"Cannot infer model architecture from filename: '{model_url}'. "
"Expected a filename containing '_<arch>.pth' (e.g., 'market_IBNMeta.pth.tar')."
)
arch = match.group(1)
Finding 2 — Deprecated addmm_() positional-float API removed in PyTorch 2.0
File: testalgorithms/reid/m3l/basemodel.py
Line: 153
Code:
dist_m.addmm_(1, -2, x, y.t())
Problem:
The call uses the legacy three-positional-float signature
addmm_(beta, alpha, mat1, mat2), where beta and alpha are passed as positional
arguments. This signature was deprecated in PyTorch 1.5 and removed in
PyTorch 2.0. On any current CUDA environment (CUDA 11.8+ ships with PyTorch ≥ 2.0
by default), the call raises:
TypeError: addmm_() received an invalid combination of arguments - got
(int, int, Tensor, Tensor), but expected one of:
* (Tensor mat1, Tensor mat2, *, Scalar beta, Scalar alpha)
The example was written in 2022 when this signature was still valid. It has been silently
broken on current GPU servers since the PyTorch 2.0 release.
Impact:
The crash occurs inside _pairwise_distance(), which is called from predict(). The
model must complete a full forward pass through the dataset before _pairwise_distance()
is reached, so users waste the full inference compute time before hitting the error.
The entire ReID job becomes non-executable on any modern environment.
Proposed Fix:
# Replace positional beta/alpha with keyword arguments (PyTorch ≥ 1.5 compatible):
dist_m.addmm_(x, y.t(), beta=1, alpha=-2)
Steps to Reproduce
Finding 1 (unguarded regex):
- Download any ReID checkpoint with a non-standard filename (e.g., rename
market_IBNMeta.pth.tar to market_best_model.bin).
- Update
m3l_algorithm.yaml → initial_model_url to point to the renamed file.
- Run the ReID job:
ianvs -f examples/MOT17/multiedge_inference_bench/pedestrian_tracking/reid_job.yaml
- Observe:
AttributeError: 'NoneType' object has no attribute 'group' at the
load() step.
Finding 2 (deprecated addmm_):
- Run the ReID job on any machine with PyTorch ≥ 2.0.
- Allow inference to complete.
- Observe:
TypeError: addmm_() received an invalid combination of arguments during
the _pairwise_distance() call inside predict().
Verify PyTorch version: python -c "import torch; print(torch.__version__)".
Any version ≥ 2.0.0 will trigger Finding 2.
Additional Notes
Both bugs are confined to m3l/basemodel.py and require no changes to the ianvs core.
They can be fixed in a single focused PR.
Finding 2 affects any user on a 2024+ GPU server. CUDA 11.8 and later ship with
PyTorch 2.x as the default. It is unlikely that any current contributor can run the
ReID job without encountering this crash.
Summary
Two bugs in the M3L ReID algorithm implementation (
testalgorithms/reid/m3l/basemodel.py)block the ReID benchmark job from completing. First, the architecture-inference regex
in
load()has noNoneguard and will crash withAttributeErroron any modelfilename that does not match a narrow implicit pattern. Second, the pairwise distance
computation in
predict()uses the three-positional-float signature ofaddmm_(), whichwas removed in PyTorch 2.0 and raises
TypeErroron any modern GPU environment.Environment
MOT17/multiedge_inference_benchmain(as of 2026-05-21)examples/MOT17/multiedge_inference_bench/pedestrian_tracking/testalgorithms/reid/m3l/basemodel.pyFindings
Finding 1 — Unguarded regex in
load()crashes on non-standard model filenamesFile:
testalgorithms/reid/m3l/basemodel.pyLine: 56
Code:
Problem:
The
load()method attempts to infer the model architecture name from the checkpointfilename using a regex. There are two compounding issues:
No
Noneguard: Ifmodel_urldoes not contain a substring matching_<letters>.pth,re.search()returnsNone. Calling.group(1)onNoneraises:
Any alternative checkpoint — a fine-tuned model, a renamed download, or a path like
market_best_model.bin— triggers this immediately.Unescaped dot in regex: The pattern
"_([a-zA-Z]+).pth"uses an unescaped.which matches any character, not a literal dot. This is a latent correctness issue
that widens the match unintentionally (e.g.,
_IBNMeta_pthwould match when itshould not).
The current default filename
market_IBNMeta.pth.tarhappens to satisfy the pattern,so the bug is invisible unless users bring their own checkpoints.
Impact:
The error occurs at model load time, before any inference runs. Users who provide
alternative checkpoints receive an
AttributeErrorwith no indication of whichfilename caused the problem or what naming convention is required.
Proposed Fix:
Finding 2 — Deprecated
addmm_()positional-float API removed in PyTorch 2.0File:
testalgorithms/reid/m3l/basemodel.pyLine: 153
Code:
Problem:
The call uses the legacy three-positional-float signature
addmm_(beta, alpha, mat1, mat2), wherebetaandalphaare passed as positionalarguments. This signature was deprecated in PyTorch 1.5 and removed in
PyTorch 2.0. On any current CUDA environment (CUDA 11.8+ ships with PyTorch ≥ 2.0
by default), the call raises:
The example was written in 2022 when this signature was still valid. It has been silently
broken on current GPU servers since the PyTorch 2.0 release.
Impact:
The crash occurs inside
_pairwise_distance(), which is called frompredict(). Themodel must complete a full forward pass through the dataset before
_pairwise_distance()is reached, so users waste the full inference compute time before hitting the error.
The entire ReID job becomes non-executable on any modern environment.
Proposed Fix:
Steps to Reproduce
Finding 1 (unguarded regex):
market_IBNMeta.pth.tartomarket_best_model.bin).m3l_algorithm.yaml→initial_model_urlto point to the renamed file.AttributeError: 'NoneType' object has no attribute 'group'at theload()step.Finding 2 (deprecated
addmm_):TypeError: addmm_() received an invalid combination of argumentsduringthe
_pairwise_distance()call insidepredict().Verify PyTorch version:
python -c "import torch; print(torch.__version__)".Any version ≥ 2.0.0 will trigger Finding 2.
Additional Notes
Both bugs are confined to
m3l/basemodel.pyand require no changes to the ianvs core.They can be fixed in a single focused PR.
Finding 2 affects any user on a 2024+ GPU server. CUDA 11.8 and later ship with
PyTorch 2.x as the default. It is unlikely that any current contributor can run the
ReID job without encountering this crash.