2e99bc2dee
* Binary deser Signed-off-by: Alexander Stoyakin <alexander.stoyakin@gmail.com> * Binary mode for servlet Signed-off-by: Alexander Stoyakin <alexander.stoyakin@gmail.com> * Added test Signed-off-by: Alexander Stoyakin <alexander.stoyakin@gmail.com> * -sRandom image generation copied from datavec * -sRandom image generation copied from datavec * Remove serialization constraints * Fix: Signed-off-by: Alexander Stoyakin <alexander.stoyakin@gmail.com> * Removed unused code Signed-off-by: Alexander Stoyakin <alexander.stoyakin@gmail.com> * Resources usage Signed-off-by: Alexander Stoyakin <alexander.stoyakin@gmail.com> * Async inference Signed-off-by: Alexander Stoyakin <alexander.stoyakin@gmail.com> * Cleanup Signed-off-by: Alexander Stoyakin <alexander.stoyakin@gmail.com> * -sTest corrected * Cleanup Signed-off-by: Alexander Stoyakin <alexander.stoyakin@gmail.com> * Mutually eclusive serializers/deserializers Signed-off-by: Alexander Stoyakin <alexander.stoyakin@gmail.com> * Binary output supported Signed-off-by: Alexander Stoyakin <alexander.stoyakin@gmail.com> * Binary out test Signed-off-by: Alexander Stoyakin <alexander.stoyakin@gmail.com> * - types hardcoded - increased payload size limit Signed-off-by: raver119 <raver119@gmail.com> * change types constant Signed-off-by: raver119 <raver119@gmail.com> |
||
---|---|---|
.. | ||
src | ||
README.md | ||
pom.xml |
README.md
SameDiff model serving
This modules provides JSON-based serving of SameDiff models
Example
First of all we'll create server instance. Most probably you'll do it in application that will be running in container
val server = SameDiffJsonModelServer.<String, Sentiment>builder()
.adapter(new StringToSentimentAdapter())
.model(mySameDiffModel)
.port(8080)
.serializer(new SentimentSerializer())
.deserializer(new StringDeserializer())
.build();
server.start();
server.join();
Now, presumably in some other container, we'll set up remote inference client:
val client = JsonRemoteInference.<String, Sentiment>builder()
.endpointAddress("http://youraddress:8080/v1/serving")
.serializer(new StringSerializer())
.deserializer(new SentimentDeserializer())
.build();
Sentiment result = client.predict(myText);
On top of that, there's async call available, for cases when you need to chain multiple requests to one or multiple remote model servers.
Future<Sentiment> result = client.predictAsync(myText);