# prompt_strategies.orpo.chat_template

`prompt_strategies.orpo.chat_template`

chatml prompt tokenization strategy for ORPO

## Classes

Name | Description
--- | ---
Message | message/turn
MessageList | conversation
ORPODatasetParsingStrategy | Strategy to parse chosen rejected dataset into messagelist
ORPOPrompter | Single Turn prompter for ORPO
ORPOTokenizingStrategy | rejected_input_ids

### Message

    prompt_strategies.orpo.chat_template.Message()

message/turn

### MessageList

    prompt_strategies.orpo.chat_template.MessageList()

conversation

### ORPODatasetParsingStrategy

    prompt_strategies.orpo.chat_template.ORPODatasetParsingStrategy()

Strategy to parse chosen rejected dataset into messagelist

#### Methods

Name | Description
--- | ---
get_chosen_conversation_thread | Dataset structure mappings
get_prompt | Map the data to extract everything up to the last turn
get_rejected_conversation_thread | Dataset structure mappings

##### get_chosen_conversation_thread

    prompt_strategies.orpo.chat_template.ORPODatasetParsingStrategy.get_chosen_conversation_thread(
        prompt,
    )

Dataset structure mappings

##### get_prompt

    prompt_strategies.orpo.chat_template.ORPODatasetParsingStrategy.get_prompt(
        prompt,
    )

Map the data to extract everything up to the last turn

##### get_rejected_conversation_thread

    prompt_strategies.orpo.chat_template.ORPODatasetParsingStrategy.get_rejected_conversation_thread(
        prompt,
    )

Dataset structure mappings

### ORPOPrompter

    prompt_strategies.orpo.chat_template.ORPOPrompter(
        self,
        chat_template,
        tokenizer,
    )

Single Turn prompter for ORPO

### ORPOTokenizingStrategy

    prompt_strategies.orpo.chat_template.ORPOTokenizingStrategy(
        self,
        *args,
        dataset_parser=None,
        **kwargs,
    )

rejected_input_ids input_ids rejected_attention_mask attention_mask rejected_labels labels

## Functions

Name | Description
--- | ---
load | chatml transforms for datasets with system, input, chosen, rejected

### load

    prompt_strategies.orpo.chat_template.load(tokenizer, cfg, ds_cfg=None, **kwargs)

chatml transforms for datasets with system, input, chosen, rejected