Is it possible to train a model and use it in Java from fastai?

I guess fastai use tta to boot its performer at test time, so I don’t want to save the model to pytorch and convert it to Java. Is it possible to do it in Fastai in java way?
Thank you.

Are you asking if you can implement TTA in java? It might be a little difficult but you would probably be able to get some approximation by using an image augmentation library in java. You would want to test it, because the augmentations in java might be a bit different, possibly leading to slightly different test results.

Is there any particular reason to use java for this? Generally I would think you would run into support issues on the java side.

That is because it is maybe easier or safer to do it in servlet or spring than in Flask. I don’t know much about Django and it is hard.

Thank you for reply.

Aren’t there already some Java wrappers for pytorch? I think you could get at least inference running with Java and do the training and modeling in python.

You might want to check this out, as it supports pytorch inference on CPU and GPU
https://github.com/awslabs/djl