SFT, Instruction Tuning, Data & PEFT · Problem 1 of 6
Implement prompt-token loss masking given (prompt_len, total_len) per sample.
Implement the function/class skeleton in the editor. Any correct approach is accepted.
import torch
def build_labels(input_ids, prompt_len, total_len):
raise NotImplementedError
def masked_lm_loss(logits, labels):
raise NotImplementedErrorReady when you are
Submit your solution and a structured review appears here — verdict, score, and concrete feedback. Any correct approach passes.
Implement prompt-token loss masking given (prompt_len, total_len) per sample.
Implement the function/class skeleton in the editor. Any correct approach is accepted.