Skip to content

xlm.tasks.dream_code_adaptation

reset_dream_code_adaptation_debug_first_example_filter_fn()

Reset dream_code_adaptation_debug_first_example_filter_fn state (for tests).

dream_code_adaptation_debug_first_example_filter_fn(example)

Keep only the first dream_code_adaptation row when building debug manual caches.

Used with filter_suffix debug_one in the dream_code_adaptation debug dataset configs. The kept row is remembered by its prompt, so later passes over the same split (e.g. the debug_one_pred cache) select the same row. Run prepare_data with num_dataset_workers=1 so Dataset.filter is single-process; multiprocessing can drop or duplicate rows.

dream_code_adaptation_preprocess_fn(example, tokenizer, *, sep='\n')

Tokenize dream_code_adaptation rows into prompt/target token id lists.

Parameters:

Name Type Description Default
example Dict[str, Any]

HF row with prompt and answer fields.

required
tokenizer Any

Hugging Face tokenizer (encode, no special tokens).

required
sep str

String between prompt and answer.

'\n'

dream_code_adaptation_pred_preprocess_fn(example, tokenizer, *, sep='\n')

Prediction rows: prompt prefix, empty target, reference kept in answer.