SFT, Instruction Tuning, Data & PEFT · Problem 3 of 6
Implement sequence packing with a block-diagonal attention mask so packed samples can't attend across boundaries.
Implement the function/class skeleton in the editor. Any correct approach is accepted.
import torch
def pack(samples, max_len, pad_id=0):
raise NotImplementedError
def block_diagonal_mask(seg_ids):
raise NotImplementedErrorReady when you are
Submit your solution and a structured review appears here — verdict, score, and concrete feedback. Any correct approach passes.
Implement sequence packing with a block-diagonal attention mask so packed samples can't attend across boundaries.
Implement the function/class skeleton in the editor. Any correct approach is accepted.