-
Notifications
You must be signed in to change notification settings - Fork 58
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
Fixes for multimessenger analysis #252
Fixes for multimessenger analysis #252
Conversation
Bug fix data_dump instead of data-dump
When interpolation type is tf, we only want to get the _tf model when we can access the remote models. This hack works for now, but maybe we should think about a new system of naming conventions.
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 do not quite understand the reason for the changes in this PR yet.
@@ -12,7 +12,7 @@ def create_nmma_analysis_parser(sampler="dynesty"): | |||
|
|||
analysis_parser = argparse.ArgumentParser(prog="nmma_analysis", parents=[parser]) | |||
analysis_parser.add_argument( | |||
"data-dump", |
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.
This just means --data-dump is the argument and then the argument is args.data_dump already.
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.
but the data-dump is a positional argument and therefore it gets passed as args.data-dump which causes trouble
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.
No I think it turns into data_dump. Can @sahiljhawar confirm the behavior perhaps?
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.
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.
No, it does not gets changed to data_dump
. It remains data-dump and it cannot be accessed as an attribute of args
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 would suggest to change data_dump
from position argument (data_dump
) to a normal argument (--data-dump
) and see if that works.
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.
@haukekoehn @sahiljhawar Ah that is presumably the difference. Sorry, I didn't realize that it maintains its name if positional.
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.
@haukekoehn args.data-dump
is not a valid syntax. In case the value of data-dump
needs to be extracted it should be done as such getattr(args, "data-dump"))
. Also, if positional arguments (such as data-dump
) are being used CLI, then only the order matters and none of the these works: --data-dump
, --data_dump
, data_dump
, data-dump
.
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.
yeah now i changed it to --data-dump
nmma/em/model.py
Outdated
@@ -291,7 +291,7 @@ def __init__( | |||
if filters is None: | |||
self.filters = model_filters | |||
|
|||
if os.path.isfile(modelfile): | |||
elif os.path.isfile(modelfile): |
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.
This if statement is meant to stand on its own. Maybe the local_only flag is not doing what you want?
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.
No, i think the local_only flag is alright, i think. This was just a quick fix from my side, where I use the Bu2022Ye model.
I wanted to prevent it from jumping in to the else statement below, where it tries to read in the _mag_tf model, which doesn't exist for Bu2022Ye.
As i said this is rather hacky and now that i look at it again probably inappropriate. I think the issue is that for Bu2022Ye os.path.isfile(modelfile) is False, because modelfile actually does not point to Bu2022Ye_tf.pkl but rather to Bu2022Ye.pkl which does not exist. But I don't know how to fix this consistently for the entirety of the models out there.
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.
@haukekoehn If _tf.pkl
is the problem, maybe try stripping off the _tf
from Bu2022Ye_tf.pkl
and then use it with --local-only
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 did it the other way around, where now _tf
is added to the modelfile
variable, when the interpolation type is tensorflow. Maybe we can chat tomorrow about this.
changed so it no longer is a positional argument.
nmma/em/model.py
Outdated
@@ -280,7 +280,7 @@ def __init__( | |||
self.svd_lbol_model = None | |||
elif self.interpolation_type == "tensorflow": | |||
import tensorflow as tf | |||
|
|||
modelfile = os.path.join(self.svd_path, f"{core_model_name}_tf.pkl") |
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.
@bfhealy Maybe we need a check here for the old style? For folks already with the stack downloaded?
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 am mostly ok with this as long as it works. Just unsure given the move away from the _tf pickle files.
@mcoughlin @bfhealy Maybe for now keep support for |
@sahiljhawar @bfhealy @haukekoehn I agree. Can we add an if else at the _tf check instead of just always looking for _tf? |
@mcoughlin @sahiljhawar I agree with this as well. I can add a temporary check for |
@mcoughlin @sahiljhawar Just pushed a commit - the default |
@mcoughlin Merge-ready? |
@sahiljhawar good for me! |
32bd04e
into
nuclear-multimessenger-astronomy:main
No description provided.