GoogleCloudPlatform / mlops-with-vertex-ai

An end-to-end example of MLOps on Google Cloud using TensorFlow, TFX, and Vertex AI
Apache License 2.0
348 stars 120 forks source link

Error: 02 - ML Experimentation with Custom Model #12

Closed jarmstrongcorus closed 2 years ago

jarmstrongcorus commented 2 years ago

Hi I'm running the tutorial with TFX 1.4.0 and TF 2.7.0.

When I run the cell classifier = model.create_binary_classifier(tft_output, hyperparams) classifier.summary()

I get the error:


ValueError Traceback (most recent call last)

in ----> 1 classifier = model.create_binary_classifier(tft_output, hyperparams) 2 classifier.summary() ~/mlops-with-vertex-ai/src/model_training/model.py in create_binary_classifier(tft_output, hyperparams) 83 ) 84 ---> 85 return _create_binary_classifier(feature_vocab_sizes, hyperparams) ~/mlops-with-vertex-ai/src/model_training/model.py in _create_binary_classifier(feature_vocab_sizes, hyperparams) 62 pass 63 ---> 64 joined = keras.layers.Concatenate(name="combines_inputs")(layers) 65 feedforward_output = keras.Sequential( 66 [ /opt/conda/lib/python3.7/site-packages/keras/utils/traceback_utils.py in error_handler(*args, **kwargs) 65 except Exception as e: # pylint: disable=broad-except 66 filtered_tb = _process_traceback_frames(e.__traceback__) ---> 67 raise e.with_traceback(filtered_tb) from None 68 finally: 69 del filtered_tb /opt/conda/lib/python3.7/site-packages/keras/layers/merge.py in build(self, input_shape) 514 ranks = set(len(shape) for shape in shape_set) 515 if len(ranks) != 1: --> 516 raise ValueError(err_msg) 517 # Get the only rank for the set. 518 (rank,) = ranks ValueError: A `Concatenate` layer requires inputs with matching shapes except for the concatenation axis. Received: input_shape=[(None, 2), (None, 4), (7,), (None, 3), (None, 1), (None, 1), (6,), (None, 3), (None, 3), (None, 1), (None, 10)]
ksalama commented 2 years ago

The tutorial - as of now - is tested on TFX 1.2 and TensorFlow 2.5

There is an issue to test it and upgrade it to later TFX/TF versions