Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 80178fc

Browse files
authored
Merge pull request tensorflow#4153 from terryykoo/master
Export @195097388.
2 parents a84e1ef + edea2b6 commit 80178fc

File tree

145 files changed

+9237
-2951
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+9237
-2951
lines changed

research/syntaxnet/Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:16.10
1+
FROM ubuntu:16.04
22

33
ENV SYNTAXNETDIR=/opt/tensorflow PATH=$PATH:/root/bin
44

@@ -57,10 +57,10 @@ RUN python -m pip install \
5757
&& rm -rf /root/.cache/pip /tmp/pip*
5858

5959
# Installs Bazel.
60-
RUN wget --quiet https://github.com/bazelbuild/bazel/releases/download/0.8.1/bazel-0.8.1-installer-linux-x86_64.sh \
61-
&& chmod +x bazel-0.8.1-installer-linux-x86_64.sh \
62-
&& ./bazel-0.8.1-installer-linux-x86_64.sh \
63-
&& rm ./bazel-0.8.1-installer-linux-x86_64.sh
60+
RUN wget --quiet https://github.com/bazelbuild/bazel/releases/download/0.11.1/bazel-0.11.1-installer-linux-x86_64.sh \
61+
&& chmod +x bazel-0.11.1-installer-linux-x86_64.sh \
62+
&& ./bazel-0.11.1-installer-linux-x86_64.sh \
63+
&& rm ./bazel-0.11.1-installer-linux-x86_64.sh
6464

6565
COPY WORKSPACE $SYNTAXNETDIR/syntaxnet/WORKSPACE
6666
COPY tools/bazel.rc $SYNTAXNETDIR/syntaxnet/tools/bazel.rc

research/syntaxnet/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ The simplest way to get started with DRAGNN is by loading our Docker container.
6060
[Here](g3doc/CLOUD.md) is a tutorial for running the DRAGNN container on
6161
[GCP](https://cloud.google.com) (just as applicable to your own computer).
6262

63-
### Ubuntu 16.10+ binary installation
63+
### Ubuntu 16.04+ binary installation
6464

6565
_This process takes ~5 minutes, but is only compatible with Linux using GNU libc
66-
3.4.22 and above (e.g. Ubuntu 16.10)._
66+
3.4.22 and above (e.g. Ubuntu 16.04)._
6767

6868
Binary wheel packages are provided for TensorFlow and SyntaxNet. If you do not
6969
need to write new binary TensorFlow ops, these should suffice.
@@ -92,9 +92,9 @@ source. You'll need to install:
9292

9393
* python 2.7:
9494
* Python 3 support is not available yet
95-
* bazel 0.5.4:
95+
* bazel 0.11.1:
9696
* Follow the instructions [here](http://bazel.build/docs/install.html)
97-
* Alternately, Download bazel 0.5.4 <.deb> from
97+
* Alternately, Download bazel 0.11.1 <.deb> from
9898
[https://github.com/bazelbuild/bazel/releases](https://github.com/bazelbuild/bazel/releases)
9999
for your system configuration.
100100
* Install it using the command: sudo dpkg -i <.deb file>
@@ -105,14 +105,14 @@ source. You'll need to install:
105105
* protocol buffers, with a version supported by TensorFlow:
106106
* check your protobuf version with `pip freeze | grep protobuf`
107107
* upgrade to a supported version with `pip install -U protobuf==3.3.0`
108+
* autograd, with a version supported by TensorFlow:
109+
* `pip install -U autograd==1.1.13`
108110
* mock, the testing package:
109111
* `pip install mock`
110112
* asciitree, to draw parse trees on the console for the demo:
111113
* `pip install asciitree`
112114
* numpy, package for scientific computing:
113115
* `pip install numpy`
114-
* autograd 1.1.13, for automatic differentiation (not yet compatible with autograd v1.2 rewrite):
115-
* `pip install autograd==1.1.13`
116116
* pygraphviz to visualize traces and parse trees:
117117
* `apt-get install -y graphviz libgraphviz-dev`
118118
* `pip install pygraphviz

research/syntaxnet/WORKSPACE

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
local_repository(
2-
name = "org_tensorflow",
3-
path = "tensorflow",
2+
name = "org_tensorflow",
3+
path = "tensorflow",
44
)
55

66
# We need to pull in @io_bazel_rules_closure for TensorFlow. Bazel design
@@ -9,22 +9,33 @@ local_repository(
99
# @io_bazel_rules_closure.
1010
http_archive(
1111
name = "io_bazel_rules_closure",
12-
sha256 = "25f5399f18d8bf9ce435f85c6bbf671ec4820bc4396b3022cc5dc4bc66303609",
13-
strip_prefix = "rules_closure-0.4.2",
12+
sha256 = "6691c58a2cd30a86776dd9bb34898b041e37136f2dc7e24cadaeaf599c95c657",
13+
strip_prefix = "rules_closure-08039ba8ca59f64248bb3b6ae016460fe9c9914f",
1414
urls = [
15-
"http://bazel-mirror.storage.googleapis.com/github.com/bazelbuild/rules_closure/archive/0.4.2.tar.gz", # 2017-08-30
16-
"https://github.com/bazelbuild/rules_closure/archive/0.4.2.tar.gz",
15+
"http://bazel-mirror.storage.googleapis.com/github.com/bazelbuild/rules_closure/archive/08039ba8ca59f64248bb3b6ae016460fe9c9914f.tar.gz",
16+
"https://github.com/bazelbuild/rules_closure/archive/08039ba8ca59f64248bb3b6ae016460fe9c9914f.tar.gz",
1717
],
1818
)
1919

2020
load("@org_tensorflow//tensorflow:workspace.bzl", "tf_workspace")
21-
tf_workspace(path_prefix="", tf_repo_name="org_tensorflow")
2221

23-
# Test that Bazel is up-to-date.
24-
load("@org_tensorflow//tensorflow:workspace.bzl", "check_version")
25-
check_version("0.4.2")
22+
tf_workspace(
23+
path_prefix = "",
24+
tf_repo_name = "org_tensorflow",
25+
)
26+
27+
http_archive(
28+
name = "sling",
29+
sha256 = "f1ce597476cb024808ca0a371a01db9dda4e0c58fb34a4f9c4ea91796f437b10",
30+
strip_prefix = "sling-e3ae9d94eb1d9ee037a851070d54ed2eefaa928a",
31+
urls = [
32+
"http://bazel-mirror.storage.googleapis.com/github.com/google/sling/archive/e3ae9d94eb1d9ee037a851070d54ed2eefaa928a.tar.gz",
33+
"https://github.com/google/sling/archive/e3ae9d94eb1d9ee037a851070d54ed2eefaa928a.tar.gz",
34+
],
35+
)
2636

37+
# Used by SLING.
2738
bind(
28-
name = "protobuf",
29-
actual = "@protobuf_archive//:protobuf",
39+
name = "zlib",
40+
actual = "@zlib_archive//:zlib",
3041
)

research/syntaxnet/docker-devel/Dockerfile-test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ COPY dragnn $SYNTAXNETDIR/syntaxnet/dragnn
99
COPY syntaxnet $SYNTAXNETDIR/syntaxnet/syntaxnet
1010
COPY third_party $SYNTAXNETDIR/syntaxnet/third_party
1111
COPY util/utf8 $SYNTAXNETDIR/syntaxnet/util/utf8
12+
COPY WORKSPACE $SYNTAXNETDIR/syntaxnet/WORKSPACE

research/syntaxnet/docker-devel/Dockerfile-test-base

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:16.10
1+
FROM ubuntu:16.04
22

33
ENV SYNTAXNETDIR=/opt/tensorflow PATH=$PATH:/root/bin
44

@@ -57,10 +57,10 @@ RUN python -m pip install \
5757
&& rm -rf /root/.cache/pip /tmp/pip*
5858

5959
# Installs Bazel.
60-
RUN wget --quiet https://github.com/bazelbuild/bazel/releases/download/0.5.3/bazel-0.5.3-installer-linux-x86_64.sh \
61-
&& chmod +x bazel-0.5.3-installer-linux-x86_64.sh \
62-
&& JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/ ./bazel-0.5.3-installer-linux-x86_64.sh \
63-
&& rm ./bazel-0.5.3-installer-linux-x86_64.sh
60+
RUN wget --quiet https://github.com/bazelbuild/bazel/releases/download/0.11.1/bazel-0.11.1-installer-linux-x86_64.sh \
61+
&& chmod +x bazel-0.11.1-installer-linux-x86_64.sh \
62+
&& JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/ ./bazel-0.11.1-installer-linux-x86_64.sh \
63+
&& rm ./bazel-0.11.1-installer-linux-x86_64.sh
6464

6565
COPY WORKSPACE $SYNTAXNETDIR/syntaxnet/WORKSPACE
6666
COPY tools/bazel.rc $SYNTAXNETDIR/syntaxnet/tools/bazel.rc
@@ -69,12 +69,9 @@ COPY tools/bazel.rc $SYNTAXNETDIR/syntaxnet/tools/bazel.rc
6969
# source. This makes it more convenient to re-compile DRAGNN / SyntaxNet for
7070
# development (though not as convenient as the docker-devel scripts).
7171
RUN cd $SYNTAXNETDIR/syntaxnet \
72-
&& git clone --branch r1.3 --recurse-submodules https://github.com/tensorflow/tensorflow \
72+
&& git clone --branch r1.8 --recurse-submodules https://github.com/tensorflow/tensorflow \
7373
&& cd tensorflow \
74-
# This line removes a bad archive target which causes Tensorflow install
75-
# to fail.
76-
&& sed -i '\@https://github.com/google/protobuf/archive/0b059a3d8a8f8aa40dde7bea55edca4ec5dfea66.tar.gz@d' tensorflow/workspace.bzl \
77-
&& tensorflow/tools/ci_build/builds/configured CPU \\
74+
&& tensorflow/tools/ci_build/builds/configured CPU \
7875
&& cd $SYNTAXNETDIR/syntaxnet \
7976
&& bazel build -c opt @org_tensorflow//tensorflow:tensorflow_py
8077

research/syntaxnet/docker-devel/Dockerfile.min

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# It might be more efficient to use a minimal distribution, like Alpine. But
55
# the upside of this being popular is that people might already have it.
6-
FROM ubuntu:16.10
6+
FROM ubuntu:16.04
77

88
ENV SYNTAXNETDIR=/opt/tensorflow PATH=$PATH:/root/bin
99

research/syntaxnet/dragnn/components/stateless/BUILD

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ cc_library(
1010
"//dragnn/core:component_registry",
1111
"//dragnn/core/interfaces:component",
1212
"//dragnn/core/interfaces:transition_state",
13-
"//dragnn/protos:data_proto",
13+
"//dragnn/core/util:label",
14+
"//dragnn/protos:data_proto_cc",
1415
"//syntaxnet:base",
1516
],
1617
alwayslink = 1,
@@ -27,7 +28,7 @@ cc_test(
2728
"//dragnn/core/test:mock_transition_state",
2829
"//dragnn/io:sentence_input_batch",
2930
"//syntaxnet:base",
30-
"//syntaxnet:sentence_proto",
31+
"//syntaxnet:sentence_proto_cc",
3132
"//syntaxnet:test_main",
3233
],
3334
)

research/syntaxnet/dragnn/components/stateless/stateless_component.cc

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "dragnn/core/component_registry.h"
1717
#include "dragnn/core/interfaces/component.h"
1818
#include "dragnn/core/interfaces/transition_state.h"
19+
#include "dragnn/core/util/label.h"
1920
#include "dragnn/protos/data.pb.h"
2021
#include "syntaxnet/base.h"
2122

@@ -90,7 +91,8 @@ class StatelessComponent : public Component {
9091
void AdvanceFromOracle() override {
9192
LOG(FATAL) << "[" << name_ << "] AdvanceFromOracle not supported";
9293
}
93-
std::vector<std::vector<int>> GetOracleLabels() const override {
94+
std::vector<std::vector<std::vector<Label>>> GetOracleLabels()
95+
const override {
9496
LOG(FATAL) << "[" << name_ << "] Method not supported";
9597
}
9698
int GetFixedFeatures(std::function<int32 *(int)> allocate_indices,
@@ -108,7 +110,15 @@ class StatelessComponent : public Component {
108110
float *embedding_output) override {
109111
LOG(FATAL) << "[" << name_ << "] Method not supported";
110112
}
111-
113+
void BulkEmbedDenseFixedFeatures(
114+
const vector<const float *> &per_channel_embeddings,
115+
float *embedding_output, int embedding_output_size,
116+
int32 *offset_array_output, int offset_array_size) override {
117+
LOG(FATAL) << "[" << name_ << "] Method not supported";
118+
}
119+
int BulkDenseFeatureSize() const override {
120+
LOG(FATAL) << "Method not supported";
121+
}
112122
std::vector<LinkFeatures> GetRawLinkFeatures(int channel_id) const override {
113123
LOG(FATAL) << "[" << name_ << "] Method not supported";
114124
}
@@ -118,9 +128,9 @@ class StatelessComponent : public Component {
118128
}
119129

120130
private:
121-
string name_; // component name
131+
string name_; // component name
122132
int batch_size_ = 1; // number of sentences in current batch
123-
int beam_size_ = 1; // maximum beam size
133+
int beam_size_ = 1; // maximum beam size
124134

125135
// Parent states passed to InitializeData(), and passed along in GetBeam().
126136
std::vector<std::vector<const TransitionState *>> parent_states_;

research/syntaxnet/dragnn/components/syntaxnet/BUILD

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,20 @@ cc_library(
1616
"//dragnn/core:input_batch_cache",
1717
"//dragnn/core/interfaces:component",
1818
"//dragnn/core/interfaces:transition_state",
19+
"//dragnn/core/util:label",
1920
"//dragnn/io:sentence_input_batch",
2021
"//dragnn/io:syntaxnet_sentence",
21-
"//dragnn/protos:data_proto",
22-
"//dragnn/protos:spec_proto",
23-
"//dragnn/protos:trace_proto",
22+
"//dragnn/protos:data_proto_cc",
23+
"//dragnn/protos:spec_proto_cc",
24+
"//dragnn/protos:trace_proto_cc",
2425
"//syntaxnet:base",
2526
"//syntaxnet:parser_transitions",
2627
"//syntaxnet:registry",
27-
"//syntaxnet:sparse_proto",
28+
"//syntaxnet:sparse_proto_cc",
2829
"//syntaxnet:task_context",
29-
"//syntaxnet:task_spec_proto",
30+
"//syntaxnet:task_spec_proto_cc",
3031
"//syntaxnet:utils",
32+
"//util/utf8:unicodetext",
3133
],
3234
alwayslink = 1,
3335
)
@@ -37,7 +39,7 @@ cc_library(
3739
srcs = ["syntaxnet_link_feature_extractor.cc"],
3840
hdrs = ["syntaxnet_link_feature_extractor.h"],
3941
deps = [
40-
"//dragnn/protos:spec_proto",
42+
"//dragnn/protos:spec_proto_cc",
4143
"//syntaxnet:base",
4244
"//syntaxnet:embedding_feature_extractor",
4345
"//syntaxnet:parser_transitions",
@@ -53,7 +55,7 @@ cc_library(
5355
"//dragnn/core/interfaces:cloneable_transition_state",
5456
"//dragnn/core/interfaces:transition_state",
5557
"//dragnn/io:syntaxnet_sentence",
56-
"//dragnn/protos:trace_proto",
58+
"//dragnn/protos:trace_proto_cc",
5759
"//syntaxnet:base",
5860
"//syntaxnet:parser_transitions",
5961
],
@@ -77,7 +79,7 @@ cc_test(
7779
"//dragnn/core/test:mock_transition_state",
7880
"//dragnn/io:sentence_input_batch",
7981
"//syntaxnet:base",
80-
"//syntaxnet:sentence_proto",
82+
"//syntaxnet:sentence_proto_cc",
8183
"//syntaxnet:test_main",
8284
],
8385
)
@@ -88,7 +90,7 @@ cc_test(
8890
deps = [
8991
":syntaxnet_link_feature_extractor",
9092
"//dragnn/core/test:generic",
91-
"//dragnn/protos:spec_proto",
93+
"//dragnn/protos:spec_proto_cc",
9294
"//syntaxnet:task_context",
9395
"//syntaxnet:test_main",
9496
],
@@ -105,9 +107,9 @@ cc_test(
105107
"//dragnn/core/test:generic",
106108
"//dragnn/core/test:mock_transition_state",
107109
"//dragnn/io:sentence_input_batch",
108-
"//dragnn/protos:spec_proto",
110+
"//dragnn/protos:spec_proto_cc",
109111
"//syntaxnet:base",
110-
"//syntaxnet:sentence_proto",
112+
"//syntaxnet:sentence_proto_cc",
111113
"//syntaxnet:test_main",
112114
],
113115
)

0 commit comments

Comments
 (0)