nuclear-multimessenger-astronomy / nmma

A pythonic library for probing nuclear physics and cosmology with multimessenger analysis
https://nuclear-multimessenger-astronomy.github.io/nmma/
GNU General Public License v3.0
30 stars 58 forks source link

Use the same model.pkl file for all interpolation types #240

Closed bfhealy closed 1 year ago

bfhealy commented 1 year ago

This PR resolves #237 by saving/loading/downloading the same file (formatted as model.pkl) for all interpolation types.

sahiljhawar commented 1 year ago

@bfhealy Does this fix requires the currently avalaible models (which are on Potsdam server) to be renamed?

ValueError: model_name Bu2019lm_sparse_tf not found in models list

Why the Bu2019.pkl is being downloaded from Zenodo, can you please look into that?

Also can you please have a look at the Unit tests and why the training.py test failed and fix that as needed.

To enable the following instructions: AVX2 AVX512F FMA, in other operations, 
rebuild TensorFlow with the appropriate compiler flags.
bfhealy commented 1 year ago

@sahiljhawar The latest commit passes all tests. The code does not require any existing models on Zenodo to be changed, although we may want to remove any files of the form model_tf.pkl in the future since they are duplicates of model.pkl.

Previous commits assumed that model files would have up to one underscore (if they were trained via tensorflow). This led to an error for Bu2019lm_sparse_tf in the tests since it has more than one underscore. The code now supports models with additional underscores (tested locally on AnBa2022_linear as an example).

Finally, I needed to make a one-line change to load_models_list in models.py. The code was checking for any files within the models_home directory. Now that one .pkl file corresponds to more than one directory of filter files, I changed the code to search for directories within that path instead of files. The directory names correlate one-to-one with a trained model, so the code now behaves as intended.

sahiljhawar commented 1 year ago

LGTM

sahiljhawar commented 1 year ago

@bfhealy Additionally, can you please write 1-2 liner point for release notes.

bfhealy commented 1 year ago

@sahiljhawar Sure, please see below: