https://github.com/yuanwenqing/tensorflow4j
A Java Library for Protobuf in TensorFlow and TensorFlow-Serving
https://github.com/yuanwenqing/tensorflow4j
jar java protobuf tensorflow tensorflow-serving tensorflow-serving-api
Last synced: about 1 month ago
JSON representation
A Java Library for Protobuf in TensorFlow and TensorFlow-Serving
- Host: GitHub
- URL: https://github.com/yuanwenqing/tensorflow4j
- Owner: YuanWenqing
- License: apache-2.0
- Created: 2019-01-27T07:34:36.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-10-17T02:56:17.000Z (over 6 years ago)
- Last Synced: 2025-02-13T14:21:49.448Z (over 1 year ago)
- Topics: jar, java, protobuf, tensorflow, tensorflow-serving, tensorflow-serving-api
- Language: Python
- Homepage:
- Size: 239 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TensorFlow proto
Since [TensorFlow](https://github.com/tensorflow/tensorflow) and [TensorFlow-Serving](https://github.com/tensorflow/serving)
do not support official jars for their protobuf files right now,
we create this project to do it just for convenience and sharing.
## Usage
`tensorflow-proto` contains and compiles all protobuf files in TensorFlow,
and `serving-proto` does that for TensorFlow-Serving.
Since compiling of `serving-proto` imports protobuf from `tensorflow-proto`,
actually `serving-proto` contains all that `tensorflow-proto` has.
Therefore `serving-proto` is the only library you need when you want to do something with TensorFlow-Serving.
maven:
~~~xml
xyz.codemeans.tensorflow4j
tensorflow-proto
1.12.0
xyz.codemeans.tensorflow4j
serving-proto
1.12.0
~~~
gradle:
~~~groovy
implementation 'xyz.codemeans.tensorflow4j:tensorflow-proto:1.12.0'
implementation 'xyz.codemeans.tensorflow4j:serving-proto:1.12.0'
~~~
## Sync Protobuf Files
Clone those two projects,
checkout the latest version(or any other version you want),
and then run:
~~~bash
python sync_proto.py /path/to/tensorflow_project tensorflow-proto
python sync_proto.py /path/to/tensorflow_serving_project serving-proto
~~~
NOTE: a little BUGFIX must be done to `tensorflow/compiler/tf2xla/host_compute_metadata.proto`,
change `java_outer_classname` as below:
~~~proto
// option java_outer_classname = "Tf2XlaProtos";
option java_outer_classname = "HostComputeMetadataProtos";
~~~
## Build JAR Library
Requirements:
* protoc
* gradle
* protobuf lib
run:
~~~bash
gradle clean build
~~~
If you want to publish the built jars, you can run:
~~~bash
# publish to local maven repository (`~/.m2`)
gradle local
~~~
or
~~~bash
# config maven publishing and publish to nexus
gradle publish
~~~
## Version
Current version of TensorFlow and TensorFlow-Servng are both 1.12.0.
If you want to build library for another version, you MUST:
* checkout TensorFlow and TensorFlow-Serving source of exact version you want, then sync all proto files
* change version and publish setting in `build.gradle` for publishing somewhere