aspuru-guzik-group / ORGANIC

Code repo for optimizing distributions of molecules.
GNU General Public License v3.0
127 stars 63 forks source link

how to use ORGANIC #6

Open xuzhang5788 opened 6 years ago

xuzhang5788 commented 6 years ago

Although I read your tutorial, I still didn't know how to use it.

First of all, I run $ pip install -r requirement.txt

I don't know what GPmol is.

Secondly, When I run model = ORGANIC('tutorial1', params=params)

it was told that ORGANIC is not defined.

If I add from organic import ORGANIC

it was told that organic is not a module.

I am so sorry that your tutorial is not very clear. If you would like to prepare a jupyter notebook to explain how to use it, it will be a great help.

Thank you very much for great work.

prokia commented 6 years ago

I have the same problem and hope for a realizable solution.

ianwesleyarmstrong commented 6 years ago

@xuzhang5788 I have had more luck managing the environment with Anaconda rather thatn pip. The command used to create the environment with all dependencies is conda env update -f=requirements.yml

prokia commented 6 years ago

@russiancircles I have successfully created the environment with requirements.yml. But when I run model = ORGANIC('tutorial1', params=params), it was told that ORGANIC is not defined as before. I wonder how can I run ORGANIC as shown in tutorial. Thank you for your kind suggestion.

ianwesleyarmstrong commented 6 years ago

That's good to hear! This is the current script I am using to run ORGANIC. I hope you can take some cues from it. I would try running the import like I have below

from model.organic import ORGANIC

organ_params = {
    'PRETRAIN_GEN_EPOCHS': 250, 'PRETRAIN_DIS_EPOCHS': 20, 'MAX_LENGTH': 60, 'LAMBDA': 0.5, "DIS_EPOCHS": 2, 'SAMPLE_NUM': 6400, 'WGAN':True, 'TBOARD_LOG':True}

# hyper-optimized parameters
disc_params = {"DIS_L2REG": 0.2, "DIS_EMB_DIM": 32, "DIS_FILTER_SIZES": [
    1, 2, 3, 4, 5, 8, 10, 15], "DIS_NUM_FILTERS": [50, 50, 50, 50, 50, 50, 50, 75], "DIS_DROPOUT": 0.75}

organ_params.update(disc_params)

model = ORGANIC('test', params=organ_params)
model.load_training_set('data/smallmols_sub.smi')
# model.load_prev_pretraining('pretrain_ckpt/qm9-5k_pretrain_ckpt')
model.set_training_program(
    ['novelty'], [100])
model.load_metrics()
# model.load_prev_training(ckpt='qm9-5k_20.ckpt')
model.train()
xuzhang5788 commented 6 years ago

Thank you @russiancircles I run from model.organic import ORGANIC, then I got:

ImportError Traceback (most recent call last)

in () ----> 1 from model.organic import ORGANIC /media/projects/ORGANIC/model/organic.py in () 23 from __future__ import absolute_import, division, print_function 24 import os ---> 25 from gpu_utils import pick_gpu_lowest_memory 26 try: 27 gpu_free_number = str(pick_gpu_lowest_memory()) ImportError: No module named 'gpu_utils' When you run your script, which directory do you on? ORGANIC/ or ORGANIC/model?
ianwesleyarmstrong commented 6 years ago

I was running from the ORGANIC/ directory. I also had to play around with some of the imports in the organic.py file in ORGANIC/model to get it to work.

xuzhang5788 commented 6 years ago

@russiancircles I was also running from the ORGANIC directory. I used your conda method to create a virtual environment, but still got errors. What do you mean that play around with some of the imports? gpu_utils.py is under model/ directory. Do I need to change from gpu_utils import pick_gpu_lowest_memory into from model.gpu_utils import pick_gpu_lowest_memory?

ianwesleyarmstrong commented 6 years ago

Precisely. I had to go through and change all of the local function imports to reflect upon their hierarchy in the file system.

xuzhang5788 commented 6 years ago

@russiancircles Thank you so much. I used your method to install ORGANIC, then go through several .py files to change imports (adding model.***), finally ORGANIC can run. However, it ran on CPU not GPU even through I installed tensorflow with " pip3 install --upgrade tensorflow-gpu==1.2.1". Any advice? Anyways, thank you so much for helping me a lot.

ianwesleyarmstrong commented 6 years ago

Ah. Do you have the CUDA toolkit/cuDNN installed? This is likely where your error lies. When you have that done, make sure to install the correct version of tensorflow for the CUDA version you are using. It should say in the documentation.

https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html https://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html

weiwen6 commented 5 years ago

I am getting a segfault 11 when I run it. What could be the likely error?