Loads a model from an archive and creates the prediction graph runner. Args: storage_path: Directory which contains the persisted graph components. model_archive_path: The path to the model archive. model_storage_class: The class to instantiate the model storage from.
(
storage_path: Path,
model_archive_path: Path,
model_storage_class: Type[ModelStorage],
graph_runner_class: Type[GraphRunner],
)
| 7 | |
| 8 | |
| 9 | def load_predict_graph_runner( |
| 10 | storage_path: Path, |
| 11 | model_archive_path: Path, |
| 12 | model_storage_class: Type[ModelStorage], |
| 13 | graph_runner_class: Type[GraphRunner], |
| 14 | ) -> Tuple[ModelMetadata, GraphRunner]: |
| 15 | """Loads a model from an archive and creates the prediction graph runner. |
| 16 | |
| 17 | Args: |
| 18 | storage_path: Directory which contains the persisted graph components. |
| 19 | model_archive_path: The path to the model archive. |
| 20 | model_storage_class: The class to instantiate the model storage from. |
| 21 | graph_runner_class: The class to instantiate the runner from. |
| 22 | |
| 23 | Returns: |
| 24 | A tuple containing the model metadata and the prediction graph runner. |
| 25 | """ |
| 26 | model_storage, model_metadata = model_storage_class.from_model_archive( |
| 27 | storage_path=storage_path, model_archive_path=model_archive_path |
| 28 | ) |
| 29 | runner = graph_runner_class.create( |
| 30 | graph_schema=model_metadata.predict_schema, |
| 31 | model_storage=model_storage, |
| 32 | execution_context=ExecutionContext( |
| 33 | graph_schema=model_metadata.predict_schema, model_id=model_metadata.model_id |
| 34 | ), |
| 35 | ) |
| 36 | return model_metadata, runner |
nothing calls this directly
no test coverage detected
searching dependent graphs…