lucidrains / block-recurrent-transformer-pytorch Goto Github PK
View Code? Open in Web Editor NEWImplementation of Block Recurrent Transformer - Pytorch
License: MIT License
Implementation of Block Recurrent Transformer - Pytorch
License: MIT License
def generate(
self,
prime,
length = None,
xl_memories: List[torch.Tensor] = [],
states: List[torch.Tensor] = [],
temperature = 1.,
filter_thres = 0.9,
return_memories_and_states = False
):
length = default(length, self.max_seq_len + 1)
start_len = prime.shape[-1]
assert start_len < self.max_seq_len
assert length <= (self.max_seq_len + 1)
assert start_len < length
output = prime
memories = []
states = []
for ind in range(length - start_len):
Is it supposed to detach?
Inside block_recurrent_transformer_pytorch.py line 815
if exists(layer_next_states):
next_states.append(layer_next_states.detach())
How would the gradients flow through the states?
Hi, i noticed that recurrent state keys and values are derived from self.init_state rather than previous recurrent state. In this case, the keys and value embedding layers, along with the projection and MLP layers for horizontal attention will not be trained? I am not sure if this is the intended behavior as I could not find any details regarding this in the paper.
Hello, I believe there is a typo in the "Install" section of the readme.
Instead of:
pip install block-recurrent-transformer
I used this:
pip install block-recurrent-transformer-pytorch
Can you try to input the recurrent state to the first transformer layer? Like a recurrent layer but without next state? Maybe that will improve the performance since high level representations don't have to be recomputed and remembered info can be passed through the whole model again without any additional compute cost
Hi, in the AttentionBlock forward function, the vertical attention is computing cross-attention with Qe^v instead of Qs^v? Same goes for the horizontal direction, it is computing using Qs^h instead of Qe^h.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.