-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add option to specify a temporary folder for the experiment. (#5) * added option to rsync input and output data * added docstring * logging to stdout now * fixed script for clusters - now using slurm tmpdir to write temp results * fixing travis * added missing docstring * fixed tensorflow part (method signature change) * renamed variables * Seed for reproducibility (#6) * added option to rsync input and output data * added docstring * logging to stdout now * fixed script for clusters - now using slurm tmpdir to write temp results * fixing travis * added missing docstring * fixed tensorflow part (method signature change) * added seed for pytorch * fixed typo * added comment on how to use seed * fixed flake8 * added test on reproducibility * removed pytorch part from tensorflow * fixed cookiecutter syntax * added check for tensorflow * fixed typo in test file * added command to set the seed in tensorflow * fixed flake8 error * fixed typos * removed duplicate log * typo in docstring * better error message in test * added test to check repro using Orion (#8) * added test to check repro using Orion * more log into travis * more info to debug travis * running two trials for orion * added seed to orion * added orion test to tensorflow part * better log messages in travis
- Loading branch information
1 parent
298c140
commit 26dee14
Showing
19 changed files
with
174 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 4 additions & 3 deletions
7
{{cookiecutter.project_slug}}/examples/local_orion/orion_config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/utils/file_utils.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import logging | ||
import os | ||
import subprocess | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def rsync_folder(source, target): # pragma: no cover | ||
"""Uses rsync to copy the content of source into target. | ||
:param source: (str) path to the source folder. | ||
:param target: (str) path to the target folder. | ||
""" | ||
if not os.path.exists(target): | ||
os.makedirs(target) | ||
|
||
logger.info('rsyincing {} to {}'.format(source, target)) | ||
subprocess.check_call(["rsync", "-avzq", source, target]) |
27 changes: 27 additions & 0 deletions
27
{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/utils/reproducibility_utils.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import random | ||
|
||
import numpy as np | ||
{%- if cookiecutter.dl_framework == 'pytorch' %} | ||
import torch | ||
{%- endif %} | ||
{%- if cookiecutter.dl_framework in ['tensorflow_cpu', 'tensorflow_gpu'] %} | ||
import tensorflow as tf | ||
{%- endif %} | ||
|
||
|
||
def set_seed(seed): # pragma: no cover | ||
"""Set the provided seed in python/numpy/DL framework. | ||
:param seed: (int) the seed | ||
""" | ||
random.seed(seed) | ||
np.random.seed(seed) | ||
{%- if cookiecutter.dl_framework == 'pytorch' %} | ||
torch.manual_seed(seed) | ||
torch.cuda.manual_seed_all(seed) | ||
torch.backends.cudnn.deterministic = True | ||
torch.backends.cudnn.benchmark = False | ||
{%- endif %} | ||
{%- if cookiecutter.dl_framework in ['tensorflow_cpu', 'tensorflow_gpu'] %} | ||
tf.random.set_seed(seed) | ||
{%- endif %} |