I’d like to create a Bento Model that saves a <uma...
# ask-for-help
j
I’d like to create a Bento Model that saves a umap-learn’s ParametricUMAP trained model. I am not sure which framework to use because: • ParametricUMAP inherits from UMAP which inherits from sklearn’s BaseEstimator • ParametricUMAP also makes use of tf.keras I’ve tried using
bentol.sklearn.save_model
,
bentol.keras.save_model
,
bentol.tensorflow.save_model
, and
bentol.picklable_model.save_model
, all to no avail. Any tips for this one? The save_model function is:
Copy code
pitch_umap_3 = load_ParametricUMAP(save_location=save_location)

bento_model = bentoml.<various_frameworks>.save_model(
    bentoml_model_name,
    pitch_umap_3,
    signatures={
        "transform": {"batchable": False}
    },
    custom_objects={
        "encoders": encoders,
        "cols": cols,
        "model_version": model_version,
        "model_update_time": model_update_time
    }
)
The most common error is (for picklable_model, sklearn):
Copy code
ValueError: Unknown loss function: loss. Please ensure this object is passed to the `custom_objects` argument. See <https://www.tensorflow.org/guide/keras/save_and_serialize#registering_the_custom_object> for details.
For tensorflow, keras:
Copy code
AttributeError: 'ParametricUMAP' object has no attribute 'keras_fit_kwargs'