ray/doc/source/ray-air/use-pretrained-model.rst

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

23 lines
961 B
ReStructuredText
Raw Normal View History

.. _use-pretrained-model:
Use a pretrained model for batch or online inference
=====================================================
2022-06-08 23:37:53 +02:00
Ray AIR moves end to end machine learning workloads seamlessly through the construct of ``Checkpoint``. ``Checkpoint``
is the output of training and tuning as well as the input to downstream inference tasks.
2022-06-08 23:37:53 +02:00
Having said that, it is entirely possible and supported to use Ray AIR in a piecemeal fashion.
2022-06-08 23:37:53 +02:00
Say you already have a model trained elsewhere, you can use Ray AIR for downstream tasks such as batch and
online inference. To do that, you would need to convert the pretrained model together with any preprocessing
steps into ``Checkpoint``.
To facilitate this, we have prepared framework specific ``to_air_checkpoint`` helper function.
Examples:
.. literalinclude:: doc_code/use_pretrained_model.py
:language: python
:start-after: __use_pretrained_model_start__
:end-before: __use_pretrained_model_end__