Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support decoder-only arch in the factory #744

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion xformers/factory/model_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,9 @@ def forward(

if not self.decoders:
return memory
else:
# Decoder-only
memory = src

# If decoder: either use the encoder ouput, or just decode, both options are possible
if len(self.decoders) > 0:
Expand All @@ -300,7 +303,6 @@ def forward(
for decoder in self.decoders:
tgt = decoder(
target=tgt,
# pyre-fixme[61]: `memory` is not always initialized here.
memory=memory,
input_mask=decoder_input_mask,
)
Expand Down