Shortcuts

MistralChatFormat

class torchtune.data.MistralChatFormat[source]

Formats according to Mistral’s instruct model.

It is identical to Llama2ChatFormat, except it does not support system prompts.

Example

"[INST] I am going to Paris, what should I see? [/INST] Paris, the capital
of France, is known for its stunning architecture..."
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

Raises:

ValueError – If system prompts are provided

system = None

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