bert icon indicating copy to clipboard operation
bert copied to clipboard

how to implement the Bidirectional Transformer?

Open robotzheng opened this issue 8 years ago • 1 comments

any clues? thanks.

robotzheng avatar Nov 01 '18 02:11 robotzheng

Not sure exactly what you're asking, but the core Transformer implementation is in modeling.py

Which is based on the one from tensor2tensor (but with less abstraction) and Attention is All You Need

If you're wondering how to instantiate a new instance, you can see run_classifier.py

The Transformer is also bidirectional "by default", it requires special masking to make it unidirectional (see here in OpenAI's transformer implementation on how that is done, although it's not needed for BERT).

jacobdevlin-google avatar Nov 01 '18 02:11 jacobdevlin-google