Keras model not recognised as functional (pruning)

I am building a functional Keras model using TensorFlow version 2.9.1, and attempting to use tensorflow-model-optimization to apply pruning. Specifically, the model is YOLOv5’s Keras variant with the layers modified to be PrunableLayer instances.

The model is constructed in a functional manner as can be seen here: https://github.com/ultralytics/yolov5/blob/master/export.py#L314

However, when attempting to apply pruning, this error is produced: prune_low_magnitude can only prune an object of the following types: tf.keras.models.Sequential, tf.keras functional model, tf.keras.layers.Layer, list of tf.keras.layers.Layer. You passed an object of type: Model.

Why is my model not qualifying as a functional Keras model for this purpose? Are there particular additional requirements for it to qualify?

I am Facing similar type of problem, I am still searching for some proper solution Same issue still no fix to this.

Is your problem when attempting to apply pruning also? I am planning on attempting to reproduce the error with a simpler than YOLOv5 model if I get time today