Skip to content
This repository was archived by the owner on May 24, 2025. It is now read-only.

Commit b7324d2

Browse files
committed
REINVENT v3.2
1 parent e2463b8 commit b7324d2

File tree

102 files changed

+1973
-835
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+1973
-835
lines changed

Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
FROM docker.io/continuumio/conda-ci-linux-64-python3.7:latest
2+
3+
USER root
4+
5+
RUN apt-get update && \
6+
apt-get -y install rsync procps && \
7+
wget https://sourceforge.net/projects/lmod/files/lua-5.1.4.9.tar.bz2 && \
8+
tar xf lua-5.1.4.9.tar.bz2 && \
9+
cd lua-5.1.4.9 && \
10+
./configure --prefix=/opt/apps/lua/5.1.4.9 && \
11+
make; make install && \
12+
cd /opt/apps/lua; ln -s 5.1.4.9 lua && \
13+
ln -s /opt/apps/lua/lua/bin/lua /usr/local/bin && \
14+
ln -s /opt/apps/lua/lua/bin/luac /usr/local/bin && \
15+
cd; wget https://sourceforge.net/projects/lmod/files/Lmod-8.2.tar.bz2 && \
16+
tar xf Lmod-8.2.tar.bz2 && \
17+
cd Lmod-8.2; ./configure --prefix=/opt/apps --with-fastTCLInterp=no && \
18+
make install && \
19+
ln -s /opt/apps/lmod/lmod/init/profile /etc/profile.d/z00_lmod.sh
20+
21+
ENV LMOD_ROOT=/opt/apps/lmod \
22+
LMOD_PKG=/opt/apps/lmod/lmod \
23+
LMOD_VERSION=8.2 \
24+
LMOD_CMD=/opt/apps/lmod/lmod/libexec/lmod \
25+
LMOD_DIR=/opt/apps/lmod/lmod/libexec \
26+
BASH_ENV=/opt/apps/lmod/lmod/init/bash
27+
28+
COPY . /reinventcli/
29+
30+
WORKDIR /reinventcli
31+
32+
RUN conda update -n base -c defaults conda && \
33+
conda env update --name=base --file=reinvent.yml && \
34+
chmod -R "a+rx" /reinventcli

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
REINVENT 3.1
1+
REINVENT 3.2
22
=================================================================================================================
33

44
Installation
@@ -12,7 +12,7 @@ Installation
1212

1313
4. Activate the environment:
1414

15-
$ conda activate reinvent.v3.0
15+
$ conda activate reinvent.v3.2
1616

1717
5. Use the tool.
1818

configs/example.config.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@
1818
"AZGARD_EXECUTOR_SCRIPT_PATH": "/<your_path>/executor.py",
1919
"AZGARD_ENV_PATH": "/<your_path>/miniconda3/envs/AZgard/bin/python",
2020
"AZGARD_DEBUG": true
21+
},
22+
"ICOLOS": {
23+
"ICOLOS_EXECUTOR_PATH": "/<your_path>/miniconda3/envs/icolosprod/bin/icolos",
24+
"ICOLOS_DEBUG": true
25+
},
26+
"AIZYNTH": {
27+
"CONFIG": "/projects/mai/synthesisplanning/minimal_config.yml"
2128
}
2229
},
2330
"ENVIRONMENTAL_VARIABLES": {
@@ -28,5 +35,7 @@
2835
"ACTIVITY_CLASSIFICATION": "",
2936
"SMILES_SET_PATH": "",
3037
"PRIOR_PATH": "",
31-
"LIBINVENT_PRIOR_PATH": ""
38+
"LIBINVENT_PRIOR_PATH": "",
39+
"SMILES_SET_LINK_INVENT_PATH":"",
40+
"LINK_INVENT_PRIOR_PATH": ""
3241
}

input.py

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,38 @@
33

44
import sys
55
import json
6+
import argparse
7+
from pathlib import Path
68
from running_modes.manager import Manager
79

810

9-
if __name__ == "__main__":
11+
DEFAULT_BASE_CONFIG_PATH = (Path(__file__).parent / 'configs/config.json').resolve()
12+
13+
parser = argparse.ArgumentParser(description='Run Reinvent.')
14+
parser.add_argument(
15+
'--base_config', type=str, default=DEFAULT_BASE_CONFIG_PATH,
16+
help='Path to basic configuration for Reinvent environment.'
17+
)
18+
parser.add_argument(
19+
'run_config', type=str,
20+
help='Path to configuration json file for this run.'
21+
)
1022

11-
with open(sys.argv[1]) as f:
12-
json_input = f.read().replace('\r', '').replace('\n', '')
1323

14-
configuration = {}
24+
def read_json_file(path):
25+
with open(path) as f:
26+
json_input = f.read().replace('\r', '').replace('\n', '')
1527
try:
16-
configuration = json.loads(json_input)
17-
except (ValueError, KeyError, TypeError):
18-
print("JSON format error")
19-
else:
20-
manager = Manager(configuration)
21-
manager.run()
28+
return json.loads(json_input)
29+
except (ValueError, KeyError, TypeError) as e:
30+
print(f"JSON format error in file ${path}: \n ${e}")
31+
32+
33+
if __name__ == "__main__":
34+
args = parser.parse_args()
35+
36+
base_config = read_json_file(args.base_config)
37+
run_config = read_json_file(args.run_config)
38+
39+
manager = Manager(base_config, run_config)
40+
manager.run()

pytest.ini

Lines changed: 0 additions & 4 deletions
This file was deleted.

reinvent.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: reinvent.v3.0
1+
name: reinvent.v3.2
22
channels:
33
- rdkit
44
- pytorch
@@ -211,9 +211,9 @@ dependencies:
211211
- markdown==3.2.1
212212
- opt-einsum==3.2.0
213213
- protobuf==3.11.3
214-
- reinvent-chemistry==0.0.40
215-
- reinvent-models==0.0.12
216-
- reinvent-scoring==0.0.57
214+
- reinvent-chemistry==0.0.50
215+
- reinvent-models==0.0.15rc1
216+
- reinvent-scoring==0.0.73
217217
- tensorboard==1.15.0
218218
- tensorflow==1.15.2
219219
- tensorflow-estimator==1.15.1

running_modes/.directory

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[Dolphin]
2+
Timestamp=2022,4,8,15,57,33
3+
Version=3
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from running_modes.automated_curriculum_learning.actions.base_action import BaseAction
2+
from running_modes.automated_curriculum_learning.actions.base_sample_action import BaseSampleAction
3+
from running_modes.automated_curriculum_learning.actions.lib_invent_sample_model import LibInventSampleModel
4+
from running_modes.automated_curriculum_learning.actions.link_invent_sample_model import LinkInventSampleModel
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import abc
2+
from running_modes.automated_curriculum_learning.logging.base_logger import BaseLogger
3+
4+
5+
class BaseAction(abc.ABC):
6+
def __init__(self, logger=None):
7+
"""
8+
(Abstract) Initializes an action.
9+
:param logger: An optional logger instance.
10+
"""
11+
self.logger: BaseLogger = logger
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import numpy as np
2+
from running_modes.automated_curriculum_learning.actions import BaseAction
3+
4+
5+
class BaseSampleAction(BaseAction):
6+
7+
def _get_indices_of_unique_smiles(self, smiles: [str]) -> np.array:
8+
"""Returns an np.array of indices corresponding to the first entries in a list of smiles strings"""
9+
_, idxs = np.unique(smiles, return_index=True)
10+
sorted_indices = np.sort(idxs)
11+
return sorted_indices

0 commit comments

Comments
 (0)