Skip to content

Commit

Permalink
Mocking more modules and fixed typo in documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
muammar committed Mar 13, 2020
1 parent 51c4145 commit 602f987
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 27 deletions.
3 changes: 0 additions & 3 deletions docs/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,4 @@ dependencies:
- sphinxcontrib-inlinesyntaxhighlight
- ase
- m2r
- joblib
- msgpack
- msgpack_numpy

15 changes: 0 additions & 15 deletions docs/requirements.txt

This file was deleted.

34 changes: 28 additions & 6 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,42 @@

import os
import sys

sys.path.insert(0, os.path.abspath("../../"))

try:
import torch
except ModuleNotFoundError:
from unittest.mock import MagicMock


class Mock(MagicMock):
@classmethod
def __getattr__(cls, name):
return MagicMock()

MOCK_MODULES = ['torch', "torch.optim", "torch.nn.Module", "plotly"]
@classmethod
def __getattr__(cls, name):
return MagicMock()

MOCK_MODULES = [
"torch",
"torch.optim",
"torch.nn.Module",
"plotly",
"joblib",
"msgpack",
"msgpack_numpy",
"seaborn",
"dask_ml",
"ase",
"scipy",
"numpy",
"pip",
"pandas",
"plotly",
"pytest",
"matplotlib",
"dscribe",
"msgpack_python",
"scikit_learn",
"dask"
]

sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)

Expand Down
2 changes: 1 addition & 1 deletion docs/source/hpc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ carry out computations. This is useful when prototyping and building your
pipeline withouth wasting time waiting for HPC resources in a crowded cluster
facility.

ML4Chem can run with:code:`LocalCluster` objects, for which the scripts have
ML4Chem can run with :code:`LocalCluster` objects, for which the scripts have
to contain the following::

from dask.distributed import Client, LocalCluster
Expand Down
5 changes: 3 additions & 2 deletions ml4chem/atomistic/potentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ def load(Cls, model=None, params=None, preprocessor=None, **kwargs):
weights = load(model)
# TODO remove after de/serialization is fixed.
try:
weights = {key.decode("utf-8"): value for key, value in weights.items()}
weights = {
key.decode("utf-8"): value for key, value in weights.items()
}
except AttributeError:
weights = {key: value for key, value in weights.items()}

Expand Down Expand Up @@ -412,4 +414,3 @@ def calculate(self, atoms, properties, system_changes):

# Populate ASE's self.results dict
self.results["energy"] = energy

0 comments on commit 602f987

Please sign in to comment.