Shortcuts

ChatFormat

class torchtune.data.ChatFormat[source]

Interface for chat formats. Each chat format should include template prompts with placeholders for the data inputs. There should be a template for each role: system, user, assistant.

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