Skip to content

Commit

Permalink
Python 3.8 compatibility (GT4SD#152)
Browse files Browse the repository at this point in the history
* fix: wheel tensorboard version conflict (closes GT4SD#146)

* feat: python 3.8 support

* Install (GT4SD#1)

* refactor: importlib instead of pkg_resources

* fix: importlib pin

* wip: mypy python 3.8 checks, lower lightning

* wip: restore new lightning version

* docs: updating python version upper bound

* chore: import cleanup

* chore: remove unused import from init

Co-authored-by: Matteo Manica <[email protected]>
  • Loading branch information
jannisborn and drugilsberg authored Oct 10, 2022
1 parent f6a458d commit 58accd8
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 23 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ For full details on the library API and examples see the [docs](https://gt4sd.gi

Currently `gt4sd` relies on:

- python>=3.7,<3.8
- python>=3.7,<3.9
- pip>=19.1,<20.3

We are actively working on relaxing these, so stay tuned or help us with this by [contributing](./CONTRIBUTING.md) to the project.
Expand Down
2 changes: 1 addition & 1 deletion conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ channels:
- https://conda.anaconda.org/pyg
- https://conda.anaconda.org/conda-forge
dependencies:
- python>=3.7,<3.8
- python>=3.7,<3.9
- pip>=19.1,<20.3
- pytorch>=1.0
- pytorch-scatter>=2.0.9
Expand Down
2 changes: 1 addition & 1 deletion conda_gpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ channels:
- https://conda.anaconda.org/pyg
- https://conda.anaconda.org/conda-forge
dependencies:
- python>=3.7,<3.8
- python>=3.7,<3.9
- pip>=19.1,<20.3
- pytorch>=1.0
- pytorch-scatter>=2.0.9
Expand Down
13 changes: 7 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
accelerate>=0.12
datasets>=1.11.0
diffusers>=0.2.4
ipaddress>=1.0.23
joblib>=1.1.0
importlib-metadata>=1.7.0,<5.0.0 # temporary: https://github.com/python/importlib_metadata/issues/409
importlib-resources>=5.10.0
keras==2.3.1
ipaddress>=1.0.23
joblib>=1.1.0
keras>=2.3.1
keybert==0.2.0
minio==7.0.1
modlamp>=4.0.0
Expand All @@ -23,14 +23,15 @@ reinvent-chemistry==0.0.38
sacremoses>=0.0.41
scikit-learn>=1.0.0
scikit-optimize>=0.8.1
scipy>=1.0.0
sentencepiece>=0.1.95
sympy>=1.10.1
tables>=3.7.0
tape-proteins>=0.4
tensorboard!=2.5.0,>=2.2.0
tensorflow==2.1.0
torchdrug>=0.1.2
torchmetrics<0.7
tensorflow>=2.1.0
torchdrug>=0.2.0
torchmetrics>=0.7.0
torchvision>=0.12.0
transformers>=4.22.0
typing_extensions>=3.7.4.3
Expand Down
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ classifiers =
Operating System :: OS Independent
Programming Language :: Python :: 3
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8

[options]
install_requires =
accelerate
datasets
diffusers
ipaddress
importlib_metadata
importlib_resources
ipaddress
joblib
keras
keybert
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,11 @@ def __init__(
self.dimensions = self.define_dimensions(self.representation_order)

def _get_bounds(
self, minimum_value: float, maximum_value: float, z_dimension: int
) -> List[Tuple[float, float]]:
self,
minimum_value: Union[float, np.float32],
maximum_value: Union[float, np.float32],
z_dimension: int,
) -> List[Tuple[Union[float, np.float32], Union[float, np.float32]]]:
"""
Define a list of bounds for an hypercube.
Expand Down Expand Up @@ -366,7 +369,7 @@ def set_bounds(
for representation_name in self.representations.keys() - self.bounds.keys():
z_dimension = self.representations[representation_name].z_dimension
self.bounds[representation_name] = self._get_bounds(
MINIMUM_REAL, MAXIMUM_REAL, z_dimension
MINIMUM_REAL, MAXIMUM_REAL, z_dimension # type: ignore
)

def define_dimensions(self, representation_order: List[str]) -> List[Real]:
Expand All @@ -388,8 +391,8 @@ def define_dimensions(self, representation_order: List[str]) -> List[Real]:
)
latent_index += representation.z_dimension
dimensions.extend(
[
Real(lower_bound, upper_bound) # type:ignore
[ # type:ignore
Real(lower_bound, upper_bound)
for lower_bound, upper_bound in representation_bounds
]
)
Expand Down
8 changes: 4 additions & 4 deletions src/gt4sd/frameworks/gflownet/dataloader/data_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@ def setup(self, stage: Optional[str]) -> None: # type:ignore
self.ix_test = ixs[thresh:]

if stage == "fit" or stage is None:
self.train_dataset.set_indexes(self.ix_train)
self.val_dataset.set_indexes(self.ix_val)
self.train_dataset.set_indexes(self.ix_train) # type: ignore
self.val_dataset.set_indexes(self.ix_val) # type: ignore
if stage == "test" or stage is None:
self.test_dataset.set_indexes(self.ix_test)
self.test_dataset.set_indexes(self.ix_test) # type: ignore
if stage == "predict" or stage is None:
self.test_dataset.set_indexes(self.ix_test)
self.test_dataset.set_indexes(self.ix_test) # type: ignore

logger.info(
f"number of data points used for training: {len(self.train_dataset)}"
Expand Down
1 change: 0 additions & 1 deletion src/gt4sd/training_pipelines/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
# SOFTWARE.
#
"""Module initialization for gt4sd traning pipelines."""

import json
import logging
from typing import Any, Dict
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
# SOFTWARE.
#
"""Moses Organ trainer unit tests."""

import os
import shutil
import tempfile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
# SOFTWARE.
#
"""Moses VAE trainer unit tests."""

import os
import shutil
import tempfile
Expand Down
2 changes: 1 addition & 1 deletion vcs_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# version control systems requirements
guacamol_baselines @ git+https://github.com/GT4SD/[email protected]
molecule_generation @ git+https://github.com/microsoft/molecule-generation.git@v0.2.0
molecule_generation @ git+https://github.com/GT4SD/molecule-generation.git@main
moses @ git+https://github.com/GT4SD/[email protected]
paccmann_chemistry @ git+https://github.com/PaccMann/[email protected]
paccmann_generator @ git+https://github.com/PaccMann/[email protected]
Expand Down

0 comments on commit 58accd8

Please sign in to comment.