ImportError: There is no such class as custom_model.CustomModel


I am just starting to use SpeechBrain and trying to run a template in Colab, based on “SEfromScratch”. When I tried to load yaml via the following, I get error as in the topic. Any help would be greatly appreciated!


with open("/content/gdrive/My Drive/speech_models/SpeechBrain/firstModel/train.yaml") as fin:
hparams = load_hyperpyyaml(fin)

@pplantinga Would this approach to load yaml works currently (on Colab) ?

I think this yaml is expected to be loaded from the same directory as in the tutorial folder. You can either copy that custom model file to the directory your loading code is in, or change the model to refer to a built-in speechbrain model. However you approach it, the object should be importable. E.g.

model: !new:custom_model.CustomModel

is roughly equivalent to:

from custom_model import CustomModel
model = CustomModel()

Thank you both! Changing the directory to where the exists solved the problem.