How to use the openai.train.dropout function in openai

To help you get started, we’ve selected a few openai examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Separius / BERT-keras / tests / test_transformer.py View on Github external
def model(X, train=False, reuse=False):
            with tf.variable_scope('model', reuse=reuse):
                we = tf.get_variable("we", [n_vocab + TextEncoder.SPECIAL_COUNT + n_ctx, n_embd],
                                     initializer=tf.random_normal_initializer(stddev=0.02))
                we = dropout(we, embd_pdrop, train)
                h = embed(X, we)
                for layer in range(n_layer):
                    h = block(h, 'h%d' % layer, train=train, scale=True)
                return h