MCPcopy Create free account
hub / github.com/OpenGVLab/EfficientQAT / __init__

Method __init__

deita_dataset/train.py:263–282  ·  view source on GitHub ↗
(self, raw_data, tokenizer: transformers.PreTrainedTokenizer, conv_template = "vicuna-1.1", mask_user = True)

Source from the content-addressed store, hash-verified

261 """Dataset for supervised fine-tuning."""
262
263 def __init__(self, raw_data, tokenizer: transformers.PreTrainedTokenizer, conv_template = "vicuna-1.1", mask_user = True):
264 super(SupervisedDataset, self).__init__()
265
266 rank0_print("Formatting inputs...")
267 sources = [example["conversations"] for example in raw_data]
268 data_dict = preprocess(sources, tokenizer, conv_template, mask_user)
269
270 if mask_user:
271 rank0_print(
272 f"WARNING: The loss of user prompt will be masked"
273 )
274 else:
275 rank0_print(
276 f"WARNING: The loss of user prompt will **NOT** be masked"
277 )
278
279
280 self.input_ids = data_dict["input_ids"]
281 self.labels = data_dict["labels"]
282 self.attention_mask = data_dict["attention_mask"]
283
284 def __len__(self):
285 return len(self.input_ids)

Callers 1

__init__Method · 0.45

Calls 2

rank0_printFunction · 0.85
preprocessFunction · 0.85

Tested by

no test coverage detected