kochlisGit / ProphitBet-Soccer-Bets-Predictor

ProphitBet is a Machine Learning Soccer Bet prediction application. It analyzes the form of teams, computes match statistics and predicts the outcomes of a match using Advanced Machine Learning (ML) methods. The supported algorithms in this application are Neural Networks, Random Forests & Ensembl Models.
MIT License
312 stars 113 forks source link

NN-Training with tensorflow-metal slower than without #38

Open ZockerFox opened 1 year ago

ZockerFox commented 1 year ago

Hi,

i got a new Macbook Air with the M2 Chip. To use it, i have to install tensowflow-metal. The GPU is recognized, but the Training takes longer than with the CPU only. With GPU:

` 2023-10-02 10:47:29.111865: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:114] Plugin optimizer for device_type GPU is enabled.

170/170 [==============================] - ETA: 0s - loss: 8.5763 - accuracy: 0.3513 2023-10-02 10:47:53.714029: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:114] Plugin optimizer for device_type GPU is enabled.

170/170 [==============================] - 28s 119ms/step - loss: 8.5763 - accuracy: 0.3513 - val_loss: 6.3053 - val_accuracy: 0.4400 - lr: 7.0000e-04 Epoch 2/80 `

With CPU:

` Epoch 4/80 22/22 [==============================] - 0s 1ms/step - loss: 1.9838 - accuracy: 0.3166 - val_loss: 1.3517 - val_accuracy: 0.3200 - lr: 1.0000e-04 Epoch 5/80

22/22 [==============================] - 0s 998us/step - loss: 1.8961 - accuracy: 0.3321 - val_loss: 1.3421 - val_accuracy: 0.4000 - lr: 1.0000e-04 Epoch 6/80 ` I tried the example from here https://developer.apple.com/metal/tensorflow-plugin/ and that was significant faster.

Anybody an Idea what to change?