-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow region_layer_map json to be loaded into BrainModel during commitment #1314
Conversation
resnext101_32x8d_wsl_ still being run on |
brainscore_vision/model_helpers/brain_transformation/__init__.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just the one comment
brainscore_vision/model_helpers/brain_transformation/__init__.py
Outdated
Show resolved
Hide resolved
brainscore_vision/model_helpers/brain_transformation/__init__.py
Outdated
Show resolved
Hide resolved
@@ -30,12 +36,18 @@ def __init__(self, identifier, | |||
self.activations_model._extractor.set_visual_degrees(visual_degrees) # for microsaccades | |||
self._visual_degrees = visual_degrees | |||
# region-layer mapping | |||
|
|||
# Attempt to load region_layer_map from JSON, if available | |||
region_layer_map = self.load_region_layer_map_json(identifier) if region_layer_map is None else region_layer_map |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like that the ModelCommitment
has to know about plugins. Can we not load the specification inside the plugin and pass it to the ModelCommitment
as a parameter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modifying the __init__.py
was the original approach. However, after talking with the others, it seems modifying the init file, especially when there can be multiple model identifiers listed in a single model directory could be messy. It would also make for a messier PR/commit during the model submission.
By adding a check in ModelCommitment
, all that would be needed would be a single region_layer_map json per model_identifier in the model directory. But I do agree that it disrupts the current flow of the plugin model.
If we do not want to modify the __init__.py
file of each model (and therefore cannot pass the map to ModelCommitment
as a parameter), what would you recommend?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just thinking out loud, but what about an intermediate approach where the ModelCommitment
expects the full layer mapping, but submissions can specify this to be automatically discovered? Something like
model_registry['mymodel'] = lambda: ModelCommitment(
identifier='mymodel',
activations_model=get_model(),
region_layer_map=discover_region_layer_mapping('mymodel'))
The discover_region_layer_mapping
would then first look for a mapping file in the plugin, and if that doesn't exist make one by running the layer selection. This way the plugin __init__
would not have to be modified but we still maintain the separation between plugins and model helpers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Martin - Kartik and I just discussed and I would like to propose something a bit more direct that what you suggested. We create a means to determine if we are running locally (any place but AWS) or in production (AWS). For local runs (again, anything but AWS) if no json file exists, we perform layer mapping and then write the json file.
For AWS runs we assume that region_layer_map json file exists and throw an exception if it does not, terminating the scoring run.
This is changing the assumptions of modelCommitment, which hopefully we don't do frequently, but not significantly (and not even as significantly as the solution you propose above). Additionally, as a benefit, local users, at the time of their PR already have the layer map and have thought about it and checked it against reality. They can regenerate as many times as desired, simply by removing the json file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes I think we agree on those points.
What I'm not sure about is if you want this detection to happen inside ModelCommitment or in the plugin. I am arguing for the latter so that we keep the clean decoupling between the plugin system and model helpers. The only advantage I see for putting it inside the ModelCommitment is to avoid the model plugins having to specify layer discovery, but I like that it makes this explicit to users. And the downside of having it inside of ModelCommitment is that it makes adapting this mapping more difficult for models such as CORnet and VOneNet.
if region_layer_map is None: | ||
layer_selection = LayerSelection(model_identifier=identifier, | ||
activations_model=activations_model, layers=layers, | ||
visual_degrees=visual_degrees) | ||
region_layer_map = RegionLayerMap(layer_selection=layer_selection, | ||
region_benchmarks=STANDARD_REGION_BENCHMARKS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Write local JSON file to the model directory. This can be PR'd when they choose to submit.
- logger - Path instead of OS - Avoid cwd
- logger - Path instead of OS - Avoid cwd
Proposal in order to move this forward: you go ahead with this plan, we merge, and I submit another PR that implements what I have in mind. |
* Allow region_layer_map json to be loaded into BrainModel during commitment (#1314) * Add load_region_layer_map_from_json * Cleaned up load_region_layer_map_json function and added error handling. * Replaced print with logging * Recommended fix: - logger - Path instead of OS - Avoid cwd * Recommended fix: - logger - Path instead of OS - Avoid cwd * Layer Mapping Orchestrator (build:114) (#1399) * Add region_layer_map directories with .gitkeep for models: resnet18_imagenet_full resnet34_imagenet_full resnet50_imagenet_full * Add resnet18_imagenet_full.json to region_layer_map for model resnet18_imagenet_full * Add resnet34_imagenet_full.json to region_layer_map for model resnet34_imagenet_full * Add resnet50_imagenet_full.json to region_layer_map for model resnet50_imagenet_full * Delete brainscore_vision/models/scaling_models/region_layer_map/.gitkeep --------- Co-authored-by: Jenkins <[email protected]> Co-authored-by: Kartik Pradeepan <[email protected]> --------- Co-authored-by: Katherine Fairchild <[email protected]> Co-authored-by: Jenkins <[email protected]>
* Allow region_layer_map json to be loaded into BrainModel during commitment (#1314) * Add load_region_layer_map_from_json * Cleaned up load_region_layer_map_json function and added error handling. * Replaced print with logging * Recommended fix: - logger - Path instead of OS - Avoid cwd * Recommended fix: - logger - Path instead of OS - Avoid cwd * Layer Mapping Orchestrator (build:114) (#1399) * Add region_layer_map directories with .gitkeep for models: resnet18_imagenet_full resnet34_imagenet_full resnet50_imagenet_full * Add resnet18_imagenet_full.json to region_layer_map for model resnet18_imagenet_full * Add resnet34_imagenet_full.json to region_layer_map for model resnet34_imagenet_full * Add resnet50_imagenet_full.json to region_layer_map for model resnet50_imagenet_full * Delete brainscore_vision/models/scaling_models/region_layer_map/.gitkeep --------- Co-authored-by: Jenkins <[email protected]> Co-authored-by: Kartik Pradeepan <[email protected]> * Add layer-mapping workflow to trigger Jenkins (#1361) * Create map_new_plugins workflow * Create map_new_plugins workflow --------- Co-authored-by: Katherine Fairchild <[email protected]> Co-authored-by: Jenkins <[email protected]>
* Allow region_layer_map json to be loaded into BrainModel during commitment (#1314) * Add load_region_layer_map_from_json * Cleaned up load_region_layer_map_json function and added error handling. * Replaced print with logging * Recommended fix: - logger - Path instead of OS - Avoid cwd * Recommended fix: - logger - Path instead of OS - Avoid cwd * Layer Mapping Orchestrator (build:114) (#1399) * Add region_layer_map directories with .gitkeep for models: resnet18_imagenet_full resnet34_imagenet_full resnet50_imagenet_full * Add resnet18_imagenet_full.json to region_layer_map for model resnet18_imagenet_full * Add resnet34_imagenet_full.json to region_layer_map for model resnet34_imagenet_full * Add resnet50_imagenet_full.json to region_layer_map for model resnet50_imagenet_full * Delete brainscore_vision/models/scaling_models/region_layer_map/.gitkeep --------- Co-authored-by: Jenkins <[email protected]> Co-authored-by: Kartik Pradeepan <[email protected]> * Add layer-mapping workflow to trigger Jenkins (#1361) * Create map_new_plugins workflow * Create map_new_plugins workflow * Change trigger and status checks (#1408) * Add label change as trigger (#1410) * Updating sha (#1412) * Debug map_new_plugins.yml (#1414) * Remove parsing of status/checks in loop (#1416) * Quote mismatch fix (#1418) Recommended by ChatGPT because I got tired of trying to deal with quotes * Update imagenet paths (#1406) * update stim path to mounted s3 bucket * update imagenet csv paths --------- Co-authored-by: Katherine Fairchild <[email protected]> Co-authored-by: Jenkins <[email protected]> Co-authored-by: Sam Winebrake <[email protected]>
* Allow region_layer_map json to be loaded into BrainModel during commitment (#1314) * Add load_region_layer_map_from_json * Cleaned up load_region_layer_map_json function and added error handling. * Replaced print with logging * Recommended fix: - logger - Path instead of OS - Avoid cwd * Recommended fix: - logger - Path instead of OS - Avoid cwd * Layer Mapping Orchestrator (build:114) (#1399) * Add region_layer_map directories with .gitkeep for models: resnet18_imagenet_full resnet34_imagenet_full resnet50_imagenet_full * Add resnet18_imagenet_full.json to region_layer_map for model resnet18_imagenet_full * Add resnet34_imagenet_full.json to region_layer_map for model resnet34_imagenet_full * Add resnet50_imagenet_full.json to region_layer_map for model resnet50_imagenet_full * Delete brainscore_vision/models/scaling_models/region_layer_map/.gitkeep --------- Co-authored-by: Jenkins <[email protected]> Co-authored-by: Kartik Pradeepan <[email protected]> * Add layer-mapping workflow to trigger Jenkins (#1361) * Create map_new_plugins workflow * Create map_new_plugins workflow * Change trigger and status checks (#1408) * Add label change as trigger (#1410) * Updating sha (#1412) * Debug map_new_plugins.yml (#1414) * Remove parsing of status/checks in loop (#1416) * Quote mismatch fix (#1418) Recommended by ChatGPT because I got tired of trying to deal with quotes * Update imagenet paths (#1406) * update stim path to mounted s3 bucket * update imagenet csv paths * Loosen map-new-plugins trigger (#1422) * Update auto merge workflow to require mapping (#1424) * Separate map_new_plugins into two jobs and allow re-run (#1426) * Remove set and use GitHub_output (#1428) * Update map_new_plugins.yml (#1430) * remove ' from benchmark id (#1432) * brain-score.org submission (user:538) | (public:False) (#1434) * Layer Mapping Orchestrator (build:115) (#1400) * Add region_layer_map directories with .gitkeep for models: resnet101_imagenet_full resnet152_imagenet_full resnet18_ecoset_full resnet34_ecoset_full resnet50_ecoset_full resnet101_ecoset_full resnet152_ecoset_full * Add resnet18_ecoset_full.json to region_layer_map for model resnet18_ecoset_full * Add resnet34_ecoset_full.json to region_layer_map for model resnet34_ecoset_full * Add resnet50_ecoset_full.json to region_layer_map for model resnet50_ecoset_full * Add resnet101_imagenet_full.json to region_layer_map for model resnet101_imagenet_full * Add resnet101_ecoset_full.json to region_layer_map for model resnet101_ecoset_full * Add resnet152_ecoset_full.json to region_layer_map for model resnet152_ecoset_full * Add efficientnet_b2_imagenet_full.json to region_layer_map for model efficientnet_b2_imagenet_full * Add efficientnet_b0_imagenet_full.json to region_layer_map for model efficientnet_b0_imagenet_full * Add resnet50_imagenet_1_seed-0.json to region_layer_map for model resnet50_imagenet_1_seed-0 * Add resnet50_imagenet_100_seed-0.json to region_layer_map for model resnet50_imagenet_100_seed-0 * Add resnet50_imagenet_10_seed-0.json to region_layer_map for model resnet50_imagenet_10_seed-0 * Add deit_small_imagenet_10_seed-0.json to region_layer_map for model deit_small_imagenet_10_seed-0 * Add deit_small_imagenet_100_seed-0.json to region_layer_map for model deit_small_imagenet_100_seed-0 * Add deit_small_imagenet_full_seed-0.json to region_layer_map for model deit_small_imagenet_full_seed-0 * Add deit_small_imagenet_1_seed-0.json to region_layer_map for model deit_small_imagenet_1_seed-0 * Add deit_base_imagenet_full_seed-0.json to region_layer_map for model deit_base_imagenet_full_seed-0 * Add convnext_small_imagenet_100_seed-0.json to region_layer_map for model convnext_small_imagenet_100_seed-0 * Add efficientnet_b1_imagenet_full.json to region_layer_map for model efficientnet_b1_imagenet_full * Add convnext_small_imagenet_1_seed-0.json to region_layer_map for model convnext_small_imagenet_1_seed-0 * Add convnext_small_imagenet_10_seed-0.json to region_layer_map for model convnext_small_imagenet_10_seed-0 * Add convnext_small_imagenet_full_seed-0.json to region_layer_map for model convnext_small_imagenet_full_seed-0 * Add convnext_base_imagenet_full_seed-0.json to region_layer_map for model convnext_base_imagenet_full_seed-0 * Add convnext_large_imagenet_full_seed-0.json to region_layer_map for model convnext_large_imagenet_full_seed-0 * Add deit_large_imagenet_full_seed-0.json to region_layer_map for model deit_large_imagenet_full_seed-0 * Delete brainscore_vision/models/scaling_models/region_layer_map/.gitkeep --------- Co-authored-by: Jenkins <[email protected]> Co-authored-by: Kartik Pradeepan <[email protected]> --------- Co-authored-by: Katherine Fairchild <[email protected]> Co-authored-by: Jenkins <[email protected]> Co-authored-by: Sam Winebrake <[email protected]>
* Allow region_layer_map json to be loaded into BrainModel during commitment (#1314) * Add load_region_layer_map_from_json * Cleaned up load_region_layer_map_json function and added error handling. * Replaced print with logging * Recommended fix: - logger - Path instead of OS - Avoid cwd * Recommended fix: - logger - Path instead of OS - Avoid cwd * Layer Mapping Orchestrator (build:114) (#1399) * Add region_layer_map directories with .gitkeep for models: resnet18_imagenet_full resnet34_imagenet_full resnet50_imagenet_full * Add resnet18_imagenet_full.json to region_layer_map for model resnet18_imagenet_full * Add resnet34_imagenet_full.json to region_layer_map for model resnet34_imagenet_full * Add resnet50_imagenet_full.json to region_layer_map for model resnet50_imagenet_full * Delete brainscore_vision/models/scaling_models/region_layer_map/.gitkeep --------- Co-authored-by: Jenkins <[email protected]> Co-authored-by: Kartik Pradeepan <[email protected]> * Add layer-mapping workflow to trigger Jenkins (#1361) * Create map_new_plugins workflow * Create map_new_plugins workflow * Change trigger and status checks (#1408) * Add label change as trigger (#1410) * Updating sha (#1412) * Debug map_new_plugins.yml (#1414) * Remove parsing of status/checks in loop (#1416) * Quote mismatch fix (#1418) Recommended by ChatGPT because I got tired of trying to deal with quotes * Update imagenet paths (#1406) * update stim path to mounted s3 bucket * update imagenet csv paths * Loosen map-new-plugins trigger (#1422) * Update auto merge workflow to require mapping (#1424) * Separate map_new_plugins into two jobs and allow re-run (#1426) * Remove set and use GitHub_output (#1428) * Update map_new_plugins.yml (#1430) * remove ' from benchmark id (#1432) * brain-score.org submission (user:538) | (public:False) (#1434) * Layer Mapping Orchestrator (build:115) (#1400) * Add region_layer_map directories with .gitkeep for models: resnet101_imagenet_full resnet152_imagenet_full resnet18_ecoset_full resnet34_ecoset_full resnet50_ecoset_full resnet101_ecoset_full resnet152_ecoset_full * Add resnet18_ecoset_full.json to region_layer_map for model resnet18_ecoset_full * Add resnet34_ecoset_full.json to region_layer_map for model resnet34_ecoset_full * Add resnet50_ecoset_full.json to region_layer_map for model resnet50_ecoset_full * Add resnet101_imagenet_full.json to region_layer_map for model resnet101_imagenet_full * Add resnet101_ecoset_full.json to region_layer_map for model resnet101_ecoset_full * Add resnet152_ecoset_full.json to region_layer_map for model resnet152_ecoset_full * Add efficientnet_b2_imagenet_full.json to region_layer_map for model efficientnet_b2_imagenet_full * Add efficientnet_b0_imagenet_full.json to region_layer_map for model efficientnet_b0_imagenet_full * Add resnet50_imagenet_1_seed-0.json to region_layer_map for model resnet50_imagenet_1_seed-0 * Add resnet50_imagenet_100_seed-0.json to region_layer_map for model resnet50_imagenet_100_seed-0 * Add resnet50_imagenet_10_seed-0.json to region_layer_map for model resnet50_imagenet_10_seed-0 * Add deit_small_imagenet_10_seed-0.json to region_layer_map for model deit_small_imagenet_10_seed-0 * Add deit_small_imagenet_100_seed-0.json to region_layer_map for model deit_small_imagenet_100_seed-0 * Add deit_small_imagenet_full_seed-0.json to region_layer_map for model deit_small_imagenet_full_seed-0 * Add deit_small_imagenet_1_seed-0.json to region_layer_map for model deit_small_imagenet_1_seed-0 * Add deit_base_imagenet_full_seed-0.json to region_layer_map for model deit_base_imagenet_full_seed-0 * Add convnext_small_imagenet_100_seed-0.json to region_layer_map for model convnext_small_imagenet_100_seed-0 * Add efficientnet_b1_imagenet_full.json to region_layer_map for model efficientnet_b1_imagenet_full * Add convnext_small_imagenet_1_seed-0.json to region_layer_map for model convnext_small_imagenet_1_seed-0 * Add convnext_small_imagenet_10_seed-0.json to region_layer_map for model convnext_small_imagenet_10_seed-0 * Add convnext_small_imagenet_full_seed-0.json to region_layer_map for model convnext_small_imagenet_full_seed-0 * Add convnext_base_imagenet_full_seed-0.json to region_layer_map for model convnext_base_imagenet_full_seed-0 * Add convnext_large_imagenet_full_seed-0.json to region_layer_map for model convnext_large_imagenet_full_seed-0 * Add deit_large_imagenet_full_seed-0.json to region_layer_map for model deit_large_imagenet_full_seed-0 * Delete brainscore_vision/models/scaling_models/region_layer_map/.gitkeep --------- Co-authored-by: Jenkins <[email protected]> Co-authored-by: Kartik Pradeepan <[email protected]> * Adding CvTs (#1436) * Added CvTs with identifiers and image sizes * Adds the bibtex references to new and existing CvTs * Fixed cvt_13 and cvt_21 init.py swaps * Removed CvT W24 change * Renamed model identifiers * Layer Mapping Orchestrator (build:126) (#1437) * Add region_layer_map directories with .gitkeep for models: cvt_cvt-13-224-in1k_4_LucyV4 cvt_cvt-13-384-in1k_4_LucyV4 cvt_cvt-13-384-in22k_finetuned-in1k_4_LucyV4 cvt_cvt-21-224-in1k_4_LucyV4 cvt_cvt-21-384-in1k_4_LucyV4 cvt_cvt-21-384-in22k_finetuned-in1k_4_LucyV4 * Add cvt_cvt-13-384-in22k_finetuned-in1k_4_LucyV4.json to region_layer_map for model cvt_cvt-13-384-in22k_finetuned-in1k_4_LucyV4 * Add cvt_cvt-13-224-in1k_4_LucyV4.json to region_layer_map for model cvt_cvt-13-224-in1k_4_LucyV4 * Add cvt_cvt-13-384-in1k_4_LucyV4.json to region_layer_map for model cvt_cvt-13-384-in1k_4_LucyV4 * Add cvt_cvt-21-224-in1k_4_LucyV4.json to region_layer_map for model cvt_cvt-21-224-in1k_4_LucyV4 * Add cvt_cvt-21-384-in1k_4_LucyV4.json to region_layer_map for model cvt_cvt-21-384-in1k_4_LucyV4 * Add cvt_cvt-21-384-in22k_finetuned-in1k_4_LucyV4.json to region_layer_map for model cvt_cvt-21-384-in22k_finetuned-in1k_4_LucyV4 * Delete brainscore_vision/models/cvt_cvt_13_384_in1k_4/region_layer_map/.gitkeep * Delete brainscore_vision/models/cvt_cvt_13_384_in22k_finetuned_in1k_4/region_layer_map/.gitkeep * Delete brainscore_vision/models/cvt_cvt_21_224_in1k_4/region_layer_map/.gitkeep * Delete brainscore_vision/models/cvt_cvt_21_384_in1k_4/region_layer_map/.gitkeep * Delete brainscore_vision/models/cvt_cvt_21_384_in22k_finetuned_in1k_4/region_layer_map/.gitkeep --------- Co-authored-by: Jenkins <[email protected]> Co-authored-by: KartikP <[email protected]> Co-authored-by: Kartik Pradeepan <[email protected]> --------- Co-authored-by: Katherine Fairchild <[email protected]> Co-authored-by: Jenkins <[email protected]> Co-authored-by: Sam Winebrake <[email protected]> Co-authored-by: LucyV4 <[email protected]> Co-authored-by: KartikP <[email protected]>
* Allow region_layer_map json to be loaded into BrainModel during commitment (#1314) * Add load_region_layer_map_from_json * Cleaned up load_region_layer_map_json function and added error handling. * Replaced print with logging * Recommended fix: - logger - Path instead of OS - Avoid cwd * Recommended fix: - logger - Path instead of OS - Avoid cwd * Layer Mapping Orchestrator (build:114) (#1399) * Add region_layer_map directories with .gitkeep for models: resnet18_imagenet_full resnet34_imagenet_full resnet50_imagenet_full * Add resnet18_imagenet_full.json to region_layer_map for model resnet18_imagenet_full * Add resnet34_imagenet_full.json to region_layer_map for model resnet34_imagenet_full * Add resnet50_imagenet_full.json to region_layer_map for model resnet50_imagenet_full * Delete brainscore_vision/models/scaling_models/region_layer_map/.gitkeep --------- Co-authored-by: Jenkins <[email protected]> Co-authored-by: Kartik Pradeepan <[email protected]> * Add layer-mapping workflow to trigger Jenkins (#1361) * Create map_new_plugins workflow * Create map_new_plugins workflow * Change trigger and status checks (#1408) * Add label change as trigger (#1410) * Updating sha (#1412) * Debug map_new_plugins.yml (#1414) * Remove parsing of status/checks in loop (#1416) * Quote mismatch fix (#1418) Recommended by ChatGPT because I got tired of trying to deal with quotes * Update imagenet paths (#1406) * update stim path to mounted s3 bucket * update imagenet csv paths * Loosen map-new-plugins trigger (#1422) * Update auto merge workflow to require mapping (#1424) * Separate map_new_plugins into two jobs and allow re-run (#1426) * Remove set and use GitHub_output (#1428) * Update map_new_plugins.yml (#1430) * remove ' from benchmark id (#1432) * brain-score.org submission (user:538) | (public:False) (#1434) * Layer Mapping Orchestrator (build:115) (#1400) * Add region_layer_map directories with .gitkeep for models: resnet101_imagenet_full resnet152_imagenet_full resnet18_ecoset_full resnet34_ecoset_full resnet50_ecoset_full resnet101_ecoset_full resnet152_ecoset_full * Add resnet18_ecoset_full.json to region_layer_map for model resnet18_ecoset_full * Add resnet34_ecoset_full.json to region_layer_map for model resnet34_ecoset_full * Add resnet50_ecoset_full.json to region_layer_map for model resnet50_ecoset_full * Add resnet101_imagenet_full.json to region_layer_map for model resnet101_imagenet_full * Add resnet101_ecoset_full.json to region_layer_map for model resnet101_ecoset_full * Add resnet152_ecoset_full.json to region_layer_map for model resnet152_ecoset_full * Add efficientnet_b2_imagenet_full.json to region_layer_map for model efficientnet_b2_imagenet_full * Add efficientnet_b0_imagenet_full.json to region_layer_map for model efficientnet_b0_imagenet_full * Add resnet50_imagenet_1_seed-0.json to region_layer_map for model resnet50_imagenet_1_seed-0 * Add resnet50_imagenet_100_seed-0.json to region_layer_map for model resnet50_imagenet_100_seed-0 * Add resnet50_imagenet_10_seed-0.json to region_layer_map for model resnet50_imagenet_10_seed-0 * Add deit_small_imagenet_10_seed-0.json to region_layer_map for model deit_small_imagenet_10_seed-0 * Add deit_small_imagenet_100_seed-0.json to region_layer_map for model deit_small_imagenet_100_seed-0 * Add deit_small_imagenet_full_seed-0.json to region_layer_map for model deit_small_imagenet_full_seed-0 * Add deit_small_imagenet_1_seed-0.json to region_layer_map for model deit_small_imagenet_1_seed-0 * Add deit_base_imagenet_full_seed-0.json to region_layer_map for model deit_base_imagenet_full_seed-0 * Add convnext_small_imagenet_100_seed-0.json to region_layer_map for model convnext_small_imagenet_100_seed-0 * Add efficientnet_b1_imagenet_full.json to region_layer_map for model efficientnet_b1_imagenet_full * Add convnext_small_imagenet_1_seed-0.json to region_layer_map for model convnext_small_imagenet_1_seed-0 * Add convnext_small_imagenet_10_seed-0.json to region_layer_map for model convnext_small_imagenet_10_seed-0 * Add convnext_small_imagenet_full_seed-0.json to region_layer_map for model convnext_small_imagenet_full_seed-0 * Add convnext_base_imagenet_full_seed-0.json to region_layer_map for model convnext_base_imagenet_full_seed-0 * Add convnext_large_imagenet_full_seed-0.json to region_layer_map for model convnext_large_imagenet_full_seed-0 * Add deit_large_imagenet_full_seed-0.json to region_layer_map for model deit_large_imagenet_full_seed-0 * Delete brainscore_vision/models/scaling_models/region_layer_map/.gitkeep --------- Co-authored-by: Jenkins <[email protected]> Co-authored-by: Kartik Pradeepan <[email protected]> * Adding CvTs (#1436) * Added CvTs with identifiers and image sizes * Adds the bibtex references to new and existing CvTs * Fixed cvt_13 and cvt_21 init.py swaps * Removed CvT W24 change * Renamed model identifiers * Layer Mapping Orchestrator (build:126) (#1437) * Add region_layer_map directories with .gitkeep for models: cvt_cvt-13-224-in1k_4_LucyV4 cvt_cvt-13-384-in1k_4_LucyV4 cvt_cvt-13-384-in22k_finetuned-in1k_4_LucyV4 cvt_cvt-21-224-in1k_4_LucyV4 cvt_cvt-21-384-in1k_4_LucyV4 cvt_cvt-21-384-in22k_finetuned-in1k_4_LucyV4 * Add cvt_cvt-13-384-in22k_finetuned-in1k_4_LucyV4.json to region_layer_map for model cvt_cvt-13-384-in22k_finetuned-in1k_4_LucyV4 * Add cvt_cvt-13-224-in1k_4_LucyV4.json to region_layer_map for model cvt_cvt-13-224-in1k_4_LucyV4 * Add cvt_cvt-13-384-in1k_4_LucyV4.json to region_layer_map for model cvt_cvt-13-384-in1k_4_LucyV4 * Add cvt_cvt-21-224-in1k_4_LucyV4.json to region_layer_map for model cvt_cvt-21-224-in1k_4_LucyV4 * Add cvt_cvt-21-384-in1k_4_LucyV4.json to region_layer_map for model cvt_cvt-21-384-in1k_4_LucyV4 * Add cvt_cvt-21-384-in22k_finetuned-in1k_4_LucyV4.json to region_layer_map for model cvt_cvt-21-384-in22k_finetuned-in1k_4_LucyV4 * Delete brainscore_vision/models/cvt_cvt_13_384_in1k_4/region_layer_map/.gitkeep * Delete brainscore_vision/models/cvt_cvt_13_384_in22k_finetuned_in1k_4/region_layer_map/.gitkeep * Delete brainscore_vision/models/cvt_cvt_21_224_in1k_4/region_layer_map/.gitkeep * Delete brainscore_vision/models/cvt_cvt_21_384_in1k_4/region_layer_map/.gitkeep * Delete brainscore_vision/models/cvt_cvt_21_384_in22k_finetuned_in1k_4/region_layer_map/.gitkeep --------- Co-authored-by: Jenkins <[email protected]> Co-authored-by: KartikP <[email protected]> Co-authored-by: Kartik Pradeepan <[email protected]> * Layer Mapping Orchestrator (build:127) (#1441) * Add region_layer_map directories with .gitkeep for models: alexnet * Add alexnet.json to region_layer_map for model alexnet --------- Co-authored-by: Jenkins <[email protected]> Co-authored-by: KartikP <[email protected]> --------- Co-authored-by: Katherine Fairchild <[email protected]> Co-authored-by: Jenkins <[email protected]> Co-authored-by: Sam Winebrake <[email protected]> Co-authored-by: LucyV4 <[email protected]> Co-authored-by: KartikP <[email protected]>
* Allow region_layer_map json to be loaded into BrainModel during commitment (#1314) * Add load_region_layer_map_from_json * Cleaned up load_region_layer_map_json function and added error handling. * Replaced print with logging * Recommended fix: - logger - Path instead of OS - Avoid cwd * Recommended fix: - logger - Path instead of OS - Avoid cwd * Layer Mapping Orchestrator (build:114) (#1399) * Add region_layer_map directories with .gitkeep for models: resnet18_imagenet_full resnet34_imagenet_full resnet50_imagenet_full * Add resnet18_imagenet_full.json to region_layer_map for model resnet18_imagenet_full * Add resnet34_imagenet_full.json to region_layer_map for model resnet34_imagenet_full * Add resnet50_imagenet_full.json to region_layer_map for model resnet50_imagenet_full * Delete brainscore_vision/models/scaling_models/region_layer_map/.gitkeep --------- Co-authored-by: Jenkins <[email protected]> Co-authored-by: Kartik Pradeepan <[email protected]> * Add layer-mapping workflow to trigger Jenkins (#1361) * Create map_new_plugins workflow * Create map_new_plugins workflow * Change trigger and status checks (#1408) * Add label change as trigger (#1410) * Updating sha (#1412) * Debug map_new_plugins.yml (#1414) * Remove parsing of status/checks in loop (#1416) * Quote mismatch fix (#1418) Recommended by ChatGPT because I got tired of trying to deal with quotes * Update imagenet paths (#1406) * update stim path to mounted s3 bucket * update imagenet csv paths * Loosen map-new-plugins trigger (#1422) * Update auto merge workflow to require mapping (#1424) * Separate map_new_plugins into two jobs and allow re-run (#1426) * Remove set and use GitHub_output (#1428) * Update map_new_plugins.yml (#1430) * remove ' from benchmark id (#1432) * brain-score.org submission (user:538) | (public:False) (#1434) * Layer Mapping Orchestrator (build:115) (#1400) * Add region_layer_map directories with .gitkeep for models: resnet101_imagenet_full resnet152_imagenet_full resnet18_ecoset_full resnet34_ecoset_full resnet50_ecoset_full resnet101_ecoset_full resnet152_ecoset_full * Add resnet18_ecoset_full.json to region_layer_map for model resnet18_ecoset_full * Add resnet34_ecoset_full.json to region_layer_map for model resnet34_ecoset_full * Add resnet50_ecoset_full.json to region_layer_map for model resnet50_ecoset_full * Add resnet101_imagenet_full.json to region_layer_map for model resnet101_imagenet_full * Add resnet101_ecoset_full.json to region_layer_map for model resnet101_ecoset_full * Add resnet152_ecoset_full.json to region_layer_map for model resnet152_ecoset_full * Add efficientnet_b2_imagenet_full.json to region_layer_map for model efficientnet_b2_imagenet_full * Add efficientnet_b0_imagenet_full.json to region_layer_map for model efficientnet_b0_imagenet_full * Add resnet50_imagenet_1_seed-0.json to region_layer_map for model resnet50_imagenet_1_seed-0 * Add resnet50_imagenet_100_seed-0.json to region_layer_map for model resnet50_imagenet_100_seed-0 * Add resnet50_imagenet_10_seed-0.json to region_layer_map for model resnet50_imagenet_10_seed-0 * Add deit_small_imagenet_10_seed-0.json to region_layer_map for model deit_small_imagenet_10_seed-0 * Add deit_small_imagenet_100_seed-0.json to region_layer_map for model deit_small_imagenet_100_seed-0 * Add deit_small_imagenet_full_seed-0.json to region_layer_map for model deit_small_imagenet_full_seed-0 * Add deit_small_imagenet_1_seed-0.json to region_layer_map for model deit_small_imagenet_1_seed-0 * Add deit_base_imagenet_full_seed-0.json to region_layer_map for model deit_base_imagenet_full_seed-0 * Add convnext_small_imagenet_100_seed-0.json to region_layer_map for model convnext_small_imagenet_100_seed-0 * Add efficientnet_b1_imagenet_full.json to region_layer_map for model efficientnet_b1_imagenet_full * Add convnext_small_imagenet_1_seed-0.json to region_layer_map for model convnext_small_imagenet_1_seed-0 * Add convnext_small_imagenet_10_seed-0.json to region_layer_map for model convnext_small_imagenet_10_seed-0 * Add convnext_small_imagenet_full_seed-0.json to region_layer_map for model convnext_small_imagenet_full_seed-0 * Add convnext_base_imagenet_full_seed-0.json to region_layer_map for model convnext_base_imagenet_full_seed-0 * Add convnext_large_imagenet_full_seed-0.json to region_layer_map for model convnext_large_imagenet_full_seed-0 * Add deit_large_imagenet_full_seed-0.json to region_layer_map for model deit_large_imagenet_full_seed-0 * Delete brainscore_vision/models/scaling_models/region_layer_map/.gitkeep --------- Co-authored-by: Jenkins <[email protected]> Co-authored-by: Kartik Pradeepan <[email protected]> * Adding CvTs (#1436) * Added CvTs with identifiers and image sizes * Adds the bibtex references to new and existing CvTs * Fixed cvt_13 and cvt_21 init.py swaps * Removed CvT W24 change * Renamed model identifiers * Layer Mapping Orchestrator (build:126) (#1437) * Add region_layer_map directories with .gitkeep for models: cvt_cvt-13-224-in1k_4_LucyV4 cvt_cvt-13-384-in1k_4_LucyV4 cvt_cvt-13-384-in22k_finetuned-in1k_4_LucyV4 cvt_cvt-21-224-in1k_4_LucyV4 cvt_cvt-21-384-in1k_4_LucyV4 cvt_cvt-21-384-in22k_finetuned-in1k_4_LucyV4 * Add cvt_cvt-13-384-in22k_finetuned-in1k_4_LucyV4.json to region_layer_map for model cvt_cvt-13-384-in22k_finetuned-in1k_4_LucyV4 * Add cvt_cvt-13-224-in1k_4_LucyV4.json to region_layer_map for model cvt_cvt-13-224-in1k_4_LucyV4 * Add cvt_cvt-13-384-in1k_4_LucyV4.json to region_layer_map for model cvt_cvt-13-384-in1k_4_LucyV4 * Add cvt_cvt-21-224-in1k_4_LucyV4.json to region_layer_map for model cvt_cvt-21-224-in1k_4_LucyV4 * Add cvt_cvt-21-384-in1k_4_LucyV4.json to region_layer_map for model cvt_cvt-21-384-in1k_4_LucyV4 * Add cvt_cvt-21-384-in22k_finetuned-in1k_4_LucyV4.json to region_layer_map for model cvt_cvt-21-384-in22k_finetuned-in1k_4_LucyV4 * Delete brainscore_vision/models/cvt_cvt_13_384_in1k_4/region_layer_map/.gitkeep * Delete brainscore_vision/models/cvt_cvt_13_384_in22k_finetuned_in1k_4/region_layer_map/.gitkeep * Delete brainscore_vision/models/cvt_cvt_21_224_in1k_4/region_layer_map/.gitkeep * Delete brainscore_vision/models/cvt_cvt_21_384_in1k_4/region_layer_map/.gitkeep * Delete brainscore_vision/models/cvt_cvt_21_384_in22k_finetuned_in1k_4/region_layer_map/.gitkeep --------- Co-authored-by: Jenkins <[email protected]> Co-authored-by: KartikP <[email protected]> Co-authored-by: Kartik Pradeepan <[email protected]> * Layer Mapping Orchestrator (build:127) (#1441) * Add region_layer_map directories with .gitkeep for models: alexnet * Add alexnet.json to region_layer_map for model alexnet --------- Co-authored-by: Jenkins <[email protected]> Co-authored-by: KartikP <[email protected]> * Layer Mapping Orchestrator (build:128) (#1443) * Add region_layer_map directories with .gitkeep for models: resnet50_tutorial * Add resnet50_tutorial.json to region_layer_map for model resnet50_tutorial --------- Co-authored-by: Jenkins <[email protected]> Co-authored-by: KartikP <[email protected]> --------- Co-authored-by: Katherine Fairchild <[email protected]> Co-authored-by: Jenkins <[email protected]> Co-authored-by: Sam Winebrake <[email protected]> Co-authored-by: LucyV4 <[email protected]> Co-authored-by: KartikP <[email protected]>
This allows a region_layer_map dictionary to be loaded during ModelCommitment.
Region layer maps need to be in a folder in the model's directory called
region_layer_map
and in a file called${MODEL_IDENTIFIER}.json
.For example, if you want to add the layer map for
alexnet
.You would create a
/alexnet/region_layer_map/alexnet.json
file that contains the region_layer_map dictionary.{ "V1": "features.2", "V2": "features.7", "V4": "features.7", "IT": "features.12" }
Not particularly happy with the function, but i think it gets the job done. Open to feedback.