(examples)
| 131 | padding = "max_length" if args.pad_to_max_length else False |
| 132 | |
| 133 | def tokenize_function(examples): |
| 134 | # Remove empty lines |
| 135 | examples[text_column_name] = [ |
| 136 | line for line in examples[text_column_name] if len(line) > 0 and not line.isspace() |
| 137 | ] |
| 138 | return tokenizer( |
| 139 | examples[text_column_name], |
| 140 | padding=padding, |
| 141 | truncation=True, |
| 142 | max_length=max_seq_length, |
| 143 | # We use this option because DataCollatorForLanguageModeling (see below) is more efficient when it |
| 144 | # receives the `special_tokens_mask`. |
| 145 | return_special_tokens_mask=True, |
| 146 | ) |
| 147 | |
| 148 | with accelerator.main_process_first(): |
| 149 | tokenized_datasets = raw_datasets.map( |
nothing calls this directly
no outgoing calls
no test coverage detected