Update modeling_super_linear.py
Browse files525 unmodified lines526527528529530531532533534535536537538539540541542543544545546525 unmodified lines# backbone returns (B, pred_len, C)preds = self.backbone(x_enc)print(F"preds shape: {preds.shape}")#preds = preds[0]print(F"preds shape: {preds.shape}")# if we keep continuous values, treat them as logits directlylogits = (preds if self.vocab_size is None else self.lm_head(preds).transpose(1, 2))loss = Noneif labels is not None:# shift for causal objectiveshift_logits = logits[..., :-1, :].contiguous()shift_labels = labels[..., 1:].contiguous()loss = F.cross_entropy(shift_logits.view(-1, shift_logits.size(-1)), shift_labels.view(-1))return CausalLMOutputWithCrossAttentions(loss=loss,logits=logits,past_key_values=None,hidden_states=None,attentions=None,)def prepare_inputs_for_generation(self, inputs_embeds, past_key_values=None, **kwargs):525 unmodified lines526527528529530531532525 unmodified lines# backbone returns (B, pred_len, C)preds = self.backbone(x_enc)return CausalLMOutputWithCrossAttentions(loss=None,logits=preds,past_key_values=None,hidden_states=None,attentions=None,)def prepare_inputs_for_generation(self, inputs_embeds, past_key_values=None, **kwargs):
modeling_super_linear.py+1-15