Skip to content

Mixing PyTorch and TensorFlow #835

Answered by lanking520
pyhh asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @pyhh It is possible. But you may only use PyTorch engine to run inference with TorchScript model. It is not possible to use MXNet/TensorFlow to run a PyTorch model.

As you mentioned, you can use models from two different engines, say one from MXNet, the other from PyTorch. All you need to do is import both MXNet and PyTorch dependencies and declare the .optEngine from your Criteria. Once this is done, DJL will load the model with the right engine and you can run inference at the same time.

Here is an example using Multiple Engines at the same time: https://github.com/aws-samples/djl-demo/tree/master/multi-engine. It demos how to run MXNet + PyTorch models at the same time.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@pyhh
Comment options

Answer selected by pyhh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants