Update modeling_super_linear.py
Browse files223 unmodified lines224225226227228229230231227228229230231232233234235236237234238239240241237238239240242243244245246247248249250223 unmodified lines
self.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_lookback W = self.Linear.weight.detach() # (out_features, seq_len) # 1️⃣ keep the last `new_lookback` columns W_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=( new_lookback,self.seq_len), # (H_out, W_out) size=(out_features, self.seq_len), # keep rows = out_features, # stretch cols to seq_len mode='bilinear', align_corners=False )[0, 0] # drop the two singleton dims
W_now = torch.cat((W, new_W), dim=1) self.zero_shot_Linear = new_W )[0, 0] # → (out_features, seq_len) # 3️⃣ concatenate on the column axis W_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