'Why does Explainable AI not find implementations of the model?

In this Notebook, we use Explainable AI SDK from Google to load a model, right after saving it. This fails with a message that the model is missing.

But note

  • the info message saying that the model was saved
  • checking working/model shows that the model is there.

enter image description here

  • However, working/model/assets is empty.

Why do we get this error message? How can we avoid it?

    model_path = "working/model"

    model.save(model_path)
    
    builder = SavedModelMetadataBuilder(model_path)
    builder.set_numeric_metadata(
        "numpy_inputs",
        input_baselines=[X_train.median().tolist()],  # attributions relative to the median of the target
        index_feature_mapping=X_train.columns.tolist(),  # the names of each feature
    )
    builder.save_metadata(model_path)
    
    explainer = explainable_ai_sdk.load_model_from_local_path(
        model_path=model_path,
        config=configs.SampledShapleyConfig(path_count=20),
    )
    
INFO:tensorflow:Assets written to: working/model/assets
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
/tmp/ipykernel_26061/1928503840.py in <module>
     18 explainer = explainable_ai_sdk.load_model_from_local_path(
     19     model_path=model_path,
---> 20     config=configs.SampledShapleyConfig(path_count=20),
     21 )
     22 

/opt/conda/lib/python3.7/site-packages/explainable_ai_sdk/model/model_factory.py in load_model_from_local_path(model_path, config)
    128   """
    129   if _LOCAL_MODEL_KEY not in _MODEL_REGISTRY:
--> 130     raise NotImplementedError('There are no implementations of local model.')
    131   return _MODEL_REGISTRY[_LOCAL_MODEL_KEY](model_path, config)
    132 

NotImplementedError: There are no implementations of local model.


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source