-
Notifications
You must be signed in to change notification settings - Fork 74k
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
Issues related to integrating syntaxnet/parsey mcparseface in Java + tf.reduce_sum #12328
Comments
I can't speak to the Java API issues—@ashankar would know the answers here—but the |
Thx a lot. tf.reduce_join() worked :) It seems like I still get junk chars in my output from my Java tensor even though i use the tensor.bytesValue() method to retrieve my scalar string. The important characters seems to be ok.. My output looks like this: |
Can you provide a hex dump of the content including the garbage characters (their true values are getting obfuscated above - looks like they just got replaced with U+FFFD)? |
Sure: 0A032D3A30120F49206C6F766520677261706573202E1A1B0A01491000180020012A03505250320450524F4E3A056E7375626A1A1B0A046C6F7665100118042A035642503204564552423A04524F4F541A1F0A066772617065731006180B20012A034E4E5332044E4F554E3A04646F626A1A160A012E100D180D20012A012E32012E3A0570756E63740A032D3A311216446F20796F75206576656E206C6966742062726F203F1A1A0A02446F1000180120032A035642503204564552423A036175781A1D0A03796F751002180420032A03505250320450524F4E3A056E7375626A1A1D0A046576656E1006180920032A02524232034144563A066164766D6F641A1A0A046C696674100B180E2A0256423204564552423A04524F4F541A1C0A0362726F1010181220032A034E4E5032044E4F554E3A04646F626A1A160A013F1014181420032A012E32012E3A0570756E6374 Thx for taking a look at it 👍 |
@marhlder let's put the thanks in the fridge until i actually do something of merit :- ) there are robust unit tests for Tensor.java, which pass on your syntaxnet-ops-hack repo (which i had a little time tonight to fork/clone/build/poke around) so i don't think what you're seeing is due to something deficient at the JNI implementation boundary. I couldn't find your Java code running the parser model; in lieu of me implementing something like parser_eval.py in Java to debug the situation, might you check that code into your repo so that i could use it as a base to debug from? |
Hehe thx again ;) I have pushed my java code :) My javac command line string looks like this: And running it looks like this: I have included my compiled jni.so and .jar files which originates from my https://github.com/marhlder/syntaxnet-ops-hack repo :) (But you probly wanna compile them your self) The SavedModelBundle is also included :) The code used to build the model is a merge between https://github.com/dmansfield/models/tree/documents-from-tensor Using a modified parsey_mcparseface.py source file from https://github.com/dmansfield/models/tree/documents-from-tensor |
I just tried running my program with a larger input and that makes it crash with the following message: *** Error in `java': malloc(): memory corruption: 0x00007f3db800f0a0 *** |
Might there be a memory management issue in the JNI code? I'm not much into JNI but other snippets seems to parse the byte array to a method before they release it (i.e. giving the java program a chance to make a copy or something) Hmm i guess release means something else in this context.. I just printed the string in the JNI code and it seems like there is problems already before the JNI code gets its hands on it. I inserted a tf.Print op at the end of my graph in python before i export it to a SavedModelBundle and got the following output (I'm still running the model through Java): [\n\003-:0\022$I love grapes.Do you even lift bro ?\032\033\n\001I\020\000\030\000 \001*\003PRP2\004PRON:\005nsubj\032\033\n\004love\020\001\030\004*\003VBP2\004VERB:\004ROOT\032!\n\tgrapes.Do\020\006\030\016 \001*\002NN2\004NOUN:\004dobj\032\035\n\003you\020\020\030\022 \005*\003PRP2\004PRON:\005nsubj\032\035\n\004even\020\024\030\027 \005*\002RB2\003ADV:\006advmod\032\035\n\004lift\020\031\030\034 \002*\002VB2\004VERB:\005ccomp\032\034\n\003bro\020\036\030 \005*\003NNP2\004NOUN:\004dobj\032\026\n\001?\020"\030" \001*\001.2\001.:\005punct] |
I'm just cleaning up the code i use to export the model. Will post it soon :) |
Ok - no rush; i'm just starting to spin up for the day now and will probably have a busy morning. The tf.Print output in Python seems to jive with the hex dump you provided above as far as the 'junk' characters - though the placement of the whole of the second sentence is different. |
The given output through tf.Print is the saved model running through the Java API. (I've edited my previous post to clarify). There still does not seem to be any issues when i run the model purely through Python. (That is run my modified parsey_mcparseface.py from https://github.com/dmansfield/models/tree/documents-from-tensor) I think the difference between the two outputs i've posted (hex and tf.Print) is my own fault :) The code I use to create and export my model to a SavedModelBundle can now be found here: https://github.com/marhlder/parsey_mcparseface_export I run the script ./syntaxnet/export_model.sh from models/syntaxnet/ |
Hmmm... i couldn't find (and could find no ((and i cannot find a i feel like i've totally misread what you've written after so many strikeouts. ? |
Sorry my bad :) Seems i did not push to the newly created remote. Its on a branch called documents-from-tensor. parsey_mcparseface.py is in syntaxnet/syntaxnet on https://github.com/marhlder/parsey_mcparseface_export/tree/documents-from-tensor/syntaxnet/syntaxnet. The java files are in https://github.com/marhlder/syntaxnet-ops-hack/tree/syntaxnet-ops-hack I think my issues might be related to how parsey_mcparseface.py is calling gen_parser_ops.document_sink() in the case where i'm not exporting the model. Will investigate |
Now we're cooking with grease... was able to fork/clone/build locally and get the junk characters you see. Will start anatomizing. |
Ok, i got it working by making a new custom op instead of the syntaxnet DocumentSink op i've added my own DocumentStringSink op which makes it possible to output a string tensor instead of a file. Will push my code soon. Lets close this issue and continue on the linked repositories :) |
Very glad you got a working solution - i don't see a problem with how you expected your original implementation to work though, so i'd still like to determine why it didn't work as written, if you don't mind. I'll look for the code pushes; i noticed when i tried to build the target |
I have not tried to build the pip package for some time as it is not necessary for my objective of getting it to run through Java. I will have a look at it 👍 I think the extra "junk" bytes are something used internally in the syntaxnet code and that the code from https://github.com/dmansfield/models/tree/documents-from-tensor, merged with the newest code from the syntaxnet repo, did not take this into account. |
I agree with that conclusion - that the operations being done in the As far as not building the pip package, were this 1690s Salem they might look at you askance -- by what black magic were you able to add the |
Ubuntu 17.10, Python 3.6.2, Syntaxnet-ops-hack main branch, cpu only, java 9.0.1, Eclipse 4.7.1a. Just for the record I can build both the Tensorflow 1.4 cpu and gpu and pip packages in the normal tensorflow branch, but I need and want to use Syntaxnet in Java as part of my toolchain integration with other software. Those libraries will obviously complain about not having the Syntaxnet Ops (FeatureSize, etc). Issues: http://www.bolcer.org/java-syntaxnet.png
I'm going to try to export my own local model as the next step. Tried the default one that comes w/ the 1.4 Tensorflow branch. tensorflow/tensorflow/contrib/syntaxnet/models/parsey_mcparseface/context.pbtxt No difference. So, DocumentStringSink? Also looking at TensorTest.java. |
@gbolcer I also see some junk characters when I use the saved_model from https://github.com/unsiloai/syntaxnet-ops-hack/tree/syntaxnet-ops-hack/run_saved_model_java/SAVED_MODEL Were you able to export your own model and get this working? @marhlder Will it be possible for you to share the modified parsey_mcparseface.py source file from https://github.com/dmansfield/models/tree/documents-from-tensor which you used to generate the model? |
It's been a while and I have been using a docker image as a temporary solution. Let me try to recreate it. |
For any one still interested in this, I currently use the syntaxnet ops as a seperate lib of custom ops which I then include into tensorflow. The code works with the prebuild java binaries distributed by TensorFlow. It probably also works for the python binaries installed with pip. The code can be found in this branch: See: The library can be build using: For exporting the model see: |
Thanks, will give it a try. Still very interested in getting it working the way I need it. Okay, first try I ran into this error here. I deleted all mentions of the armeabi-v7a text wherever it complained about it, and it looks like it's generating the .so and .jar files. Will test the sample java program next..... Plain old Tensorflow (https://github.com/tensorflow/tensorflow.git) compiles out of the box on my platform w/ the configuration below, including the java:tensorflow java:libtensorflow_jni, and //tensorflow/tools/pip_package:build_pip_package Okay, bazel version 0.15.0 Ubuntu (lsb_release -a) gcc --version cd tensorflow |
I have re-enabled notifications for this issue/thread, but you are also welcome to contact me more directly if I can be of help. |
Okay, new problems on this command. bazel build --config opt //tensorflow/user_ops:syntaxnet_dragnn_ops.so |
I do not think the bazel scripts are compatible with 0.15.0 You are likely to have more luck with 0.8.0 |
Thanks! I just changed all the set= to depset=, I also commented out the
syntaxnet reference in the load command as it seemed to already have it
accessible.
It seems to have generated the file.
tensorflow/user_ops/syntaxnet/workspace.h: In instantiation of 'int
syntaxnet::WorkspaceRegistry::Request(const string&) [with W =
syntaxnet::VectorVectorIntWorkspace; std::__cxx11::string =
std::__cxx11::basic_string<char>]':
tensorflow/user_ops/syntaxnet/sentence_features.h:139:77: required from
here
tensorflow/user_ops/syntaxnet/workspace.h:61:23: warning: comparison
between signed and unsigned integer expressions [-Wsign-compare]
Target //tensorflow/user_ops:syntaxnet_dragnn_ops.so up-to-date:
bazel-bin/tensorflow/user_ops/syntaxnet_dragnn_ops.so
INFO: Elapsed time: 27.009s, Critical Path: 11.15s
INFO: 86 processes: 86 local.
INFO: Build completed successfully, 91 total actions
greg@salt:~/code/syntaxnet-ops-hack-separate_lib$
…On Mon, Jul 2, 2018 at 2:27 PM, Martin Damgaard Nielsen < ***@***.***> wrote:
I do not think the bazel scripts are compatible with 0.15.0
You are likely to have more luck with 0.8.0
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#12328 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ASZzSGG_ZV09q2K7_JIyNG50KBQVN6KVks5uCpBIgaJpZM4O47VJ>
.
--
greg@bolcer.org, http://bolcer.org, c: +1.714.928.5476
|
Little further...now I just need to export the model. Loading model.... |
Thanks @marhlder , @gbolcer. I was able to build the syntaxnet_dragnn_ops binary, and use the trained models from https://github.com/unsiloai/parsey_mcparseface_export/tree/documents-from-tensor/syntaxnet/SAVED_MODEL to run inference. Btw, I am using bazel 0.5.4. |
I'm almost there too. I didn't build it right the first time, but it looks like it'll build correctly this time. Thanks for the link to the model. I ran into some java9 issues too. I had to add the following: --java_toolchain=@bazel_tools//tools/jdk:toolchain_java9 |
Okay, I got as far as I could. I had to do it on Windows at home. This is the final error message. I think it could be that it's not linking correctly on windows. I'll try it on my Ubuntu box when I get back into the office on Monday. Greg org.tensorflow.TensorFlowException: Op type not registered 'FeatureSize' in binary running on FX11. Make sure the Op and Kernel are registered in the binary running in this process. Note that if you are loading a saved graph which used ops from tf.contrib, accessing (e.g.) |
Did you build and dynamicly load the op library before loading the saved
model?
…On Fri, Jul 6, 2018, 22:47 gbolcer ***@***.***> wrote:
Okay, I got as far as I could. I had to do it on Windows at home. This is
the final error message. I think it could be that it's not linking
correctly on windows. I'll try it on my Ubuntu box when I get back into the
office on Monday.
Greg
org.tensorflow.TensorFlowException: Op type not registered 'FeatureSize'
in binary running on FX11. Make sure the Op and Kernel are registered in
the binary running in this process. Note that if you are loading a saved
graph which used ops from tf.contrib, accessing (e.g.)
tf.contrib.resampler should be done before importing the graph, as
contrib ops are lazily registered when the module is first accessed.
at org.tensorflow.SavedModelBundle.load(Native Method)
at org.tensorflow.SavedModelBundle.load(SavedModelBundle.java:39)
at
crafty.bear.tensorbuilder.syntaxnet.TensorflowModelWrapper.(TensorflowModelWrapper.java:15)
at
crafty.bear.tensorbuilder.syntaxnet.ParseyMcParsefaceWrapper.(ParseyMcParsefaceWrapper.java:14)
at
crafty.bear.tensorbuilder.syntaxnet.TensorFlowModelWrapperTest.testSyntaxnet(TensorFlowModelWrapperTest.java:54)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#12328 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACkL71DQicYkDsV39RevFZBHuW0Xx8Zlks5uD8zZgaJpZM4O47VJ>
.
|
I think the issue is that I had to build the whole stack statically with
--config=monolithic and some of my changes to get it to compile didn't
link correctly even w/ --linkopts.
I did also find a difference in REGISTER_OP
REGISTER_OP("Fact").Output("fact: string");
versus
REGISTER_OP("Fact")
.Output("fact: string")
.SetShapeFn(tensorflow::shape_inference::UnknownShape);
Looking in to see if that is related.
Thanks,
Greg
…On 7/6/2018 3:45 PM, Martin Damgaard Nielsen wrote:
Did you build and dynamicly load the op library before loading the saved
model?
|
Reverted to Java8 and Python27. That eliminated all the cruft from the alternate configurations. I also had to specify --config=monolithic (on windows), but it all compiled and linked. I'm compiling the OP now. This is farther than I've gotten w/o errors, so it's looking promising. bazel build --config opt --config=monolithic //tensorflow/java:tensorflow //tensorflow/java:libtensorflow_jni Creating library bazel-out/x64_windows-opt/bin/tensorflow/java/libtensorflow_jni.so.if.lib and object bazel-out/x64_windows-opt/bin/tensorflow/java/libtensorflow_jni.so.if.exp |
Hmmm...BUILD file is on the build path, so not sure why. S C:\code\syntaxnet-ops-hack> bazel build --config opt //tensorflow/user_ops:syntaxnet_dragnn_ops.so |
Windows issue with Variadic Macros. Added a comma before the ellipsis in char_properties.h:127 and that seems to have fixed it. ERROR: C:/code/syntaxnet-ops-hack/tensorflow/core/user_ops/syntaxnet/BUILD:268:1: C++ compilation of rule '//tensorflow/core/user_ops/syntaxnet:sentence_features' failed (Exit 2) |
File filter "readable" issue. ERROR: C:/code/syntaxnet-ops-hack/tensorflow/python/BUILD:3698:1: Executing genrule //tensorflow/python:pywrap_tensorflow_filtered_def_file failed (Exit 1): bash.exe failed: error executing command Traceback (most recent call last): |
Substituting _getpid() for getpid() on windows....and success! Testing out the wrapper code in the morning.... Creating library bazel-out/x64_windows-opt/bin/tensorflow/core/user_ops/syntaxnet_dragnn_ops.so.if.lib and object bazel-out/x64_windows-opt/bin/tensorflow/core/user_ops/syntaxnet_dragnn_ops.so.if.exp |
I am glad you got something working. I sorta got it to work with r1.9 of TensorFlow. Except i keep getting a symbolic error: "undefined symbol: _ZN10tensorflow7strings6StrCatB5cxx11ERKNS0_8AlphaNumE" |
I've seen that error before. What version of gcc are you using? I think I ended up installing gcc-4, gcc-5, gcc-6 (and later gcc-7), but I'm not sure which one fixed it. Just for grins, try adding --copts=" -D_GLIBCXX_USE_CXX11_ABI=0" to your bazel command. (Or it might be --cxxopts and --linkopts) |
I'm stuck at the point that I either can't load the model or if I use System.load explicitly, it complains about undefined symbols. java.lang.UnsatisfiedLinkError: /mnt/hbase/Insync/Working/tensorlibs/linux/syntaxnet-ops/user_ops/syntaxnet_dragnn_ops.so: /mnt/hbase/Insync/Working/tensorlibs/linux/syntaxnet-ops/user_ops/syntaxnet_dragnn_ops.so: undefined symbol: _ZN10tensorflow10DEVICE_CPUE I can't seem to get it to load parser_ops for some reason. I can't find a dep in the BUILD files. |
Now I'm really confused. bazel clean and then re-build w/o the monolithic tag. The java appears to have compiled and loaded the model. Now to run some data through it. 2018-07-12 14:07:16.220721: E tensorflow/core/framework/op_kernel.cc:1242] OpKernel ('op: "Fact" device_type: "CPU" label: "sergey"') for unknown op: Fact |
Getting very close. Looking at an input check error coming from somewhere. It seems to be embedded in the model I'm using. I'll have to dump a new one. Model loaded... |
Bummer, now I'm back where I started. But at least I know the software seems to be working, I just need to go back and experiment with the models and output again. University���� ��NNP2�NOUN:�nn�� |
I hope you guys don't mind me posting my work-in-progress here. I got to the point where there seems to be some output file type when I invoke the commands with my stored model. I think I can tweak my stored context.pbtxt file with the right values related to this: Loading model.... About to run on 68 chars |
@marhlder I am trying to export the model using https://github.com/unsiloai/parsey_mcparseface_export/tree/documents-from-tensor/ by doing the following -
But, I keep getting the following error - "Op type not registered 'FeatureSize'". Do these steps look alright to you, or am I missing something? Thanks in advance :) |
@sarda014 I think there are multiple issues: |
@marhlder |
…ose mlir emitter Imported from GitHub PR openxla/xla#12328 Current transpose mlir emitter allocate shared cache with shape 32x1x32 for transpose 2-1-0. But the read indices of shared cache are {0, y, x} as [this line](https://github.com/openxla/xla/blob/main/xla/service/gpu/fusions/transpose_mlir.cc#L190) shows, which is not compatible with 32x1x32 shape. What's strange is that transpose 2-1-0 can run successfully using transpose mlir emitter. I find the reason is that lower tensor pass use [linear index](https://github.com/openxla/xla/blob/main/xla/service/gpu/fusions/mlir/lower_tensors.cc#L148) to access shared cache, which is lucky to get right result. For example, the strides of 32x1x32 are {32, 32, 1}, and the linear index of {0, y ,x} is 0 * 32 + y * 32 + 32. I am not sure if it is as expected or just mistake. If reviewer think no need of this PR, feel free to close. Copybara import of the project: -- bfb21798ee518dc11293a5683669add619a38e53 by Zhou, Lingzhi <lingzhi.zhou@intel.com>: make shared cache read/write logic more clearly for transpose mlir emitter -- 0c9033334835bc8a14310e5ee059489cea7b5309 by Zhou, Lingzhi <lingzhi.zhou@intel.com>: refactor -- 5554110835fc18207fb466587c1aeb20c3a542fe by Zhou, Lingzhi <lingzhi.zhou@intel.com>: pad shared cache -- 8c17818baa1e2477952df15e412a6463f73106ab by Zhou, Lingzhi <lingzhi.zhou@intel.com>: include missing file Merging this change closes #12328 FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#12328 from lingzhi98:lingzhi/transpose_mlir_210 8c17818baa1e2477952df15e412a6463f73106ab PiperOrigin-RevId: 633823653
…ose mlir emitter Imported from GitHub PR openxla/xla#12328 Current transpose mlir emitter allocate shared cache with shape 32x1x32 for transpose 2-1-0. But the read indices of shared cache are {0, y, x} as [this line](https://github.com/openxla/xla/blob/main/xla/service/gpu/fusions/transpose_mlir.cc#L190) shows, which is not compatible with 32x1x32 shape. What's strange is that transpose 2-1-0 can run successfully using transpose mlir emitter. I find the reason is that lower tensor pass use [linear index](https://github.com/openxla/xla/blob/main/xla/service/gpu/fusions/mlir/lower_tensors.cc#L148) to access shared cache, which is lucky to get right result. For example, the strides of 32x1x32 are {32, 32, 1}, and the linear index of {0, y ,x} is 0 * 32 + y * 32 + 32. I am not sure if it is as expected or just mistake. If reviewer think no need of this PR, feel free to close. Copybara import of the project: -- bfb21798ee518dc11293a5683669add619a38e53 by Zhou, Lingzhi <lingzhi.zhou@intel.com>: make shared cache read/write logic more clearly for transpose mlir emitter -- 0c9033334835bc8a14310e5ee059489cea7b5309 by Zhou, Lingzhi <lingzhi.zhou@intel.com>: refactor -- 5554110835fc18207fb466587c1aeb20c3a542fe by Zhou, Lingzhi <lingzhi.zhou@intel.com>: pad shared cache -- 8c17818baa1e2477952df15e412a6463f73106ab by Zhou, Lingzhi <lingzhi.zhou@intel.com>: include missing file Merging this change closes #12328 FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#12328 from lingzhi98:lingzhi/transpose_mlir_210 8c17818baa1e2477952df15e412a6463f73106ab PiperOrigin-RevId: 633823653
…ose mlir emitter Imported from GitHub PR openxla/xla#12328 Current transpose mlir emitter allocate shared cache with shape 32x1x32 for transpose 2-1-0. But the read indices of shared cache are {0, y, x} as [this line](https://github.com/openxla/xla/blob/main/xla/service/gpu/fusions/transpose_mlir.cc#L190) shows, which is not compatible with 32x1x32 shape. What's strange is that transpose 2-1-0 can run successfully using transpose mlir emitter. I find the reason is that lower tensor pass use [linear index](https://github.com/openxla/xla/blob/main/xla/service/gpu/fusions/mlir/lower_tensors.cc#L148) to access shared cache, which is lucky to get right result. For example, the strides of 32x1x32 are {32, 32, 1}, and the linear index of {0, y ,x} is 0 * 32 + y * 32 + 32. I am not sure if it is as expected or just mistake. If reviewer think no need of this PR, feel free to close. Copybara import of the project: -- bfb21798ee518dc11293a5683669add619a38e53 by Zhou, Lingzhi <lingzhi.zhou@intel.com>: make shared cache read/write logic more clearly for transpose mlir emitter -- 0c9033334835bc8a14310e5ee059489cea7b5309 by Zhou, Lingzhi <lingzhi.zhou@intel.com>: refactor -- 5554110835fc18207fb466587c1aeb20c3a542fe by Zhou, Lingzhi <lingzhi.zhou@intel.com>: pad shared cache -- 8c17818baa1e2477952df15e412a6463f73106ab by Zhou, Lingzhi <lingzhi.zhou@intel.com>: include missing file Merging this change closes #12328 PiperOrigin-RevId: 633848774
Summary/tldr:
It would be nice with more String support in the Java API and a tf.reduce_sum which supports string concatenation.
Body:
I have successfully hacked in the custom ops of syntaxnet into the Tensorflow master as I wish to run syntaxnet from my Java NLP pipeline.
I do this by saving a SavedModelBundle and load it again from Java.
My project is based on a saved model of parsey_mcparseface from this branch:
https://github.com/dmansfield/models/tree/documents-from-tensor
By user @dmansfield.
And a tensorflow build based on the custom ops from:
https://github.com/tensorflow/models/tree/master/syntaxnet
Hacked into master of tensorflow.
Hacking in the ops, as build in ops, was necessary as the Java api through the JNI does not support user loaded ops yet (AFAIK).
The code with the syntaxnet ops hacked in can be found here:
https://github.com/marhlder/syntaxnet-ops-hack
I have everything running except that the strings in the output tensor from my saved model includes junk (non-printable chars) which I think is due to the offset table described in tensor_jni.cc file.
I can run the same model from Python without any issues.
The Java API does currently not seem to support anything but scalar string tensors. It looks like using a scalar string tensor will solve my problem as that part of the codes seems to handle the offset table.
I would therefore like to reduce the string tensor produced by my parsey mcparseface model.
I then found that the tf.reduce_sum does not yet support string concatenation.
There should already be an op for it:
#701
User @mrry commented that he was looking for a use case for this here:
https://stackoverflow.com/questions/34247374/merge-string-tensors-in-tensorflow
The text was updated successfully, but these errors were encountered: