(element)
| 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, |
nothing calls this directly
no outgoing calls
no test coverage detected