Skip to content

towards adding Pereira2018ROI as a benchmark - #37

Closed
aalok-sathe wants to merge 545 commits into
mainfrom
asathe-gretatu/pereira2018
Closed

aalok-sathe wants to merge 545 commits into
mainfrom
asathe-gretatu/pereira2018

Conversation

@aalok-sathe

Copy link
Copy Markdown
Member

the data file is local for now; not available on s3. We'll share the csv in slack.
this contains means of ROIs for Lang for all subjects, averaged across sessions.

aalok-sathe and others added 30 commits April 14, 2022 10:17
deleted:    langbrainscore/benchmark_packaging/.gitkeep
deleted:    langbrainscore/benchmark_packaging/package_benchmarks.py

@mschrimpf mschrimpf left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

High-level comment: I think the benchmark should go inside pereira2018 rather than a new plugin pereira2018_v2022 -- @kvfairchild do you agree?

Note that unit tests are failing; if you'd like to put this data onto the S3 bucket that we used for the other data, slack me and I'll get you write access.

Comment thread .gitignore
### project specific additions:

brainscore_language/data
# brainscore_language/data

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dead specification, either delete or leave, no commented code

Comment on lines +13 to +23
BIBTEX = """@article{pereira2018toward,
title={Toward a universal decoder of linguistic meaning from brain activation},
author={Pereira, Francisco and Lou, Bin and Pritchett, Brianna and Ritter, Samuel and Gershman, Samuel J
and Kanwisher, Nancy and Botvinick, Matthew and Fedorenko, Evelina},
journal={Nature communications},
volume={9},
number={1},
pages={1--13},
year={2018},
publisher={Nature Publishing Group}
}"""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kvfairchild we're beginning to duplicate this BIBTEX quite a lot, e.g. in data/pereira2018 and benchmarks/pereira2018. One simple solution might be to replace the benchmarks definitions with from brainscore_language.data.pereira2018 import BIBTEX, is that acceptable from a plugin perspective? I guess we might run into import errors if dependencies are not installed and potentially encourage direct imports when we want plugins to go through the plugin manager.

@@ -0,0 +1,135 @@
import logging

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this just replace the current pereira2018? I would say we don't want a new file, but rather want to make this the new version.
Tagging @kvfairchild so she can chime in from the plugins perspective.

def __init__(
self,
experiment: str,
# ceiling_s3_kwargs: dict = None,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dead code; put on S3

},
)
identifier = f"Pereira2018.{experiment}-linreg_pearsonr"
# ceiling = self._load_ceiling(identifier=identifier, **ceiling_s3_kwargs)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dead code


from brainscore_language import data_registry

# from brainscore_language.utils.s3 import load_from_s3

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dead code

@@ -0,0 +1,23 @@
import logging

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's talk about whether this goes into its own file or is part of the existing pereira2018 data plugin (I put a note on the agenda)

Comment on lines +52 to +53
# inv_neuroid_map = {v: k for k, v in neuroid_id_map}
# inv_presentation_map = {v: k for k, v in presentation_id_map}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feeling less strongly about it here, but still: dead code :)

Comment on lines +95 to +115
def upload_data_assembly(assembly, assembly_identifier, bucket_name):
# adapted from
# https://github.com/mschrimpf/brainio/blob/8a40a3558d0b86072b9e221808f19005c7cb8c17/brainio/packaging.py#L217

_logger.debug(f"Uploading {assembly_identifier} to S3")

# identifiers
assembly_store_identifier = "assembly_" + assembly_identifier.replace(".", "_")
netcdf_file_name = assembly_store_identifier + ".nc"
target_netcdf_path = (
Path(fetch.get_local_data_path()) / assembly_store_identifier / netcdf_file_name
)
s3_key = netcdf_file_name

# write to disk and upload
netcdf_kf_sha1 = write_netcdf(assembly, target_netcdf_path)
_logger.debug(f"Wrote file to {target_netcdf_path}.")
# upload_to_s3(target_netcdf_path, bucket_name, s3_key)
# _logger.debug(
# f"Uploaded assembly {assembly_identifier} to S3: {s3_key} (SHA1 hash {netcdf_kf_sha1})"
# )

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can just reuse

def upload_data_assembly(assembly, assembly_identifier, bucket_name="brainscore-language", assembly_prefix="assy_"):


assert (
len(set(assembly["neuroid"].values)) == 120
) # potential TODO: rename to neuroid_id

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes to do

@mschrimpf

Copy link
Copy Markdown
Member

@aalok-sathe any updates on this PR?

@aalok-sathe

Copy link
Copy Markdown
Member Author

should we be concerned by this (warning?) message?
DEBUG:brainscore_core.metrics:isel on raw values failed: ValueError("Dimensions {'subject'} do not exist. Expected one or more of ('split', 'neuroid')")

we encounter it at

for attr_key in values[0].attrs:
during ceiling computation and aren't sure if this is an issue.
our assembly contains subject as a coord but not as a dimension (subject is never a dimension, right? it is along the neuroid dimension?)

@aalok-sathe

Copy link
Copy Markdown
Member Author

We're also looking for some help towards this failure of the test; now that we uploaded to s3 we're not sure why it's failing to find the assembly file in the cache: https://app.travis-ci.com/github/brain-score/language/builds/255739587#L660

@mschrimpf

Copy link
Copy Markdown
Member

should we be concerned by this (warning?) message? DEBUG:brainscore_core.metrics:isel on raw values failed: ValueError("Dimensions {'subject'} do not exist. Expected one or more of ('split', 'neuroid')")

No -- this is just saying that it cannot select on the score's raw values, so it is not selecting anything there. Maybe we should turn this into a debug message..

We're also looking for some help towards this failure of the test; now that we uploaded to s3 we're not sure why it's failing to find the assembly file in the cache: https://app.travis-ci.com/github/brain-score/language/builds/255739587#L660

At least in the build you linked, it's trying to load the file from local disk rather than S3:

brainscore_language/data/pereira2018_v2022/__init__.py:23: in <lambda>
    data_registry["Pereira2018_v2022.language"] = lambda: load_from_disk("Pereira2018ROI")

Comment thread tests/test_test_plugins.py Resolved
@aalok-sathe

Copy link
Copy Markdown
Member Author

We're also looking for some help towards this failure of the test; now that we uploaded to s3 we're not sure why it's failing to find the assembly file in the cache: https://app.travis-ci.com/github/brain-score/language/builds/255739587#L660

At least in the build you linked, it's trying to load the file from local disk rather than S3:

brainscore_language/data/pereira2018_v2022/__init__.py:23: in <lambda>
    data_registry["Pereira2018_v2022.language"] = lambda: load_from_disk("Pereira2018ROI")

I think we changed that in the latest commit we pushed yesterday:
a743994

Comment on lines +24 to +28
data_registry["Pereira2018_v2022.language"] = lambda: load_from_s3(
identifier="Pereira2018ROI",
version_id="8kEzAXaWnxjMIC95MrhSJ3gtP2a1W.Y7",
sha1="235ecf1f2abc38cb892c0a7b5c9c465434f153c5",
)

@mschrimpf mschrimpf Oct 13, 2022 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aalok-sathe I set the S3 object to public, but I think the issue is that you're attempting to load assy_Pereira2018ROI while the S3 file is called assembly_Pereira2018ROI -- if you pass assembly_prefix='assembly' to load_from_s3, I believe it should work

def load_from_s3(identifier, version_id, sha1, assembly_prefix="assy_", cls=NeuroidAssembly) -> DataAssembly:

@gretatuckute

Copy link
Copy Markdown
Contributor

should we be concerned by this (warning?) message? DEBUG:brainscore_core.metrics:isel on raw values failed: ValueError("Dimensions {'subject'} do not exist. Expected one or more of ('split', 'neuroid')")

No -- this is just saying that it cannot select on the score's raw values, so it is not selecting anything there. Maybe we should turn this into a debug message..

We're also looking for some help towards this failure of the test; now that we uploaded to s3 we're not sure why it's failing to find the assembly file in the cache: https://app.travis-ci.com/github/brain-score/language/builds/255739587#L660

At least in the build you linked, it's trying to load the file from local disk rather than S3:

brainscore_language/data/pereira2018_v2022/__init__.py:23: in <lambda>
    data_registry["Pereira2018_v2022.language"] = lambda: load_from_disk("Pereira2018ROI")

It already shows up as a DEBUG message. But I don't think we understand why it would occur there in the first place? In tracks to a brainio script where there is even no "isel" operation?

@mschrimpf

mschrimpf commented Oct 26, 2022 •

Copy link
Copy Markdown
Member

Sorry, this PR was closed after combining commit history. @aalok-sathe can you please open a new PR? I'm afraid the simplest solution is to 1. checkout the branch locally, 2. copy all files into a separate location, 3. checkout main, 4. update main, 5. create a new branch, 6. copy all files back again overwriting the files in main, 7. push and open a PR.

@aalok-sathe

aalok-sathe commented Oct 26, 2022 via email

Copy link
Copy Markdown
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants