Shortcuts

Llama2ChatFormat

class torchtune.data.Llama2ChatFormat[source]

Chat format that formats human and system prompts with appropriate tags used in LLaMA2 pre-training. Taken from Meta’s official LLaMA inference repository.

Example

"[INST] <<SYS>>
You are a helpful, respectful and honest assistant.
<</SYS>>"

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

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