For deployment, you should put all your custom layers/loss functions and things like that in a separate module, like a file named utils.py
in the same folder, then you can use import utils
.
Carefully use this approach to export your Learner, so python knows to look at the code in utils, then place that file in your deployment env and it should work.