-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Serve a different language model? #7
Comments
i think you can export parsey_mcparseface model using above commands. it might be needed to modify context.pbtxt. |
I actually tried this by running all these commands up to the last one. Then I extracted the German.zip model in the root directory (so a German directory was created in parallel to English) Then from ./serving I ran:
This produced the following error:
Since I do not really understand how the models and the way how tensorflow serving runs them between languages I gave up assuming I was doing something stupid :) So in the case of German, the context.pbtxt file does not even exist in the model directory.
I also had already tried just brutally replacing the files in serving/syntaxnet/models/parsey_mcparseface/ with the files from the German model but that failed with the same error about the missing context.pbtxt file. When I just copied over the missing files from the English model I got some error about a dimensionality mismatch. TBH, I really do not understand much of this, I was just hoping that once I have installed SyntaxNet and get it to run with tensorflow serving, which I could do thanks to your instructions, I could easily get it to work with all other languages by just replacing the model files, but apparently that does not work. |
i investigated that problems. ...
$ git clone https://github.com/dsindex/syntaxnet.git work
$ cd work
$ git clone --recurse-submodules https://github.com/tensorflow/serving
# checkout proper version of tf_models
$ cd serving/tf_models
$ git checkout a4b7bb9a5dd2c021edcd3d68d326255c734d0ef0
... one solution might be patching another solution is .... what about training the German model directly by using the Universal Treebank Corpus? https://github.com/dsindex/syntaxnet#training-tagger-and-parser-with-another-corpus in this case, you have to checkout the version 'a4b7bb9a5dd2c021edcd3d68d326255c734d0ef0' git clone --recursive https://github.com/tensorflow/models.git
cd models
git checkout a4b7bb9a5dd2c021edcd3d68d326255c734d0ef0
cd models/syntaxnet/tensorflow
./configure
cd ..
bazel test syntaxnet/... util/utf8/... |
Thank you very much for looking into this! |
yes, i refered that patch(pr250-patch-a4b7bb9a.diff.txt). https://github.com/dsindex/syntaxnet#parseys-cousins |
Hello, I have the same problem. I'm trying to setup Spanish model to work with the Serving. I patched as described, with pr250-patch-a4b7bb9a.diff.txt, downloaded Spanish model. For the rest I followed
I get the same error as described below:
Can you please point out what I have missed? |
@znavoyan |
Hi; I've been trying to reproduce the steps mentioned above by johann-petrak, it is, trying to export a pre-trained model (Spanish-AnCora particularly) without success, getting the same error mentioned above. I used "context.pbtxt.template" to generate a context.pbtxt file pointing to the model files without success because "tag-to-category" file was missing. After this I downloaded the Treebanks Spanish-AnCora corpus and trained the model (using the script found at https://github.com/dsindex/syntaxnet.git) getting the needed files to export it, however this time I'm missing the file "tagger-params". Actually the above mentioned script yields a directory called "tagger-params" with a file "model.meta" inside of it, I tried to use this file as "tagger-params" unsuccessfully, the error I'm getting is the following:
So I'm stuck at this point and any help will be really appreciated. Thanks in advance. Szz. |
i guess ... you need to modify 'train.sh' to use |
I copied the required files manually, now I've my "tagger-params", "tagger-params.meta", "parser-params" and "parser-params.meta" files in the model directory, however when I try to export the model I get:
tensorflow.python.framework.errors.InvalidArgumentError: Assign requires shapes of both tensors to match. lhs shape= [6045,16] rhs shape= [5,4]
I will try to retrain the model now, however if you know the cause of the error please make me know. I will update the post if I come to any success. Thanks in advance. Szz. |
i thought you followed this instructions(https://github.com/dsindex/syntaxnet/blob/master/README_api.md) then, this issue may help you. exporting a syntaxnet model is very tricky and you should use the designated version of syntaxnet.
as you see, these steps are horrible ;; so, i recommend you to use DRAGNN. |
Hey @dsindex! Thanks for the quick reply, I followed the instructions you mention above (checked out proper versions for everything and applied the mentioned patch too) with no success as you can see ... I took a look at the issue you point too, however I'm not sure it is valid for my case. I'm now retraining the model, I will try to export it again after the process finishes. If this doesn't work I will try to rebuild syntaxnet and train the model directly as you point here ... Thanks for the DRAGNN suggestion too, however I will try to insist a little bit more with this, it fit more my needs. I will update the post if I get something! Thanks again! Szz. |
Hello @dsindex I am trying to reproduce the step mentioned on "https://github.com/dsindex/syntaxnet/blob/master/README_api.md" , trying to export my pre-trained English model but i am getting below error on running the step: error is: So I'm stuck at this point and any help will be really appreciated. Thanks in advance. |
the error you encountered looks very similar to the issue ( #17 ). did you install the bazel version 0.2.2b ? |
Hi @dsindex . Sorry to bother you again.
I know that one solution is to export the syntaxnet model and run it using tf_serving, which as you said is tricky and horrible. So, you recommended dragnn and in your repository, there is a dragnn.sh. Can it work like wait for user's input and output the result, and then wait for response withouth reinitializing the graph? I know I should try it before asking questions, but the build process really takes a lot of time. It will be a lot of help if you can point out the direction for me. |
yes! model = load_model() i guess this style is what you want. in ‘web api using tornado’ section in README, i described how to build an tornado api. |
@dsindex Yes, that is exactly what I want to achieve, and thanks for the remind. |
hi @dsindex .I was reading your code. It seems that you used dragnn and trained your own model based on the thoery behind syntaxnet. so, there is no context.pbtxt now, and the model is easy to be exported and deploy. |
um... |
Hi @dsindex |
well~ and for morpher, did you mean segmentator? i didn’t find a segmentator using dragnn system. for korean language, it is hard to accomplish morphological analyzer by using syntaxnet. so, i used a corpus which already has morphological analyzed results. |
@dsindex You may notice that in parse_universal/parse.sh, there are three different arg_prefix: brain_morphre/brain_tagger/brain_parser. The morpher gives something like this |
I followed the instructions from here:
https://github.com/dsindex/syntaxnet/blob/master/README_api.md
This allowed me to run the server and use it using a client based on the parsey_api.proto and sentence.proto files (I implemented my own Java client for this).
What I do not understand is how to best switch the model to one of "Parsey's cousins" ? Eg if I download the German model http://download.tensorflow.org/models/parsey_universal/German.zip, how can I use that model instead of the English one? Can I use the same client with that model?
The text was updated successfully, but these errors were encountered: