Is it possible to embed TVM into Tensorflow Serving?

Is it possible to embed TVM into Tensorflow Serving?

I attempted and succeeded with an initial version.

1 Like

Awesome! Can you please share a tutorial? Really appreciated.

I am also interested in it. This could be very nice if we are in cloud server environment.

@daweili1226 & @FrozenGene
you guys may need to wait a while as I am checking on the approvals to upstream it.

Hi @srkreddy1238
How is it going with tvm into tf serving?

Good to go now.

Will upstream in a week or 10 days.

Thank you so much, good news at the start of my day!

@daweili1226 checkout the below branch for TVM on tf serving. This more likely an initial version, some standardisation and enhancements to be done.

Find below a python notebook to demonstrate the same.

3 Likes

Thanks for the nice sharing.

@srkreddy1238

Is there any performance benchmarks regarding to this TVM integration into TensorFlow serving?

Also I am wondering whether there is any apple-to-apple comparison between this integration and TF XLA backend support in your serving scenario?

I think TF serving framework doesn’t increase or decrease performance numbers compared to individual TVM vs TF numbers.

This is basic version of TVM Servable into TF Serving verified for CPU, I think the context is some thing to be passed through configuration for other backends.

I think this is the inference performance between TF-XLA and TVM. Not TF Serving problem. The performance number could be seen: https://arxiv.org/pdf/1802.04799.pdf

1 Like

@srkreddy1238 how to build tf-serving with TVM support?

In your example, you simply call tf_model_server binary, how did you build it? And, eventually, is it possible to use a docker image instead?

Thanks for the nice sharing. @srkreddy1238

Does the commit depend on other your code? Can I merge it into my TF service code and compile it ?

The binary is built by patching the above change to tensorflow_serving. Yes, we can build docker image out of the box as TF serving already support it.

Yes, this patch should work on TF Serving 1.12 directly.

TVM version must be 0.1? it could be 0.6 or the latest version?

I think TVM version that time was 0.5. But I don’t think graph runtime has got major new changes which is the only dependency for TF Serving. You may try 0.6 first.

TF Serving also advanced to latest versions now, I may try upgrade later.

Thank you very much! I try it.

If there is any result, I will give you the feedback.

#-------------------------------

I successfully load the TVM Model with TF Serving.

The TVM Version must be v0.5.I think the problem is in the graph-metadata-API.diff file.

When I have time, I try to change the code to support the latest version.

1 Like

You may try the path failures manually or fall back to 0.5 version.