cerebras.modelzoo.data_preparation.data_preprocessing.hooks.dpo_read_hook#

cerebras.modelzoo.data_preparation.data_preprocessing.hooks.dpo_read_hook(example, **read_hook_kwargs)[source]#

Transforms data for the Direct Preference Optimization (DPO) task into a semantic data array format.

Parameters
  • example (Dict[str, Any]) – The input example data.

  • **read_hook_kwargs (Any) – Additional keyword arguments containing data_keys.

Returns

Transformed data suitable for the DPO task.

Return type

List[Dict[str, Any]]

Raises

AssertionError – If required keys are not provided in read_hook_kwargs.