tensorflow / text

Making text a first-class citizen in TensorFlow.
https://www.tensorflow.org/beta/tutorials/tensorflow_text/intro
Apache License 2.0
1.21k stars 333 forks source link

GenerateText method have no attribute model #1260

Open rishabhrahulcom opened 3 months ago

rishabhrahulcom commented 3 months ago

GenerateText method in "image_captioning" in https://www.tensorflow.org/text/tutorials/image_captioning have no attribute model.

Screenshot 2024-03-17 at 3 58 51 PM
rishabhrahulcom commented 3 months ago

Fixing it by adding a attribute _model in GenerateText() function

super().__init__() 
    self._model = None 
Screenshot 2024-03-17 at 4 02 17 PM

This will leads to type cast issue in masked_loss() function so casting it to int32. def masked_loss(labels, preds): labels = tf.cast(labels, tf.int32)