Shortcuts

ChatMLFormat

class torchtune.data.ChatMLFormat[source]

OpenAI’s Chat Markup Language used by their chat models.

It is the default chat format used by Hugging Face models.

<|im_start|>system
Provide some context and/or instructions to the model.<|im_end|>
<|im_start|>user
The user’s message goes here<|im_end|>
<|im_start|>assistant
The assistant’s response goes here<|im_end|>
classmethod format(sample: List[Message]) List[Message][source]

Format user and system messages with appropriate tags.

Parameters:

sample (List[Message]) – a single conversation, structured as a list of Message objects

Returns:

The formatted list of messages

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources