def num_parameters(self, only_trainable: bool = False) -> int:
        """
        Get number of (optionally, trainable) parameters in the model.
        """
        if only_trainable:
            return int(sum(np.prod(w.shape.as_list()) for w in self.trainable_variables))
        else:
            return self.count_params()

        Get number of (optionally, trainable) parameters in the model.
        
xtune/src/transformers/modeling_tf_utils.py