no_grad for ctx_encoder model

This commit is contained in:
51616 2025-01-07 16:57:37 +00:00
parent 6c579fa373
commit 541ef37c64

View file

@ -321,6 +321,7 @@ class EarlyExit(nn.Module):
self.base_model = base_model
self.exit_layer = exit_layer
@torch.no_grad()
def forward(self, **kwargs):
# if len(kwargs["input_ids"].shape) == 1:
# kwargs["input_ids"] = kwargs["input_ids"].unsqueeze(0)