You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/deployments/realtime-api/models.md
+19-6Lines changed: 19 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -187,7 +187,20 @@ Usage varies based on the predictor type:
187
187
188
188
### Python
189
189
190
-
To use live model reloading with the Python predictor, the model path(s) must be specified in the API's `predictor` configuration (via the `model_path` or `models` field). When models are specified in this manner, your `PythonPredictor` class must implement the `load_model()` function, and models can be retrieved by using the `get_model()` method of the `python_client` that's passed to the predictor's constructor:
190
+
To use live model reloading with the Python predictor, the model path(s) must be specified in the API's `predictor` configuration (via the `model_path` or `models` field). When models are specified in this manner, your `PythonPredictor` class must implement the `load_model()` function, and models can be retrieved by using the `get_model()` method of the `python_client` that's passed into your predictor's constructor.
191
+
192
+
The `load_model()` function that you implement in your `PythonPredictor` can return anything that you need to make a prediction. There is one caveat: whatever the return value is, it must be unloadable from memory via the `del` keyword. The following frameworks have been tested to work:
193
+
194
+
* PyTorch (CPU & GPU)
195
+
* ONNX (CPU & GPU)
196
+
* Sklearn/MLFlow (CPU)
197
+
* Numpy (CPU)
198
+
* Pandas (CPU)
199
+
* Caffe (not tested, but should work on CPU & GPU)
200
+
201
+
Python data structures containing these types are also supported (e.g. lists and dicts).
202
+
203
+
The `load_model()` function takes a single argument, with is a path (on disk) to the model to be loaded. It is called behind the scenes when you call the `python_client`'s `get_model()` method from your predictor's `predict()` method. Whatever `load_model()` returns will be the exact return value of `python_client.get_model()`. Here is the schema for `python_client.get_model()`:
0 commit comments