Skip to content

Commit

Permalink
minor change
Browse files Browse the repository at this point in the history
  • Loading branch information
parmeet committed Nov 24, 2021
1 parent db7b6db commit 157da8b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions torchtext/models/roberta/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __init__(
return_all_layers=False,
)

self.project = None
self.project = nn.Identity()
if projection_dim is not None:
self.project = ProjectionLayer(embed_dim=embedding_dim, projection_dim=projection_dim, dropout=projection_dropout)

Expand All @@ -83,8 +83,7 @@ def forward(self, tokens: Tensor, mask: Optional[Tensor] = None) -> Tensor:
if mask is not None:
output = output[mask.to(torch.bool), :]

if self.project is not None:
output = self.project(output)
output = self.project(output)

return output

Expand Down

0 comments on commit 157da8b

Please sign in to comment.