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

Chemprop #1683

Closed
wants to merge 5 commits into from
Closed

Chemprop #1683

wants to merge 5 commits into from

Conversation

cgrambow
Copy link

@cgrambow cgrambow commented Aug 12, 2019

Motivation or Problem

DDE does not work with Python 3.

Description of Changes

Switch the ML thermo estimator to chemprop. New models have been added in database PR ReactionMechanismGenerator/RMG-database#351.

Testing

Once Python 3 transition has occurred, check that tests pass and ML example can be run.

Question for Reviewer

I don't understand how I should be editing the different environment files. I added chemprop to the py3 environment file. Should I also add it to the other ones?

@mliu49
Copy link
Contributor

mliu49 commented Aug 12, 2019

Regarding environment files, my thought is that by the end of this, we will go back to having a single environment file for both mac and linux (and dropping the windows one) which will be environment_py3.yml, though we'll probably rename it to environment.yml.

I assume this breaks the Python 2 build? If so, then this will not be merged until the last stage of the transition.

@@ -1,15 +1,16 @@
name: rmg_env
channels:
- pytorch
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you put the pytorch channel on the bottom, so in case we ever do add a package to the RMG channel, it will supersede it?

Copy link
Author

Choose a reason for hiding this comment

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

Oh actually, I just checked pytorch in default Anaconda and it seems they updated to the current version 5 days ago. I can test if the defaults build works correctly with chemprop and then could remove the pytorch channel completely.

Copy link
Author

Choose a reason for hiding this comment

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

Removed pytorch channel and force pushed.

@@ -1,6 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you remove all of the shebangs intentionally? Are they not necessary in Python 3?

Copy link
Author

Choose a reason for hiding this comment

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

The coding specification is not necessary in Python 3 because that is now the default.

I removed the first line as well because the modules aren't meant to be run as scripts and Python doesn't need that line if you're importing a module. That line is only useful if you plan to run a Python file without telling the command line explicitly that you're using Python. Most RMG files have that first line but unless they're scripts, none of those files need it. We could consider removing it everywhere. Or would you rather I keep it here to be consistent with the rest of RMG?

Copy link
Contributor

Choose a reason for hiding this comment

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

In that case, I think we can remove them everywhere. That can be a separate PR though.

Copy link
Author

Choose a reason for hiding this comment

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

Should I keep it here then?

@@ -28,17 +25,24 @@
# #
###############################################################################

from argparse import Namespace
Copy link
Contributor

Choose a reason for hiding this comment

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

Put from imports below imports

Copy link
Author

Choose a reason for hiding this comment

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

Is that a PEP-8 rule or an RMG rule? I thought imports were supposed to be alphabetical, but I might be wrong.

Copy link
Contributor

Choose a reason for hiding this comment

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

Great question! I thought it was in PEP-8 but apparently not. It seems that it's just the default PyCharm style.

I like grouping from and direct imports separately, but I would want to get everyone's opinions before making it an RMG rule.

Copy link
Author

Choose a reason for hiding this comment

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

So in any case we want the following order for each module:

  1. standard library imports
  2. related third party imports
  3. local application/library specific imports

And then I think I agree with you that it makes sense to first have normal imports and then from imports and imports should be alphabetical within each group.

@cgrambow cgrambow force-pushed the chemprop branch 4 times, most recently from 90a6466 to c64f1ae Compare August 20, 2019 00:06
@cgrambow
Copy link
Author

So it seems that even the pytorch builds on the official anaconda channel are not reliable. The only error-free builds are available on the pytorch channel. This is what was causing your issue, @mliu49. So I actually went ahead and added the pytorch channel back in. I also upgraded the chemprop build on the RMG channel to use pytorch-cpu, which is actually a lot smaller as well and doesn't install CUDA dependencies. Obviously this means that chemprop cannot be used with GPU but that should be fine for RMG users.

Tested locally, on Mithrim, on RMG, and on Pharos.

Added a bunch of fixup commits to address the issues.

@mliu49
Copy link
Contributor

mliu49 commented Aug 20, 2019

Thanks! I think the fixes look good. What led to the addition of hyperopt and tensorboardx as dependencies compared to before?

@cgrambow
Copy link
Author

They already were dependencies of chemprop before but when I built the environment locally I had conda-forge already in my .condarc so it didn't complain that it couldn't resolve those dependencies.


Returns: ThermoData
"""
smi = molecule.SMILES if isinstance(molecule, Molecule) else molecule
Copy link
Contributor

Choose a reason for hiding this comment

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

The cp0 and cpinf calculation below does not work if molecule is a string.

Also, could you update thermoTest.TestThermoDatabase.setUpClass?

Copy link
Author

Choose a reason for hiding this comment

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

Done. Also rebased onto new py3.

Colin Grambow and others added 5 commits August 26, 2019 14:16
Only use two models, one that predicts enthalpy and one that predicts
entropy and heat capacity simultaneously. Uncertainty cannot be estimated
with the new models.

If chemprop is not available, don't raise error until trying to use it.
Packages requiring libgcc have been rebuilt to require libgcc-ng instead. With this the conda solver can resolve the environment without needing pydot-ng and pygpu to be given explicitly
@mliu49
Copy link
Contributor

mliu49 commented Sep 23, 2019

Incorporated into #1713 and #1724.

@mliu49 mliu49 closed this Sep 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants