Skip to content
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

Import error of GlassNet in 0.4.2 #10

Closed
charlesll opened this issue Aug 18, 2023 · 8 comments
Closed

Import error of GlassNet in 0.4.2 #10

charlesll opened this issue Aug 18, 2023 · 8 comments

Comments

@charlesll
Copy link

Hi, we updated GlassPy to 0.4.2 (from 0.4.0), and since then cannot load GlassNet. It seems that a model file is missing in 0.4.2.

The problem is solved downgrading to 0.4.0 for now. We did not test if it replicates in 0.4.1, but in 0.4.2 we replicated the problem on two different installs on two Mac OS computers.

The exact error message is the following:

FileNotFoundError Traceback (most recent call last)
Input In [2], in <cell line: 1>()
----> 1 model = GlassNet()

File ~/anaconda3/envs/ml/lib/python3.9/site-packages/glasspy/predict/models.py:578, in GlassNet.init(self, st_models)
576 self.st_dict = {}
577 for target in self._st_models:
--> 578 _model = GlassNetSTNN(target)
579 _model.eval()
580 self.st_dict[target] = _model

File ~/anaconda3/envs/ml/lib/python3.9/site-packages/glasspy/predict/models.py:501, in GlassNetSTNN.init(self, model_name)
493 self.tasks = nn.ModuleList(
494 [
495 nn.Sequential(nn.Linear(dim, 10), nn.ReLU(), nn.Linear(10, 1))
496 for n in range(self.hparams["n_targets"])
497 ]
498 )
500 self.training_file = _BASEMODELPATH / f"st-nn/{model_name}.p"
--> 501 self.load_training(self.training_file)

File ~/anaconda3/envs/ml/lib/python3.9/site-packages/glasspy/predict/base.py:940, in MLP.load_training(self, path)
938 def load_training(self, path):
939 state_dict, learning_train, learning_val, hparams = pickle.load(
--> 940 open(path, "rb")
941 )
942 self.load_state_dict(state_dict)
943 self.learning_curve_train = learning_train

FileNotFoundError: [Errno 2] No such file or directory: '/Users/charleslelosq/anaconda3/envs/ml/lib/python3.9/site-packages/glasspy/predict/models/st-nn/AbbeNum.p'

drcassar added a commit that referenced this issue Aug 18, 2023
@drcassar
Copy link
Owner

Thanks a lot @charlesll! It should be fixed now in v0.4.3. Could you please test and report back?

@charlesll
Copy link
Author

I now get another error, from a file not found at module import:
FileNotFoundError: /Users/charleslelosq/anaconda3/envs/ml/lib/python3.9/site-packages/glasspy/chemistry/data/chemical_properties.csv not found.

drcassar added a commit that referenced this issue Aug 21, 2023
@drcassar drcassar reopened this Aug 21, 2023
@drcassar
Copy link
Owner

I now get another error, from a file not found at module import: FileNotFoundError: /Users/charleslelosq/anaconda3/envs/ml/lib/python3.9/site-packages/glasspy/chemistry/data/chemical_properties.csv not found.

Thanks again for your input, @charlesll. For now, please try to install GlassPy using pip install --upgrade git+https://github.com/drcassar/glasspy, it should work. I am sorting out some problems to upload the current version to PyPI as it is above the allowed limit (100 Mb).

@charlesll
Copy link
Author

I confirm, it works!

@drcassar
Copy link
Owner

Thanks! I will leave the issue open until I sort out how to work with the size limit on PyPI.

@drcassar
Copy link
Owner

Hi @charlesll, if possible, could you please test installing GlassPy v0.4.4 from pip (pip install --upgrade glasspy)? This new version now downloads SciGlass data from Zenodo as soon as it is needed (instead of shipping the data with the module). I tested this on linux and it seems to be working, but I do not have access to a Mac OS computer to test.

@charlesll
Copy link
Author

Hi @drcassar, install is good on Mac OS 13.4.1 (Intel processor). GlassNet predictions work. Getting data from SciGlass effectively download SciGlass and it seems to work well.

@drcassar
Copy link
Owner

drcassar commented Sep 3, 2023

Great, thanks a lot @charlesll! I will close this issue as it seems to be solved now.

@drcassar drcassar closed this as completed Sep 3, 2023
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

No branches or pull requests

2 participants