Skip to content
This repository has been archived by the owner on Jul 7, 2023. It is now read-only.

Fixed bug in _target_modality_is_real #1550

Merged
merged 1 commit into from
Apr 25, 2019

Conversation

souramoo
Copy link
Contributor

@souramoo souramoo commented Apr 19, 2019

I was training a transformer model with a real-value output. I had my problems file set up properly, but when using .infer to load a trained model checkpoint and use it to run inference on some input, I was getting very obscure errors to do with tensor sizes. After some debugging it became apparent that the tensor2tensor framework was trying to look for a class to output, and did not accept that I wanted a real-valued output.

Turns out this is due to a small typo in t2t_model - when checking if the output modality is real, it decided it was not and this caused the decoder part of the library to use fast_decode rather than the slow version that seems suitable for real valued predictions. It checks if the output modality name begins with "Real_" to determine this.

Unfortunately, the name of these output modalities are things like real_l2_loss_modality with a lowercase r...

Hope this helps other people with the same issue!

@googlebot googlebot added the cla: yes PR author has signed CLA label Apr 19, 2019
@afrozenator
Copy link
Contributor

Wow! Thanks a lot @MOOSD ! Will merge in shortly!

@afrozenator afrozenator merged commit f58e378 into tensorflow:master Apr 25, 2019
tensorflow-copybara pushed a commit that referenced this pull request Apr 25, 2019
PiperOrigin-RevId: 245279496
@ashu5644
Copy link

ashu5644 commented Jun 25, 2019

Hi, @MOOSD, I have trained a language model based on transformer using t2t. I am trying to do inference using model.infer() method by using tf.session() and feed_dict method in tensorflow but I am getting random outputs each time I run model.infer(). Can you suggest how did you do inference using .infer method instead of using estimator.predict() ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes PR author has signed CLA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants