Shortcuts

ChatFormat

class torchtune.data.ChatFormat[source]

Warning

This class is deprecated and will be removed in a future release. Please use PromptTemplate for custom chat formats.

Interface for chat formats. Each chat format should include tags for system, user, and assistant roles that are prepended or appended to the message content.

abstract classmethod format(sample: List[Message]) List[Message][source]

Format each role’s message(s) according to the chat format

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