DeepPavlov error loading the model from Tensorflow (from_tf=True)

147 views Asked by At

I'm trying to load the ruBERT model into Deeppavlov as follows:

#is a dict
config_path = {
   "chainer": {
      "in": [
         "x"
      ],
      "in_y": [
         "y"
      ],
      "out": [
         "y_pred_labels",
         "y_pred_probas"
      ],
      "pipe": [
         ...
   }
}

model = build_model(config_path, download=False)

At the same time, I have all the files of the original ruBERT model locally. However, an error throws when building the model:

OSError: Error no file named pytorch_model.bin found in directory ruBERT_hFace2 but there is a file for TensorFlow weights. Use `from_tf=True` to load this model from those weights.

At the same time, there is nowhere a clear explanation of how to pass this parameter through the build_model function.

How to pass this parameter across build_model correctly?


UPDATE 1

At the moment, the version of Deep Pavlov 1.0.2 is installed. The checkpoint of the model consists of following files:

enter image description here

1

There are 1 answers

1
com On

Currently there is no way to pass any parameter via build_model. In case of additional parameter you should align the configuration file accordingly. Alternatively you can change it via Python code.

from deeppavlov import build_model, configs, evaluate_model
from deeppavlov.core.commands.utils import parse_config
config = parse_config(f"config.json")
...
model = build_model(config, download=True, install=True)

But first please make sure that you are using the latest version of DeepPavlov. In addition please take a look at out recent article on Medium. If you need a further assistance please provide more details.