Closed korkinof closed 8 years ago
Hi Dimitrios,
We don't currently suggest a single official way to run SyntaxNet from Python. One simple approach is to spawn SyntaxNet as a subprocess, as done here. But you could wrap it in a Python module, or even call the TensorFlow graph from C++, without any Python.
Cheers, Daniel
Hi andorado, Can you please provide some details about how to call the TensorFlow graph from C++, i read the tensorflow tutorials about it, but couldn't figure out how this could be applied to syntaxnet.
the currently recommended way to use syntaxnet from python is via DRAGNN
Hi micimize,
I got the docker image started as described in the link, and then able to run the demo.sh. However, still cannot figure out how can I run the model from vanila python. Are there any resources that can help?
--Srinath
@srinathperera I've only gotten it working via bazel and docker with the following BUILD
:
py_binary(
name = "app",
main = "src/__main__.py",
srcs = ["src/__main__.py"],
deps = [":deps"],
)
py_library(
name = "deps",
deps = [
"//dragnn/core:dragnn_bulk_ops",
"//dragnn/core:dragnn_ops",
"//dragnn/protos:spec_py_pb2",
"//dragnn/python:graph_builder",
"//dragnn/python:lexicon",
"//dragnn/python:load_dragnn_cc_impl_py",
"//dragnn/python:spec_builder",
"//dragnn/python:visualization",
"//syntaxnet:load_parser_ops_py",
"//syntaxnet:parser_ops",
"//syntaxnet:sentence_py_pb2",
"@org_tensorflow//tensorflow:tensorflow_py",
"@org_tensorflow//tensorflow/core:protos_all_py",
],
)
and Dockerfile
:
FROM tensorflow/syntaxnet
ENV SYNTAXNETDIR=/opt/tensorflow
ENV WORKDIR=$SYNTAXNETDIR/syntaxnet/journal
RUN mkdir -p $WORKDIR/src
WORKDIR $WORKDIR
COPY src ./src
COPY data ./data
COPY requirements.txt ./
COPY BUILD ./
RUN apt-get install -y coreutils
RUN python -m pip install -r requirements.txt
CMD /bin/bash -c "bazel run app"
Hi guys, I've built syntaxnet and was able to run the demo. How do I import the package from python? I think I can see python wrappers in the build, but cannot seem to be able to import the whole thing. Can anyone help? Thanks in advance! Best, D.