Update modeling_super_linear.py
Browse files209 unmodified lines2102112122132142152162175 unmodified lines223224225226227228209 unmodified linesnew_W = new_W * final_scalingself.zero_shot_Linear = new_Welse:W = self.Linear.weight.detach()W4d = W.unsqueeze(0).unsqueeze(0) # (1, 1, out, in)# resize H → self.horizon and W → new_lookback5 unmodified lines)[0, 0] # drop the two singleton dimsself.zero_shot_Linear = new_W # shape (self.horizon, new_lookback)209 unmodified lines2102112122132142152162175 unmodified lines223224225226227228229230231232233234235236237238239240241242243244209 unmodified linesnew_W = new_W * final_scalingself.zero_shot_Linear = new_Welif mode ==2:W = self.Linear.weight.detach()W4d = W.unsqueeze(0).unsqueeze(0) # (1, 1, out, in)# resize H → self.horizon and W → new_lookback5 unmodified lines)[0, 0] # drop the two singleton dimsself.zero_shot_Linear = new_W # shape (self.horizon, new_lookback)else:W = self.Linear.weight.detach()W = W[:, -new_lookback:]W4d = W.unsqueeze(0).unsqueeze(0) # (1, 1, out, in)# resize H → self.horizon and W → new_lookbacknew_W = F.interpolate(W4d,size=(self.seq_len , new_lookback), # (H_out, W_out)mode='bilinear',align_corners=False)[0, 0] # drop the two singleton dimsW_now = torch.cat((W, new_W), dim=1)self.zero_shot_Linear = new_W
modeling_super_linear.py+18-2