ludwig icon indicating copy to clipboard operation
ludwig copied to clipboard

How to use trained model in Golang?

Open stremovskyy opened this issue 3 years ago • 8 comments

How to use trained model in Golang?

I have several trained models and application written on Golang Now I have used several instances “ludwig serve” and send requests to it Is three any way to use this models in Golang program directly?

stremovskyy avatar Apr 17 '21 18:04 stremovskyy

@Karmadon Thank you for submitting this question.

As of this point Ludwig supports only Python bindings.

I'll mark your questions as potential feature request. At this point, however, it is not in scope.

jimthompson5802 avatar Apr 17 '21 19:04 jimthompson5802

@jimthompson5802 Thx for your work!

stremovskyy avatar Apr 17 '21 20:04 stremovskyy

Hey @Karmadon, one option for you would be to export your Ludwig model to a Neuropod, which we have an API for here.

Once exported to Neuropod, you can use its C++ API in conjunction with cgo to perform inference on the Ludwig model from your Golang application. This approach was what we used to perform inference on Ludwig models from Go at Uber.

tgaddair avatar Apr 29 '21 15:04 tgaddair

Thank you @tgaddair ! I will try this way, Where to find c bindings for neuropod? or are they not in the public repos?

stremovskyy avatar May 02 '21 04:05 stremovskyy

@vkuzmin-uber @VivekPanyam are there still plans to add Golang bindings to Neuropod?

I see there's this issue that is still open: https://github.com/uber/neuropod/issues/294

Any updates?

tgaddair avatar May 04 '21 00:05 tgaddair

Hi! Sorry for the delay; the last few weeks have unfortunately been quite taxing

@Karmadon The C API is here and here's a test that shows example usage

In order to use it, you'll need at least Neuropod v0.3.0-rc1. Installation instructions are here.

@tgaddair I'm not sure what the status of that is. @vkuzmin-uber or @thuningxu would probably know better

VivekPanyam avatar May 16 '21 21:05 VivekPanyam

@VivekPanyam Thank you so much! It looks like this is exactly what I need. I will try to write POC. If it works, I will definitely share it.

stremovskyy avatar May 19 '21 15:05 stremovskyy

Hi @Karmadon, just want to follow up to see if you have used it for your POC?

dalianaliu avatar Jul 27 '22 16:07 dalianaliu