1

I'm trying to learn Synatxnet. I have it running through Docker. But I really dont know much about either program Synatxnet or Docker. On the Github Sytaxnet page it says

The SyntaxNet models are configured via a combination of run-time flags (which are easy to change) and a text format TaskSpec protocol buffer. The spec file used in the demo is in syntaxnet/models/parsey_mcparseface/context.pbtxt.

How exactly do I find the spec file to edit it?

I compiled SyntaxNet in a Docker container using these Instructions.

FROM java:8

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

RUN mkdir -p $SYNTAXNETDIR \
    && cd $SYNTAXNETDIR \
    && apt-get update \
    && apt-get install git zlib1g-dev file swig python2.7 python-dev python-pip -y \
    && pip install --upgrade pip \
    && pip install -U protobuf==3.0.0b2 \
    && pip install asciitree \
    && pip install numpy \
    && wget https://github.com/bazelbuild/bazel/releases/download/0.2.2b/bazel-0.2.2b-installer-linux-x86_64.sh \
    && chmod +x bazel-0.2.2b-installer-linux-x86_64.sh \
    && ./bazel-0.2.2b-installer-linux-x86_64.sh --user \
    && git clone --recursive https://github.com/tensorflow/models.git \
    && cd $SYNTAXNETDIR/models/syntaxnet/tensorflow \
    && echo "\n\n\n" | ./configure \
    && apt-get autoremove -y \
    && apt-get clean

RUN cd $SYNTAXNETDIR/models/syntaxnet \
    && bazel test --genrule_strategy=standalone syntaxnet/... util/utf8/...

WORKDIR $SYNTAXNETDIR/models/syntaxnet

CMD [ "sh", "-c", "echo 'Bob brought the pizza to Alice.' | syntaxnet/demo.sh" ]

# COMMANDS to build and run
# ===============================
# mkdir build && cp Dockerfile build/ && cd build
# docker build -t syntaxnet .
# docker run syntaxnet
20GT
  • 11
  • 3
  • You can do anything you want, more or less, through docker, but you have to know how to do it. Unfortunately your question is so vague that it's hard to offer any more help than this. If you showed us your dockerfile then maybe we could tell you how to proceed, but as it stands this question is unanswerable and so I've voted to close it. I'll remove my vote if you update the question appropriately. – Software Engineer Sep 23 '16 at 17:11
  • Sorry about that, I've done as you have asked. Hopefully that explains it better. – 20GT Sep 24 '16 at 00:43
  • I've just tried building that dockerfile and it fails with an error on the command, after taking a lifetime to build – Software Engineer Sep 26 '16 at 09:35
  • I rememberd the place where i actually got the instructions to the dockerfile. I edited the original post to show this. http://www.whycouch.com/2016/07/how-to-install-and-use-syntaxnet-and.html following thses instructions it should install correctly – 20GT Sep 30 '16 at 11:53

1 Answers1

0

First, comment out the command line in the dockerfile, then create and cd into an empty directory on your host machine. You can then create a container from the image, mounting a directory in the container to your hard-drive:

docker run -it --rm -v /pwd:/tmp bash

You'll now have a bash session in the container. Copy the spec file into /tmp from /opt/tensorflow/syntaxnet/models/parsey_mcparseface/context.pbtxt (I'm guessing that's where it is given the info you've provided above -- I can't get your dockerfile to build an image so I can't confirm it; you can always run find . -name context.pbtxt from root to find it), and exit the container (ctrl-d or exit).

You now have the file on your host's hd ready to edit, but you really want it in a running container. If the directory it comes from contains only that file, then you can simply mount your host directory at that path in the container. If it contains other things, then you can use a, so called, bootstrap script to move the file from your mounted directory (in the example above, that's tmp) to its home location. Alternatively, you may be able to tell the software where to find the spec file with a flag, but that will take more research.

Software Engineer
  • 15,457
  • 7
  • 74
  • 102