From 55de4cdf00a8c884bcbcd8239bfa91a133e48d29 Mon Sep 17 00:00:00 2001 From: Katherine Fairchild Date: Mon, 30 Sep 2024 08:41:58 -0400 Subject: [PATCH 1/3] add resnet50_11ad3fa6 to models (#1282) Co-authored-by: Jenkins --- .../models/resnet50_11ad3fa6/__init__.py | 9 +++++ .../models/resnet50_11ad3fa6/model.py | 35 +++++++++++++++++++ .../models/resnet50_11ad3fa6/requirements.txt | 2 ++ .../models/resnet50_11ad3fa6/test.py | 8 +++++ 4 files changed, 54 insertions(+) create mode 100644 brainscore_vision/models/resnet50_11ad3fa6/__init__.py create mode 100644 brainscore_vision/models/resnet50_11ad3fa6/model.py create mode 100644 brainscore_vision/models/resnet50_11ad3fa6/requirements.txt create mode 100644 brainscore_vision/models/resnet50_11ad3fa6/test.py diff --git a/brainscore_vision/models/resnet50_11ad3fa6/__init__.py b/brainscore_vision/models/resnet50_11ad3fa6/__init__.py new file mode 100644 index 000000000..cdfd7fa38 --- /dev/null +++ b/brainscore_vision/models/resnet50_11ad3fa6/__init__.py @@ -0,0 +1,9 @@ +from brainscore_vision import model_registry +from brainscore_vision.model_helpers.brain_transformation import ModelCommitment +from .model import get_model, get_layers + +model_registry['resnet50_11ad3fa6'] = lambda: ModelCommitment( + identifier='resnet50_11ad3fa6', + activations_model=get_model('resnet50_11ad3fa6'), + layers=get_layers('resnet50_11ad3fa6') +) diff --git a/brainscore_vision/models/resnet50_11ad3fa6/model.py b/brainscore_vision/models/resnet50_11ad3fa6/model.py new file mode 100644 index 000000000..1b4294372 --- /dev/null +++ b/brainscore_vision/models/resnet50_11ad3fa6/model.py @@ -0,0 +1,35 @@ +from brainscore_vision.model_helpers.check_submission import check_models +import functools +import torchvision.models +from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper +from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images + +# This is an example implementation for submitting resnet-50 as a pytorch model + +# Attention: It is important, that the wrapper identifier is unique per model! +# The results will otherwise be the same due to brain-scores internal result caching mechanism. +# Please load your pytorch model for usage in CPU. There won't be GPUs available for scoring your model. +# If the model requires a GPU, contact the brain-score team directly. + + +def get_model(name): + assert name == 'resnet50_11ad3fa6' + model = torchvision.models.resnet50(pretrained=True) + preprocessing = functools.partial(load_preprocess_images, image_size=224) + wrapper = PytorchWrapper( + identifier='resnet50_11ad3fa6', model=model, preprocessing=preprocessing) + wrapper.image_size = 224 + return wrapper + + +def get_layers(name): + assert name == 'resnet50_11ad3fa6' + return ['conv1', 'layer1', 'layer2', 'layer3', 'layer4', 'fc'] + + +def get_bibtex(model_identifier): + return """""" + + +if __name__ == '__main__': + check_models.check_base_models(__name__) diff --git a/brainscore_vision/models/resnet50_11ad3fa6/requirements.txt b/brainscore_vision/models/resnet50_11ad3fa6/requirements.txt new file mode 100644 index 000000000..a56666d38 --- /dev/null +++ b/brainscore_vision/models/resnet50_11ad3fa6/requirements.txt @@ -0,0 +1,2 @@ +torchvision +torch \ No newline at end of file diff --git a/brainscore_vision/models/resnet50_11ad3fa6/test.py b/brainscore_vision/models/resnet50_11ad3fa6/test.py new file mode 100644 index 000000000..28c13e09b --- /dev/null +++ b/brainscore_vision/models/resnet50_11ad3fa6/test.py @@ -0,0 +1,8 @@ +import pytest +import brainscore_vision + + +@pytest.mark.travis_slow +def test_has_identifier(): + model = brainscore_vision.load_model('resnet50_tutorial') + assert model.identifier == 'resnet50_tutorial' From 7e7e0510c4acb7a7949667dd9fb2f1cac9edc1d6 Mon Sep 17 00:00:00 2001 From: Kartik Pradeepan Date: Mon, 30 Sep 2024 09:01:09 -0400 Subject: [PATCH 2/3] Update score_new_plugins.yml to use actions/upload-artifact@v4 (#1283) Current workflow uses v2. This has been causing an automatic failure in scoring jobs. v3 is being deprecated in 2 months. Based on `Breaking Changes` as seen on the actions readme, this should work with a simple replacement of the version number. --- .github/workflows/score_new_plugins.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/score_new_plugins.yml b/.github/workflows/score_new_plugins.yml index 1f4c6a176..cf9c52bdb 100644 --- a/.github/workflows/score_new_plugins.yml +++ b/.github/workflows/score_new_plugins.yml @@ -91,7 +91,7 @@ jobs: echo "$PLUGIN_INFO" > plugin-info.json - name: Upload PLUGIN_INFO as an artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: plugin-info path: plugin-info.json @@ -114,7 +114,7 @@ jobs: needs: extract_email steps: - name: Download PLUGIN_INFO artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: plugin-info path: artifact-directory @@ -144,7 +144,7 @@ jobs: echo "$PLUGIN_INFO" > plugin-info.json - name: Upload PLUGIN_INFO as an artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: plugin-info path: plugin-info.json @@ -161,7 +161,7 @@ jobs: steps: - name: Download PLUGIN_INFO artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: plugin-info path: artifact-directory From e42fb794e9ef362d404e67d5b2f85f8c5590d799 Mon Sep 17 00:00:00 2001 From: Sam Winebrake <85908068+samwinebrake@users.noreply.github.com> Date: Mon, 30 Sep 2024 09:05:01 -0400 Subject: [PATCH 3/3] Update environment_lock.yml w/ new brainio name (#1235) * Update environment_lock.yml w/ new brainio name * update env lock w/ pypi packages --- environment_lock.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/environment_lock.yml b/environment_lock.yml index 9847267d3..d37c1a5c0 100644 --- a/environment_lock.yml +++ b/environment_lock.yml @@ -34,9 +34,9 @@ dependencies: - bleach==6.1.0 - boto3==1.35.3 - botocore==1.35.3 - - brainio @ git+https://github.com/brain-score/brainio.git@main - - brainscore_core @ git+https://github.com/brain-score/core@main - - brainscore-vision @ git+https://github.com/brain-score/vision.git@main + - brainscore-brainio==1.0.0 + - brainscore-core==2.1 + - brainscore-vision==2.1 - certifi==2024.7.4 - cffi==1.17.0 - cftime==1.6.4 @@ -144,7 +144,7 @@ dependencies: - qtpy==2.4.1 - referencing==0.35.1 - requests==2.32.3 - - result_caching @ git+https://github.com/brain-score/result_caching@master + - result_caching==0.1.0 - rfc3339-validator==0.1.4 - rfc3986-validator==0.1.1 - rpds-py==0.20.0