Skip to content

Commit

Permalink
Merge pull request deepchem#3896 from shreyasvinaya/ci-fixes
Browse files Browse the repository at this point in the history
CI Fixes: patch fix for `tfp`, docker build
  • Loading branch information
rbharath authored Mar 19, 2024
2 parents eef32b0 + 095d642 commit 3eccafe
Show file tree
Hide file tree
Showing 43 changed files with 163 additions and 156 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo rm -rf /usr/local/lib/android
- uses: actions/checkout@v4
- name: Cache pip modules for Linux
if: runner.os == 'Linux'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo rm -rf /usr/local/lib/android
- uses: actions/checkout@v4
- name: Cache pip packages for Linux
uses: actions/cache@v4
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo rm -rf /usr/local/lib/android
- uses: actions/checkout@v4
with:
fetch-depth: 0
Expand All @@ -44,7 +45,7 @@ jobs:
${{ runner.os }}-pip-
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.9'

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/jax_setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo rm -rf /usr/local/lib/android
- uses: actions/checkout@v4
with:
fetch-depth: 0
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/mini_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ jobs:
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo rm -rf /usr/local/lib/android
- uses: actions/checkout@v4
with:
fetch-depth: 0
Expand Down Expand Up @@ -222,7 +223,7 @@ jobs:
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
builder: ${{ steps.buildx.outputs.name }}
context: ./docker/nightly
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/tensorflow_setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ jobs:
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo rm -rf /usr/local/lib/android
- uses: actions/checkout@v4
with:
fetch-depth: 0
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ jobs:
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo rm -rf /usr/local/lib/android
- uses: actions/checkout@v4
with:
fetch-depth: 0
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/torch_setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ jobs:
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo rm -rf /usr/local/lib/android
- uses: actions/checkout@v4
with:
fetch-depth: 0
Expand Down
15 changes: 7 additions & 8 deletions deepchem/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
Gathers all datasets in one place for convenient imports
"""
# flake8: noqa
import logging

logger = logging.getLogger(__name__)

# TODO(rbharath): Get rid of * import
from deepchem.data.datasets import pad_features
Expand All @@ -24,13 +27,9 @@
from deepchem.data.data_loader import InMemoryLoader
try:
from deepchem.data.data_loader import SAMLoader
except ImportError:
print("Error: Unable to import pysam. Please make sure it is installed.")
try:
from deepchem.data.data_loader import BAMLoader
except ImportError:
print("Error: Unable to import pysam. Please make sure it is installed.")
try:
from deepchem.data.data_loader import CRAMLoader
except ImportError:
print("Error: Unable to import pysam. Please make sure it is installed.")
except ImportError as e:
logger.warning(
f'Skipped loading biological sequence loaders, missing a dependency. {e}'
)
6 changes: 3 additions & 3 deletions deepchem/data/data_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -1903,10 +1903,10 @@ class SAMLoader(DataLoader):
"""Handles loading of SAM files.
Sequence Alignment Map (SAM) is a text-based format used for storing biological sequences
aligned to a reference sequence.It is generally used for storing nucleotide sequences,
generated by next generation sequencing technologies, and unmapped sequences.
generated by next generation sequencing technologies, and unmapped sequences.
SAM files have a header section and an alignment section.Alignment sections have
11 mandatory fields, as well as a variable number of optional fields. Here, we
extract Query Name, Query Sequence, Query Length, Reference Name,
extract Query Name, Query Sequence, Query Length, Reference Name,
Reference Start, CIGAR and Mapping Quality of each read in the SAM file.
This class provides methods to load and featurize data from SAM files.
Expand All @@ -1931,7 +1931,7 @@ def __init__(self, featurizer: Optional[Featurizer] = None):
----------
featurizer: Featurizer (default: None)
The Featurizer to be used for the loaded SAM data.
"""

# Set attributes
Expand Down
11 changes: 8 additions & 3 deletions deepchem/data/tests/test_bam_loader.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import os
import unittest
import deepchem as dc
import logging

logger = logging.getLogger(__name__)

try:
import pysam
except ImportError:
print("Error: Unable to import pysam. Please make sure it is installed.")
import numpy as np
except ImportError as e:
logger.warning(
f'Skipped loading biological sequence featurized, missing a dependency. {e}'
)


class TestBAMLoader(unittest.TestCase):
Expand Down
11 changes: 8 additions & 3 deletions deepchem/data/tests/test_cram_loader.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import os
import unittest
import deepchem as dc
import logging

logger = logging.getLogger(__name__)

try:
import pysam
except ImportError:
print("Error: Unable to import pysam. Please make sure it is installed.")
import numpy as np
except ImportError as e:
logger.warning(
f'Skipped loading biological sequence featurized, missing a dependency. {e}'
)


class TestCRAMLoader(unittest.TestCase):
Expand Down
11 changes: 8 additions & 3 deletions deepchem/data/tests/test_sam_loader.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import os
import unittest
import deepchem as dc
import logging

logger = logging.getLogger(__name__)

try:
import pysam
except ImportError:
print("Error: Unable to import pysam. Please make sure it is installed.")
import numpy as np
except ImportError as e:
logger.warning(
f'Skipped loading biological sequence featurized, missing a dependency. {e}'
)


class TestSAMLoader(unittest.TestCase):
Expand Down
6 changes: 1 addition & 5 deletions deepchem/feat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,12 @@
try:
from deepchem.feat.bio_seq_featurizer import SAMFeaturizer
from deepchem.feat.bio_seq_featurizer import BAMFeaturizer
from deepchem.feat.bio_seq_featurizer import CRAMFeaturizer
except ImportError as e:
logger.warning(
f'Skipped loading biological sequence featurized, missing a dependency. {e}'
)

try:
from deepchem.feat.bio_seq_featurizer import CRAMFeaturizer
except ImportError:
print("Error: Unable to import pysam. Please make sure it is installed.")

# tokenizers
try:
from deepchem.feat.smiles_tokenizer import SmilesTokenizer
Expand Down
13 changes: 4 additions & 9 deletions deepchem/feat/bio_seq_featurizer.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import numpy as np
import deepchem as dc
try:
import pysam
except ImportError:
pass
from deepchem.feat import Featurizer


Expand Down Expand Up @@ -109,7 +104,7 @@ class BAMFeaturizer(Featurizer):
(Sequence Alignment Map) files. This class extracts Query Name, Query
Sequence, Query Length, Reference Name, Reference Start, CIGAR and Mapping
Quality of the alignment in the BAM file.
This is the default featurizer used by BAMLoader, and it extracts the following
fields from each read in each BAM file in the given order:-
- Column 0: Query Name
Expand All @@ -134,7 +129,7 @@ class BAMFeaturizer(Featurizer):
----
This class requires pysam to be installed. Pysam can be used with Linux or MacOS X.
To use Pysam on Windows, use Windows Subsystem for Linux(WSL).
"""

def __init__(self, max_records=None):
Expand Down Expand Up @@ -199,7 +194,7 @@ class CRAMFeaturizer(Featurizer):
biological sequences aligned to a reference sequence. This class extracts Query Name, Query
Sequence, Query Length, Reference Name, Reference Start, CIGAR and Mapping
Quality of the alignment in the CRAM file.
This is the default featurizer used by CRAMLoader, and it extracts the following
fields from each read in each CRAM file in the given order:-
- Column 0: Query Name
Expand All @@ -224,7 +219,7 @@ class CRAMFeaturizer(Featurizer):
----
This class requires pysam to be installed. Pysam can be used with Linux or MacOS X.
To use Pysam on Windows, use Windows Subsystem for Linux(WSL).
"""

def __init__(self, max_records=None):
Expand Down
2 changes: 1 addition & 1 deletion deepchem/models/torch_models/acnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def __init__(self,
**kwargs) -> None:
"""TorchModel wrapper for ACNN
Parameters
Parameters
----------
n_tasks: int
number of tasks
Expand Down
1 change: 1 addition & 0 deletions deepchem/models/torch_models/hf_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class HuggingFaceModel(TorchModel):
- `mtr` - multitask regression - a task used for both pretraining base models and finetuning
- `regression` - use it for regression tasks, like property prediction
- `classification` - use it for classification tasks
When the task is not specified or None, the wrapper returns raw output of the HuggingFaceModel.
In cases where the HuggingFaceModel is a model without a task specific head, this output will be
the last hidden states.
Expand Down
2 changes: 2 additions & 0 deletions deepchem/models/torch_models/molgan.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ def create_generator(self):
The model has two outputs:
1. edges
2. nodes
The format differs depending on intended use (training or sample generation).
For sample generation use flag, sample_generation=True while calling generator
i.e. gan.generators[0](noise_input, training=False, sample_generation=True).
Expand All @@ -188,6 +189,7 @@ def create_discriminator(self,
Takes two inputs:
1. adjacency tensor, containing bond information
2. nodes tensor, containing atom information
The input vectors need to be in one-hot encoding format.
Use MolGAN featurizer for that purpose. It will be simplified
in the future release.
Expand Down
1 change: 0 additions & 1 deletion deepchem/splits/splitters.py
Original file line number Diff line number Diff line change
Expand Up @@ -1511,7 +1511,6 @@ class ScaffoldSplitter(Splitter):
Notes
-----
- This class requires RDKit to be installed.
- When a SMILES representation of a molecule is invalid, the splitter skips processing
the datapoint i.e it will not include the molecule in any splits.
Expand Down
Loading

0 comments on commit 3eccafe

Please sign in to comment.