modelstore icon indicating copy to clipboard operation
modelstore copied to clipboard

ValueError: could not find matching manager

Open tsudot opened this issue 2 years ago • 5 comments

I am trying to run the following code using v0.0.80


import tensorflow as tf
from modelstore import ModelStore

model_store = ModelStore.from_azure(
        container_name="xyz",
        root_prefix="xyz",
    )


def tf_model():
    model = tf.keras.models.Sequential(
        [
            tf.keras.layers.Dense(5, activation="relu", input_shape=(10,)),
            tf.keras.layers.Dropout(0.2),
            tf.keras.layers.Dense(1),
        ]
    )
    model.compile(optimizer="adam", loss="mean_squared_error")
    return model
# Upload model 
model = tf_model()
meta_data = model_store.upload(model_domain, model=model)

I get the following error:

Traceback (most recent call last):
  File "/tmp/core/trainer.py", line 140, in <module>
    meta_data = model_store.upload(model_domain, model=model)
  File "/tmp/.venv/lib/python3.10/site-packages/modelstore/model_store.py", line 283, in upload
    managers = matching_managers(self._libraries, **kwargs)
  File "/tmp/.venv/lib/python3.10/site-packages/modelstore/models/managers.py", line 87, in matching_managers
    raise ValueError("could not find matching manager")
ValueError: could not find matching manager

When I tried to log all the managers in this function: https://github.com/operatorai/modelstore/blob/6e438c55d90fad1b5a0a80d278ef2f24f26c93b4/modelstore/models/managers.py#L80

I get this:

[<modelstore.models.missing_manager.MissingDepManager object at 0x12da03610>, <modelstore.models.missing_manager.MissingDepManager object at 0x12da03d60>, <modelstore.models.missing_manager.MissingDepManager object at 0x12da34ee0>, <modelstore.models.model_file.ModelFileManager object at 0x12da34940>, <modelstore.models.missing_manager.MissingDepManager object at 0x12da34a30>, <modelstore.models.missing_manager.MissingDepManager object at 0x12da348e0>, <modelstore.models.missing_manager.MissingDepManager object at 0x12d44df00>, <modelstore.models.missing_manager.MissingDepManager object at 0x12da34b80>, <modelstore.models.missing_manager.MissingDepManager object at 0x12da34ac0>, <modelstore.models.missing_manager.MissingDepManager object at 0x12da34970>, <modelstore.models.missing_manager.MissingDepManager object at 0x12da34bb0>, <modelstore.models.missing_manager.MissingDepManager object at 0x12da34be0>, <modelstore.models.missing_manager.MissingDepManager object at 0x12da347f0>, <modelstore.models.missing_manager.MissingDepManager object at 0x12da34e80>, <modelstore.models.missing_manager.MissingDepManager object at 0x12da34e20>, <modelstore.models.missing_manager.MissingDepManager object at 0x12da34dc0>, <modelstore.models.missing_manager.MissingDepManager object at 0x12da34d60>, <modelstore.models.missing_manager.MissingDepManager object at 0x12da34d00>]

tsudot avatar Jan 13 '24 15:01 tsudot

Thanks for reporting! Which version of tensorflow are you using?

nlathia avatar Jan 13 '24 17:01 nlathia

I'm using tensorflow = "2.15.0"

tsudot avatar Jan 13 '24 18:01 tsudot

Thanks, I'll check this out asap

nlathia avatar Jan 13 '24 21:01 nlathia

@tsudot 👋🏽 I've managed to replicate the issue, using the following in Ubuntu:

  • Python 3.10.12
  • tensorflow==2.15.0

And have opened #274 with a fix. It looks like tensorflow no longer installs scipy, and so modelstore was incorrectly listing the latter as a required dependency.

Short-term workarounds

If you want to continue using modelstore==0.0.80, there are two things you can do:

  1. Try an older version of tensorflow. All the unit tests in modelstore pass with tensorflow==2.13.1.
  2. Create a zip/tar file with the tensorflow model, and then upload it as a file with modelstore

Alternatively, once the PR is merged, you can also install modelstore from source (if you do that and still see issues, please let me know?)

I'll leave this issue open until I release modelstore==0.0.81.

nlathia avatar Jan 19 '24 10:01 nlathia

@nlathia I tested this fix and it's working. Thanks a lot!

tsudot avatar Jan 20 '24 06:01 tsudot