Add timm model support with architecture-aware activation extraction#5
Draft
Add timm model support with architecture-aware activation extraction#5
Conversation
…odel families Co-authored-by: c-mulliken <155586636+c-mulliken@users.noreply.github.com>
Co-authored-by: c-mulliken <155586636+c-mulliken@users.noreply.github.com>
…nfigurable, use dynamic layer selection in tests Co-authored-by: c-mulliken <155586636+c-mulliken@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add compatibility with timm models and update documentation
Add timm model support with architecture-aware activation extraction
Feb 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements timm model compatibility for TVSD benchmarking. Different model architectures (ViT, Swin, ConvNeXt) output varying activation shapes that break the existing pipeline expecting uniform (batch, features) tensors.
Changes
Core implementation:
utils/load_model.py: Enable timm imports, add optionalpretrainedconfig parameter, make RESMAX path configurable viaRESMAX_PATHenv varutils/timm_helpers.py(new): Model family detection and architecture-specific activation processingutils/hooks.py: Integrate model family detection for automatic activation shape handlingTesting:
tests/test_timm.py(new): 16 tests covering model loading, family detection, activation extraction, and shape validation for ResNet, ViT, ConvNeXt, SwinDocumentation:
configs/examples/Usage
Backward compatible with existing torchvision models.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
huggingface.co/usr/bin/python python -m pytest tests/test_timm.py -v(dns block)from utils.load_model import load_model
import torch
Test loading a timm model
print('Testing timm model loading...')
model, model_name, hook_interval = load_model('configs/examples/resnet50.yaml')
print(f'��� Loaded model: {model_name} with hook_inte` (dns block)
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.