Skip to content

Commit 143464d

Browse files
committed
Sync to latest.
2 parents 1f4747a + c3b2660 commit 143464d

File tree

25 files changed

+2631
-6
lines changed

25 files changed

+2631
-6
lines changed

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
/research/inception/ @shlens @vincentvanhoucke
1818
/research/learned_optimizer/ @olganw @nirum
1919
/research/learning_to_remember_rare_events/ @lukaszkaiser @ofirnachum
20+
/research/learning_unsupervised_learning/ @lukemetz @nirum
2021
/research/lexnet_nc/ @vered1986 @waterson
2122
/research/lfads/ @jazcollins @susillo
2223
/research/lm_1b/ @oriolvinyals @panyx0718

official/utils/testing/scripts/presubmit.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,14 @@ py_test() {
5353

5454
py2_test() {
5555
local PY_BINARY=$(which python2)
56-
return $(py_test "${PY_BINARY}")
56+
py_test "$PY_BINARY"
57+
return $?
5758
}
5859

5960
py3_test() {
6061
local PY_BINARY=$(which python3)
61-
return $(py_test "${PY_BINARY}")
62+
py_test "$PY_BINARY"
63+
return $?
6264
}
6365

6466
test_result=0

research/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ installation](https://www.tensorflow.org/install).
3636
- [inception](inception): deep convolutional networks for computer vision.
3737
- [learning_to_remember_rare_events](learning_to_remember_rare_events): a
3838
large-scale life-long memory module for use in deep learning.
39+
- [learning_unsupervised_learning](learning_unsupervised_learning): a
40+
meta-learned unsupervised learning update rule.
3941
- [lexnet_nc](lexnet_nc): a distributed model for noun compound relationship
4042
classification.
4143
- [lfads](lfads): sequential variational autoencoder for analyzing

research/compression/image_encoder/decoder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def main(_):
7171
return
7272

7373
contents = ''
74-
with tf.gfile.FastGFile(FLAGS.input_codes, 'r') as code_file:
74+
with tf.gfile.FastGFile(FLAGS.input_codes, 'rb') as code_file:
7575
contents = code_file.read()
7676
loaded_codes = np.load(io.BytesIO(contents))
7777
assert ['codes', 'shape'] not in loaded_codes.files

research/compression/image_encoder/encoder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def main(_):
5959
print('\n--iteration must be between 0 and 15 inclusive.\n')
6060
return
6161

62-
with tf.gfile.FastGFile(FLAGS.input_image) as input_image:
62+
with tf.gfile.FastGFile(FLAGS.input_image, 'rb') as input_image:
6363
input_image_str = input_image.read()
6464

6565
with tf.Graph().as_default() as graph:

research/compression/image_encoder/msssim.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,9 @@ def main(_):
199199
return
200200

201201
with tf.gfile.FastGFile(FLAGS.original_image) as image_file:
202-
img1_str = image_file.read()
202+
img1_str = image_file.read('rb')
203203
with tf.gfile.FastGFile(FLAGS.compared_image) as image_file:
204-
img2_str = image_file.read()
204+
img2_str = image_file.read('rb')
205205

206206
input_img = tf.placeholder(tf.string)
207207
decoded_image = tf.expand_dims(tf.image.decode_png(input_img, channels=3), 0)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.pyc
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Learning Unsupervised Learning Rules
2+
This repository contains code and weights for the learned update rule
3+
presented in "Learning Unsupervised Learning Rules." At this time, this
4+
code can not meta-train the update rule.
5+
6+
7+
### Structure
8+
`run_eval.py` contains the main training loop. This constructs an op
9+
that runs one iteration of the learned update rule and assigns the
10+
results to variables. Additionally, it loads the weights from our
11+
pre-trained model.
12+
13+
The base model and the update rule architecture definition can be found in
14+
`architectures/more_local_weight_update.py`. For a complete description
15+
of the model, see our [paper](https://arxiv.org/abs/1804.00222).
16+
17+
### Dependencies
18+
[absl]([https://github.com/abseil/abseil-py), [tensorflow](https://tensorflow.org), [sonnet](https://github.com/deepmind/sonnet)
19+
20+
### Usage
21+
22+
First, download the [pre-trained optimizer model weights](https://storage.googleapis.com/learning_unsupervised_learning/200_tf_graph.zip) and extract it.
23+
24+
```bash
25+
# move to the folder above this folder
26+
cd path_to/research/learning_unsupervised_learning/../
27+
28+
# launch the eval script
29+
python -m learning_unsupervised_learning.run_eval \
30+
--train_log_dir="/tmp/learning_unsupervised_learning" \
31+
--checkpoint_dir="/path/to/downloaded/model/tf_graph_data.ckpt"
32+
```
33+
34+
### Contact
35+
Luke Metz, Niru Maheswaranathan, Github: @lukemetz, @nirum. Email: {lmetz, nirum}@google.com
36+
37+

research/learning_unsupervised_learning/__init__.py

Whitespace-only changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2018 Google, Inc. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
# ==============================================================================
15+
16+
17+
import more_local_weight_update

0 commit comments

Comments
 (0)