wildedge-python icon indicating copy to clipboard operation
wildedge-python copied to clipboard

timm models are registered by class name, so resnet18 and resnet50 share one id

Open piotrekno1 opened this issue 1 month ago • 0 comments

What happens

timm.create_model("resnet18") registers with model id and name ResNet, the class name. PytorchExtractor.extract_info uses type(obj).__name__, and the timm patch (install_timm_patch) doesn't pass the model name it was called with.

So every timm architecture of one class shares an id: resnet18, resnet50 and resnet101 all become ResNet. The registry returns the first handle for the later ones, so their loads and inferences are counted under one model with the first one's metadata.

Expected

Use the name passed to create_model (or model.pretrained_cfg["architecture"], which timm sets) as the model id and name, unless the caller gives an id.

Repro

client.instrument("timm")
timm.create_model("resnet18")
timm.create_model("resnet50")
# both registered as "ResNet"

Seen in the compat suite with timm 1.0.30.

🤖 Generated with Claude Code

piotrekno1 avatar Oct 20 '26 13:10 piotrekno1