Skip to content

Commit

Permalink
Preparing Tensorflow branch for upstream merge
Browse files Browse the repository at this point in the history
  • Loading branch information
ethantang95 committed Jul 11, 2017
1 parent 6152d96 commit 45a51d9
Show file tree
Hide file tree
Showing 73 changed files with 1,216 additions and 466 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,16 @@ TAGS
/build/
/dist/
*.egg-info/

#Intellij files
.idea/

#vscode
.vscode/

#.project
.project
/.project

#.tb
.tb/
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ env:
- OPENBLAS_ROOT=~/openblas
- CAFFE_ROOT=~/caffe
- TORCH_ROOT=~/torch
- OMP_NUM_THREADS=1
- OPENBLAS_MAIN_FREE=1
- secure: "WSqrE+PQm76DdoRLRGKTK6fRWfXZjIb0BWCZm3IgHgFO7OE6fcK2tBnpDNNw4XQjmo27FFWlEhxN32g18P84n5PvErHaH65IuS9Nv6FkLlPXZlVqGNxbPmEA4oTkD/6Y6kZyZWZtLh2+/1ijuzQAPnIy/4BEuL8pdO+PsoJ9hYM="
matrix:
- DIGITS_TEST_FRAMEWORK=caffe CAFFE_FORK=NVIDIA
Expand Down Expand Up @@ -73,7 +75,6 @@ matrix:
cache:
apt: true
directories:
- $OPENBLAS_ROOT
- $CAFFE_ROOT
- $TORCH_ROOT

Expand All @@ -95,6 +96,7 @@ addons:
- libhdf5-serial-dev
- libleveldb-dev
- liblmdb-dev
- libopenblas-dev
- libopencv-dev
- libprotobuf-dev
- libsnappy-dev
Expand Down Expand Up @@ -128,15 +130,13 @@ before_install:
install:
- mkdir -p ~/.config/matplotlib
- echo "backend:agg" > ~/.config/matplotlib/matplotlibrc
- ./scripts/travis/install-openblas.sh $OPENBLAS_ROOT
- ./scripts/travis/install-caffe.sh $CAFFE_ROOT
- if [ "$DIGITS_TEST_FRAMEWORK" == "torch" ]; then travis_wait ./scripts/travis/install-torch.sh $TORCH_ROOT; else unset TORCH_ROOT; fi
- pip install -r ./requirements.txt --force-reinstall
- if [ "$DIGITS_TEST_FRAMEWORK" == "tensorflow" ]; then travis_wait ./scripts/travis/install-tensorflow.sh; fi
- pip install -r ./requirements.txt
- pip install -r ./requirements_test.txt
- pip install -e .
- if [ "$WITH_PLUGINS" != "false" ]; then find ./plugins/*/* -maxdepth 0 -type d | xargs -n1 pip install -e; fi

script:
- ./digits-test -v

4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

DIGITS (the **D**eep Learning **G**PU **T**raining **S**ystem) is a webapp for training deep learning models.

The currently supported frameworks are: Caffe 1, Torch, and Tensorflow

# Installation

| Installation method | Supported platform[s] | Available versions | Instructions |
Expand All @@ -18,6 +20,7 @@ Once you have installed DIGITS, visit [docs/GettingStarted.md](docs/GettingStart

Then, take a look at some of the other documentation at [docs/](docs/) and [examples/](examples/):

* [Getting started with TensorFlow](docs/GettingStartedTensorflow.md)
* [Getting started with Torch](docs/GettingStartedTorch.md)
* [Fine-tune a pretrained model](examples/fine-tuning/README.md)
* [Train an autoencoder network](examples/autoencoder/README.md)
Expand All @@ -44,4 +47,3 @@ Then, take a look at some of the other documentation at [docs/](docs/) and [exam
* Please let us know by [filing a new issue](https://github.com/NVIDIA/DIGITS/issues/new)
* Bonus points if you want to contribute by opening a [pull request](https://help.github.com/articles/using-pull-requests/)!
* You will need to send a signed copy of the [Contributor License Agreement](CLA) to [email protected] before your change can be accepted.

4 changes: 2 additions & 2 deletions digits-lint
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ set -e

echo "=== Checking for Python lint ..."
if which flake8 >/dev/null 2>&1; then
python2 `which flake8` .
python2 `which flake8` --exclude ./examples,./digits/standard-networks/tensorflow,./digits/jobs .
else
python2 -m flake8 .
python2 -m flake8 --exclude ./examples,./digits/standard-networks/tensorflow,./digits/jobs .
fi

echo "=== Checking for JavaScript lint ..."
Expand Down
2 changes: 1 addition & 1 deletion digits/config/tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_tf_import(python_exe):

if not tf_enabled:
print('Tensorflow support disabled.')
# print('Failed importing Tensorflow with python executable "%s"\n%s' % (tf_python_exe, err))
# print('Failed importing Tensorflow with python executable "%s"\n%s' % (tf_python_exe, err))

if tf_enabled:
option_list['tensorflow'] = {
Expand Down
7 changes: 7 additions & 0 deletions digits/extensions/view/rawData/header_template.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. #}

{% from "helper.html" import print_flashes %}
{% from "helper.html" import print_errors %}
{% from "helper.html" import mark_errors %}

{{data}}
8 changes: 4 additions & 4 deletions digits/model/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,10 @@ def validate_lr_multistep_values(form, field):

def validate_custom_network_snapshot(form, field):
pass
#if form.method.data == 'custom':
# for filename in field.data.strip().split(os.path.pathsep):
# if filename and not os.path.exists(filename):
# raise validators.ValidationError('File "%s" does not exist' % filename)
# if form.method.data == 'custom':
# for filename in field.data.strip().split(os.path.pathsep):
# if filename and not os.path.exists(filename):
# raise validators.ValidationError('File "%s" does not exist' % filename)

# Select one of several GPUs
select_gpu = wtforms.RadioField(
Expand Down
15 changes: 15 additions & 0 deletions digits/model/images/classification/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ class BaseViewsTestWithDataset(BaseViewsTest,
AUG_HSV_H = None
AUG_HSV_S = None
AUG_HSV_V = None
OPTIMIZER = None

@classmethod
def setUpClass(cls):
Expand Down Expand Up @@ -242,6 +243,8 @@ def create_model(cls, network=None, **kwargs):
data['aug_hsv_s'] = cls.AUG_HSV_S
if cls.AUG_HSV_V is not None:
data['aug_hsv_v'] = cls.AUG_HSV_V
if cls.OPTIMIZER is not None:
data['solver_type'] = cls.OPTIMIZER

data.update(kwargs)

Expand Down Expand Up @@ -1158,6 +1161,10 @@ class TestCaffeLeNet(BaseTestCreated, test_utils.CaffeMixin):
).read()


class TestCaffeLeNetADAMOptimizer(TestCaffeLeNet):
OPTIMIZER = 'ADAM'


class TestTorchCreatedCropInForm(BaseTestCreatedCropInForm, test_utils.TorchMixin):
pass

Expand Down Expand Up @@ -1196,6 +1203,10 @@ def test_inference_while_training(self):
raise unittest.SkipTest('Torch CPU inference on CuDNN-trained model not supported')


class TestTorchLeNetADAMOptimizer(TestTorchLeNet):
OPTIMIZER = 'ADAM'


class TestTorchLeNetHdf5Shuffle(TestTorchLeNet):
BACKEND = 'hdf5'
SHUFFLE = True
Expand Down Expand Up @@ -1366,6 +1377,10 @@ class TestTensorflowLeNet(BaseTestCreated, test_utils.TensorflowMixin):
'lenet.py')).read()


class TestTensorflowLeNetADAMOptimizer(TestTensorflowLeNet):
OPTIMIZER = 'ADAM'


class TestTensorflowLeNetSlim(BaseTestCreated, test_utils.TensorflowMixin):
IMAGE_WIDTH = 28
IMAGE_HEIGHT = 28
Expand Down
10 changes: 5 additions & 5 deletions digits/model/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,13 +295,13 @@ def download(job_id, extension):
mode = 'gz'
elif extension in ['tar.bz2']:
mode = 'bz2'
with tarfile.open(fileobj=b, mode='w:%s' % mode) as tf:
with tarfile.open(fileobj=b, mode='w:%s' % mode) as tar:
for path, name in job.download_files(epoch):
tf.add(path, arcname=name)
tf_info = tarfile.TarInfo("info.json")
tf_info.size = len(info_io.getvalue())
tar.add(path, arcname=name)
tar_info = tarfile.TarInfo("info.json")
tar_info.size = len(info_io.getvalue())
info_io.seek(0)
tf.addfile(tf_info, info_io)
tar.addfile(tar_info, info_io)
elif extension in ['zip']:
with zipfile.ZipFile(b, 'w') as zf:
for path, name in job.download_files(epoch):
Expand Down
7 changes: 4 additions & 3 deletions digits/standard-networks/tensorflow/alexnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ def conv_net(x, weights, biases):

@model_property
def loss(self):
loss = digits.classification_loss(self.inference, self.y)
accuracy = digits.classification_accuracy(self.inference, self.y)
self.summaries.append(tf.scalar_summary(accuracy.op.name, accuracy))
model = self.inference
loss = digits.classification_loss(model, self.y)
accuracy = digits.classification_accuracy(model, self.y)
self.summaries.append(tf.summary.scalar(accuracy.op.name, accuracy))
return loss
7 changes: 4 additions & 3 deletions digits/standard-networks/tensorflow/alexnet_slim.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ def inference(self):

@model_property
def loss(self):
loss = digits.classification_loss(self.inference, self.y)
accuracy = digits.classification_accuracy(self.inference, self.y)
self.summaries.append(tf.scalar_summary(accuracy.op.name, accuracy))
model = self.inference
loss = digits.classification_loss(model, self.y)
accuracy = digits.classification_accuracy(model, self.y)
self.summaries.append(tf.summary.scalar(accuracy.op.name, accuracy))
return loss
23 changes: 0 additions & 23 deletions digits/standard-networks/tensorflow/binary_segmentation.py

This file was deleted.

Loading

0 comments on commit 45a51d9

Please sign in to comment.