Open parkesb opened 3 years ago
hello, I have run into the same issue, have you got the solution?
No, but I've not looked at it. It also fails if you try and switch the order (i.e. predict and then evaluate)
Same problem on my M1 Mac:
(m1) $ python tf_m1_eval_predict_test.py
loading data...
creating model...
model.fit()...
2021-05-11 16:23:49.023920: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:116] None of the MLIR optimization passes are enabled (registered 2)
2021-05-11 16:23:49.025618: W tensorflow/core/platform/profile_utils/cpu_utils.cc:126] Failed to get CPU frequency: 0 Hz
Epoch 1/5
1875/1875 [==============================] - 1s 331us/step - loss: 0.6303 - accuracy: 0.7810
Epoch 2/5
1875/1875 [==============================] - 1s 326us/step - loss: 0.3850 - accuracy: 0.8613
Epoch 3/5
1875/1875 [==============================] - 1s 324us/step - loss: 0.3423 - accuracy: 0.8760
Epoch 4/5
1875/1875 [==============================] - 1s 323us/step - loss: 0.3148 - accuracy: 0.8864
Epoch 5/5
1875/1875 [==============================] - 1s 321us/step - loss: 0.2973 - accuracy: 0.8904
model.evaluate()...
313/313 [==============================] - 0s 234us/step - loss: 0.3342 - accuracy: 0.8781
model.predict()...
2021-05-11 16:23:52.478149: I tensorflow/compiler/tf2mlcompute/kernels/mlc_subgraph_op.cc:326] Compute: Failed in processing TensorFlow graph sequential/MLCSubgraphOp_2_0 with frame_id = 0 and iter_id = 0 with error: Internal: ExecuteMLCInferenceGraph: Failed to execute MLC inference graph. (error will be reported 5 times unless TF_MLC_LOGGING=1).
2021-05-11 16:23:52.480338: F tensorflow/core/framework/op_kernel.cc:983] Check failed: outputs_[index].tensor == nullptr (0x14b617f70 vs. nullptr)
Abort trap: 6
If I run either one of model.evaluate() or model.predict(), then it is fine.
1875/1875 [==============================] - 1s 325us/step - loss: 0.2924 - accuracy: 0.8936
model.predict()...
classifications: [2.3991666e-05 1.9442258e-07 2.4191124e-06 3.0609449e-06 2.1939153e-05
2.4558472e-02 5.9402762e-05 7.7641018e-02 2.1327533e-04 8.9747626e-01]
1875/1875 [==============================] - 1s 330us/step - loss: 0.2968 - accuracy: 0.8891
model.evaluate()...
313/313 [==============================] - 0s 235us/step - loss: 0.3537 - accuracy: 0.8694
test_labels: 9
Looks like there is code error when using both functions in sequence.
Experiencing the same problem as well (MacBook Pro 13-inch, 2020, Quad-Core Intel Core i5).
The problem occurs with both CPU and GPU, using mlcompute.set_mlc_device(device_name="gpu")
https://github.com/apple/tensorflow_macos/issues/266#issue-895279506 Check this issue and its solution Might help
It seems the culprit here is the specified activation function of the output layer. Once this parameter is removed, the code works fine. Edit: linear for output layer works fine, sigmoid doesn't
A strange issue when running an example from Laurence Moroney's "AI and Machine Learning for Coders...". When running the following code on an M1 MacBook Air
I have the following output:
whereas on a 2017 Intel MBP, I have:
Also, if I remove either the
model.predict
or themodel.evaluate
the code produces correct output and no errors.I'm using regular python virtual envs on the MBP but Miniforge on the MacBook Air
Tensorflow package differences are as follows: