MLServer
MLServer copied to clipboard
Extend `get_model_uri` to search over all model filenames with a given suffix
If the parameters.uri field in model-settings.json refers to a directory, mlserver.utils.get_model_uri can search for filename's with given names (via the wellknown_filenames kwarg). Since these filenames must be explicit named, only a limited subset of filenames is supported. For example for the lightgbm runtime:
https://github.com/SeldonIO/MLServer/blob/f27bf6eb6fac679cac3ef43537bf73eb75d6252b/runtimes/lightgbm/mlserver_lightgbm/lightgbm.py#L9
The implication of this is that the model must be named 'model.bst', rather than any model name with a .bst file suffix. Otherwise, get_model_uri will resort to returning the model directory, which will cause an error when passed to the lightgbm.Booster.
An enhancement would be to implement more advanced filename searching in get_model_uri, e.g. to search for any filenames with a suitable suffix. There would need to be logic to handle the edge case where a model directory contains multiple models.