Shortcuts

torchtune.data

Instruct templates

InstructTemplate

Interface for instruction templates.

AlpacaInstructTemplate

Prompt template for Alpaca-style datasets.

GrammarErrorCorrectionTemplate

Prompt template for grammar correction datasets.

SummarizeTemplate

Prompt template to format datasets for summarization tasks.

Chat formats

ChatFormat

Interface for chat formats.

ChatMLFormat

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

Llama2ChatFormat

Chat format that formats human and system prompts with appropriate tags used in Llama2 pre-training.

MistralChatFormat

Formats according to Mistral's instruct model.

Types

Message

This dataclass represents individual messages in an instruction or chat dataset.

Converters

sharegpt_to_llama2_messages

Convert a chat sample adhering to the ShareGPT format to the Llama2 chat format.

Helper funcs

validate_messages

Given a list of messages, ensure that messages form a valid back-and-forth conversation.

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