Update modeling_super_linear.py
Browse files223 unmodified lines224225226227228229230231232233234235236237238239240241242243244223 unmodified linesself.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=( new_lookback,self.seq_len), # (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_W223 unmodified lines224225226227228229230231232233234235236237238239240241242243244245246247248249250223 unmodified linesself.zero_shot_Linear = new_W # shape (self.horizon, new_lookback)else:W = self.Linear.weight.detach() # (out_features, seq_len)# 1️⃣ keep the last `new_lookback` columnsW_tail = W[:, -new_lookback:] # (out_features, new_lookback)# 2️⃣ resize those columns back to `seq_len`# ─ use 4-D shape (N=1, C=1, H=out, W=new_lookback)W4d = W_tail.unsqueeze(0).unsqueeze(0)new_W = F.interpolate(W4d,size=(out_features, self.seq_len), # keep rows = out_features,# stretch cols to seq_lenmode='bilinear',align_corners=False)[0, 0] # → (out_features, seq_len)# 3️⃣ concatenate on the column axisW_now = torch.cat((W_tail, new_W), dim=1) # (out_features, new_lookback + seq_len)self.zero_shot_Linear = W_now
modeling_super_linear.py+16-10