ludwig-ai / ludwig

Low-code framework for building custom LLMs, neural networks, and other AI models
http://ludwig.ai
Apache License 2.0
11.08k stars 1.19k forks source link

How to use trained model in Golang? #1156

Open stremovskyy opened 3 years ago

stremovskyy commented 3 years ago

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?

jimthompson5802 commented 3 years ago

@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.

stremovskyy commented 3 years ago

@jimthompson5802 Thx for your work!

tgaddair commented 3 years ago

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.

stremovskyy commented 3 years ago

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

tgaddair commented 3 years ago

@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?

VivekPanyam commented 3 years ago

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

stremovskyy commented 3 years ago

@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.

dalianaliu commented 2 years ago

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