tensorflow / decision-forests

A collection of state-of-the-art algorithms for the training, serving and interpretation of Decision Forest models in Keras.
Apache License 2.0
663 stars 110 forks source link

1.1.0 crash on MacOS (M2) #152

Closed rstz closed 3 months ago

rstz commented 1 year ago

Hi, in my Mac (M2) VSCode crashes always when run "import tensorflow_decision_forests as tfdf". I already reinstalled tensorflow (2.11.0), tensorflow-macos (2.11.0), tensorflow-metal (0.7.0) and tensorflow_decision_forests (1.1.0). Any clue?

"Canceled future for execute_request message before replies were done The Kernel crashed while executing code in the the current cell or a previous cell. Please review the code in the cell(s) to identify a possible cause of the failure. Click here for more info. View Jupyter log for further details."

Originally posted by @mtcdultra in https://github.com/tensorflow/decision-forests/issues/16#issuecomment-1373905354

rstz commented 1 year ago

Hi Marcos, thank you for your report. Can you please provide more information about the python environment you're using? It sounds like you're in VSCode with an IPython / Jupyter environment, but I want to make sure in order to reproduce this

mtcdultra commented 1 year ago

Hi Richard, yes, I´m using VSCode with Jupyter environment. And on Mac terminal, tried to use iPtyhon directly and crashed again: "zsh: illegal hardware instruction ipython".

Below is the code that I've tried run:

import pandas as pd import tensorflow as tf import tensorflow_decision_forests as tfdf

dataset_df = pd.read_csv("SP202102.csv", encoding='ISO-8859-1') print(dataset_df.head(3))

dataset_tf = tfdf.keras.pd_dataframe_to_tf_dataset(dataset_df, label="species")

model = tfdf.keras.RandomForestModel(compute_oob_variable_importances=True) model.fit(x=dataset_tf)

arnavrneo commented 1 year ago

Hi @mtcdultra,

Can you try downgrading the tensorflow-metal to ver 0.5.0 or lower?

rstz commented 1 year ago

Hi, sorry for taking a bit of time to get to this. It looks like tensorflow-metal is incompatible with TF-DF at this time. This is on our Todo list, but we will need additional investigation on our side.

@mtcdultra Can you confirm that it works if you uninstall tensorflow-metal?

Arnold1 commented 1 year ago

does this also apply to m1?

rstz commented 1 year ago

Yes, TF-DF is not compatible with tensorflow-metal on M1 processors. This is a tricky issue to solve AFAICT: Normal tensorflow and tensorflow-metal have different interfaces, but TF-DF only ships a single binary per OS / processor / python version on Pypi. Any ideas are very welcome!