tensor2tensor icon indicating copy to clipboard operation
tensor2tensor copied to clipboard

*help* Merge transformer with other layers

Open Danysolism opened this issue 8 years ago • 3 comments

Hi,

I would like to create a new model that uses the transformer encoder and decoder. However, it also needs to include layers in between and the decoder needs to use not only the output of the transformer but also the output of the other layers. Do you have some advice or guide on the best way to do this? Perhaps generate a new T2T model? also, it's not clear for me where would I define the graph of the model?

Thank you, Daniela

Danysolism avatar May 02 '18 08:05 Danysolism

Yes, create your own subclass of T2TModel. See the definition of Transformer as a guide. You typically only need to override body.

rsepassi avatar May 04 '18 02:05 rsepassi

Hi rsepassi,

Thank you for your answer. I created a new T2TModel subclass following the definition of Transformer and decorate it with registry.register_model. I imported it in init.py and I try to run it using the --t2t_usr_dir flag. In my user dir I have the following files: queries.py (problem definition) query_transformer.py (submodel) __init__.py (with from . import queries and from . import query_transformer) However, I'm getting the following error: LookupError: Model query_transformer never registered. Available models.

Do you happen to know the common errors I could be making or do you have any suggestion of a T2TModel class besides Transformer I could use as guide for my problem?

Thank you.

Danysolism avatar May 10 '18 19:05 Danysolism

please see the example_usr_dir in tensor2tensor/test_data and try to match its general structure On Thu, May 10, 2018 at 12:39 PM Daniela Solís [email protected] wrote:

Hi rsepassi,

Thank you for your answer. I created a new T2TModel subclass following the definition of Transformer and decorate it with registry.register_model. I imported it in init.py and I try to run it using the --t2t_usr_dir flag. In my user dir I have the following files: queries.py (problem definition) query_transformer.py (submodel) init.py (with from . import queries and from . import query_transformer) However, I'm getting the following error: LookupError: Model query_transformer never registered. Available models.

Do you happen to know the common errors I could be making or do you have any suggestion of a T2TModel class besides Transformer I could use as guide for my problem?

Thank you.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tensorflow/tensor2tensor/issues/762#issuecomment-388162544, or mute the thread https://github.com/notifications/unsubscribe-auth/ABEGW49_6ziPEk2Mx1ezE1Uk6y4oj_i1ks5txJeJgaJpZM4TvEfE .

rsepassi avatar May 10 '18 20:05 rsepassi