get_sharegpt_messages¶
- torchtune.data.get_sharegpt_messages(sample: Mapping[str, Any], train_on_input: bool = False) → List[Message][source]¶
Warning
This class is deprecated and will be removed in a future release. Please use
ShareGPTToMessages
instead. The following are equivalent:# Deprecated transformed_sample = get_sharegpt_messages(sample, train_on_input=True) # New transformed_sample = ShareGPTToMessages(train_on_input=True)(sample)
Convert a chat sample adhering to the ShareGPT json structure to torchtune’s
Message
structure.ShareGPT follows:
{ "conversations": [ { "from": <system|human|gpt>, "value": <message>, }, ... ] }
Message
follows:[ { "role": <system|user|assistant>, "content": <message>, }, ... ]