1

I'm trying to run a Connectionist Temporal Classification Model (Automatic Speech Recognition), and below is the beginning code I got from the example.py in https://github.com/cyprienruffino/CTCModel/blob/master/example.py:

import os
!pip install keras
import keras
!pip install tensorflow
import tensorflow
from keras.layers import TimeDistributed, Activation, Dense, Input, Bidirectional, LSTM, Masking, GaussianNoise
from tensorflow.keras.optimizers import Adam
from keras import keras_ctcmodel
from keras_ctcmodel.CTCModel import CTCModel as CTCModel
import pickle
from keras.preprocessing import sequence
from tensorflow.python.keras.utils.generic_utils import Progbar
import numpy as np
from six.moves.urllib.request import urlretrieve

However, I keep getting an import error on

from keras_ctcmodel.CTCModel import CTCModel as CTCModel

I faced this issue with importing Adam as well until I added tensorflow. Is this a bug in Keras?

ihavenoidea
  • 41
  • 1
  • 3
  • Please share your stacktrace. Are you copying just this file or all the repo? `keras_ctcmodel.CTCModel` is not from standard keras so it should be defined somewhere else – Rodrigo Laguna Aug 21 '22 at 03:34
  • I am copying the example.py file from the link. Also I'm a slight beginner to Python - how do I find the stacktrace? I see code under "traceback" in the error, but it's the same as what's above. – ihavenoidea Aug 21 '22 at 03:56
  • Your code doesn't show you ever running `!pip install keras-ctcmodel`. The Github site you got that from explains how to install it. – Djinn Aug 21 '22 at 07:11
  • The imports in the example and in your code are different, the import that error does not exist (that is why it errors). I am talking particularly about this import: from keras import keras_ctcmodel – Dr. Snoopy Aug 21 '22 at 10:58

0 Answers0