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

Tensorflow 2.10.0 and Decision Forests (DF) 1.0.0 - AttributeError: module 'tensorflow_decision_forests.tensorflow.ops.training.op' has no attribute 'simple_ml_categorical_string_feature' #130

Closed AnushangaWimalasena closed 2 years ago

AnushangaWimalasena commented 2 years ago

Today I have updated my tf version and decision forest version to the latest and tried to run. But an error occurred. Then I tried it on their official colab notebook. But the unfortunately same error show here also. Any help would be greatly appreciated

`Use 2 thread(s) for training Use /tmp/tmpz51of_w9 as temporary training directory Reading training dataset... Training tensor examples: Features: {'island': <tf.Tensor 'data_4:0' shape=(None,) dtype=string>, 'bill_length_mm': <tf.Tensor 'data_1:0' shape=(None,) dtype=float64>, 'bill_depth_mm': <tf.Tensor 'data:0' shape=(None,) dtype=float64>, 'flipper_length_mm': <tf.Tensor 'data_3:0' shape=(None,) dtype=float64>, 'body_mass_g': <tf.Tensor 'data_2:0' shape=(None,) dtype=float64>, 'sex': <tf.Tensor 'data_5:0' shape=(None,) dtype=string>, 'year': <tf.Tensor 'data_6:0' shape=(None,) dtype=int64>} Label: Tensor("data_7:0", shape=(None,), dtype=int64) Weights: None Normalized tensor features: {'island': SemanticTensor(semantic=<Semantic.CATEGORICAL: 2>, tensor=<tf.Tensor 'data_4:0' shape=(None,) dtype=string>), 'bill_length_mm': SemanticTensor(semantic=<Semantic.NUMERICAL: 1>, tensor=<tf.Tensor 'Cast:0' shape=(None,) dtype=float32>), 'bill_depth_mm': SemanticTensor(semantic=<Semantic.NUMERICAL: 1>, tensor=<tf.Tensor 'Cast_1:0' shape=(None,) dtype=float32>), 'flipper_length_mm': SemanticTensor(semantic=<Semantic.NUMERICAL: 1>, tensor=<tf.Tensor 'Cast_2:0' shape=(None,) dtype=float32>), 'body_mass_g': SemanticTensor(semantic=<Semantic.NUMERICAL: 1>, tensor=<tf.Tensor 'Cast_3:0' shape=(None,) dtype=float32>), 'sex': SemanticTensor(semantic=<Semantic.CATEGORICAL: 2>, tensor=<tf.Tensor 'data_5:0' shape=(None,) dtype=string>), 'year': SemanticTensor(semantic=<Semantic.NUMERICAL: 1>, tensor=<tf.Tensor 'Cast_4:0' shape=(None,) dtype=float32>)}

AttributeError Traceback (most recent call last) in 5 6 # Train the model. ----> 7 model_1.fit(x=train_ds)

16 frames /usr/local/lib/python3.7/dist-packages/tensorflow_decision_forests/tensorflow/core.py in if_body_2() 66 67 def if_body_2(): ---> 68 ag.converted_call(ag.ld(ops).append, (ag.converted_call(ag.ld(training_op).simple_ml_categorical_string_feature, (), dict(value=ag__.ld(semantic_tensor).tensor, id=ag.ld(input_id), feature_name=ag.ld(key)), fscope),), None, fscope) 69 70 def else_body_2():

AttributeError: in user code:

File "/usr/local/lib/python3.7/dist-packages/tensorflow_decision_forests/keras/core.py", line 1056, in _consumes_training_examples_until_eof  *
    num_examples += self.train_step(data)
File "/usr/local/lib/python3.7/dist-packages/tensorflow_decision_forests/keras/core.py", line 547, in _method_wrapper  *
    result = method(self, *args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/tensorflow_decision_forests/keras/core.py", line 548, in train_step  *
    return self.collect_data_step(data, is_training_example=True)
File "/usr/local/lib/python3.7/dist-packages/tensorflow_decision_forests/keras/core.py", line 547, in _method_wrapper  *
    result = method(self, *args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/tensorflow_decision_forests/keras/core.py", line 764, in collect_data_step  *
    tf_core.collect_training_examples(
File "/usr/local/lib/python3.7/dist-packages/tensorflow_decision_forests/tensorflow/core.py", line 297, in collect_training_examples  *
    ops.append(

AttributeError: module 'tensorflow_decision_forests.tensorflow.ops.training.op' has no attribute 'simple_ml_categorical_string_feature'

`

rstz commented 2 years ago

Hi, we apologize for this issue - it's been fixed with version 1.0.1 that was released minutes ago.