Skip to content

xlm.tasks.gram_n_queens

Preprocessing for brozonoyer/gram-n-queens.

Dataset has "input" (partial board) and "target" (complete solution). Vocabulary: 0=pad, 1=empty, 2=queen. We produce input_token_ids (target) and prompt_token_ids (input with empty→mask).

Token ids use SimpleSpaceTokenizer.for_numbers like sudoku_extreme (via _convert_token_to_id(str(v))).

gram_n_queens_preprocess_fn(example, tokenizer)

Preprocess gram-n-queens examples.

Uses "input" (partial board) and "target" (complete solution). Empty cells (dataset 1) in the prompt are replaced with mask_token_id so the model knows which positions to predict.

gram_n_queens_filter_8x8(example)

Keep only 8×8 boards (fixed sequence length for batching).

gram_n_queens_filter_10x10(example)

Keep only 10×10 boards (fixed sequence length for batching).