1

When I try to generate a model with acumos I get this error :

  File "/Users/fredericchantrel/.pyenv/versions/ticl-v2-virtualenv-3.6.5/lib/python3.6/site-packages/acumos/pickler.py", line 245, in wrapped_save

...

  File "/Users/fredericchantrel/.pyenv/versions/ticl-v2-virtualenv-3.6.5/lib/python3.6/site-packages/tensorflow/python/ops/resource_variable_ops.py", line 687, in numpy
    "numpy() is only available when eager execution is enabled.")
NotImplementedError: numpy() is only available when eager execution is enabled.

Is there incompatibilities whith numpy from acumos ?

Here is a piece of my code :

def classify_ticket(inText: str) -> str:
    text = normalise(inText)
    current_vec = get_sentence_vector(text)
    x_predict = []
    x_predict.append(current_vec)
    X_predict = np.asarray(x_predict)
    result = current_model.predict(X_predict)
    predict = get_meilleure_reponse(result[0])
return predict

def get_sentence_vector(sentence):
    words = sentence.split()
    array_vector = []
    for word in words:
        try:
            current_vec = get_word_vector(word)
            array_vector.append(current_vec)
        except KeyError as e:
            print(f"token non trouvé dans le dico : {word}")

    np_array = np.asarray(array_vector)    
    retour = np.mean(np_array, dtype=np.float64, axis=0)
    return retour
  • Use of numpy should be fine. Would you please post a small self-contained code example? – chrisinmtown Mar 22 '19 at 14:00
  • @chrisinmtown I put a piece of code, hope this help. If you need all the code juste tell me. – frédéric chantrel Mar 22 '19 at 14:19
  • Thanks. The point of a small self-contained example is that our experts (which I am not) can save, run and test easily. It's very difficult to debug someone else's code given only a small part of it. – chrisinmtown Mar 22 '19 at 14:22
  • I continue testing other solutions, the problem come from incompatibility with tensorflow. When I only use keras (without tensorflow) to build my neural network i can dump the model. I will try to onboard it and call the generated model to see if it's ok. – frédéric chantrel Mar 22 '19 at 18:46
  • If someone has the same error, this error indicates that we have to add "tf.enable_eager_execution()". But when this is done we encounter another error. To solve the problem I had to replace **"from tensorflow.python.keras.models import Sequential, ..."** by **"from keras.models import Sequential, ..."** and **"from tensorflow.python.keras.layers import Dropout, Dense, BatchNormalization"** by **"from keras.layers import Dropout, Dense, BatchNormalization"**. – frédéric chantrel Mar 25 '19 at 20:18
  • Please post this as an answer, not a comment. – chrisinmtown Mar 26 '19 at 00:01

1 Answers1

0

If someone has the same error, this error indicates that we have to add "tf.enable_eager_execution()". But when this is done we encounter another error. To solve the problem I had to replace "from tensorflow.python.keras.models import Sequential, ..." by "from keras.models import Sequential, ..." and "from tensorflow.python.keras.layers import Dropout, Dense, BatchNormalization" by "from keras.layers import Dropout, Dense, BatchNormalization".

  • Please post a small piece of code that shows what works, much easier to get it right if people see that and can copy/paste. – chrisinmtown Mar 27 '19 at 17:55
  • I have the imports as you say: from keras.models import Sequential from keras.layers import Dropout, Dense, BatchNormalization but I also got this error: NotImplementedError: numpy() is only available when eager execution is enabled. – Jorge Jiménez Oct 23 '19 at 15:38