MCPcopy Create free account
hub / github.com/AMAP-ML/EMF / tokenize

Function tokenize

trl/examples/scripts/rloo/rloo_tldr.py:106–112  ·  view source on GitHub ↗
(element)

Source from the content-addressed store, hash-verified

104 """pre-tokenize the dataset before training; only collate during training"""
105
106 def tokenize(element):
107 input_ids = tokenizer.apply_chat_template(
108 element["messages"][:1],
109 padding=False,
110 add_generation_prompt=True,
111 )
112 return {"input_ids": input_ids, "lengths": len(input_ids)}
113
114 return dataset.map(
115 tokenize,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected