Message¶
- class torchtune.data.Message(role: Literal['system', 'user', 'assistant'], content: str, masked: bool = False, ipython: bool = False, eot: bool = True)[source]¶
This dataclass represents individual messages in an instruction or chat dataset.
Note that the fields ipython and eot are only relevant when tokenizing with tiktoken, as they inform handling of special tokens in that case.
- Variables:
role (Role) – role of the message writer. Can be “system”, “user”, “assistant”.
content (str) – content of the message.
masked (bool) – whether the message is masked in the sample. Default: False
ipython (bool) – whether the message is an ipython call. Default: False
eot (bool) – whether the message corresponds to the end of a turn. Should be true except in the case of multiple consecutive assistant messages. Default: True