rotary-embedding-tensorflow · PyPI
pypi.org › project › rotary-embedding-tensorflowAug 28, 2021 · Usage. import tensorflow as tf from rotary_embedding_tensorflow import apply_rotary_emb, RotaryEmbedding # instantiate the positional embedding in your transformer and pass to all your attention layers pos_emb = RotaryEmbedding(dim = 32) # generate the rotations freqs = pos_emb(tf.range(1024), cache_key = 1024) # cache with a key that is the ...