当我尝试用acumos生成一个模型时,我得到了这个错误:
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.是否与acumos的numpy不兼容?
下面是我的一段代码:
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发布于 2019-03-28 01:45:20
如果有人有同样的错误,这个错误表明我们必须添加"tf.enable_eager_execution()“。但是,当完成此操作时,我们会遇到另一个错误。为了解决这个问题,我不得不替换“从tensorflow.python.keras.models导入顺序,...”by“从keras.models导入顺序,...”和“从tensorflow.python.keras.layers导入Dropout,Dense,BatchNormalization”由“从keras.layers导入Dropout,Dense,BatchNormalization”。
https://stackoverflow.com/questions/55301023
复制相似问题