MCPcopy Create free account
hub / github.com/OpenMOSS/rope_pp / EvaluatingDataset

Class EvaluatingDataset

utils/dataset_utils.py:191–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

189
190
191class EvaluatingDataset(torch.utils.data.Dataset):
192
193 def __init__(self, dataset, tokenizer, label_name, valid_length=4096):
194
195 self.dataset = dataset
196 self.tokenizer = tokenizer
197 self.label_name = label_name
198
199 self.len = len(dataset)
200 self.valid_length = valid_length
201
202 def __len__(self):
203 return self.len
204
205 def __getitem__(self, idx):
206
207 sample = self.dataset[idx]
208 inputs = self.tokenizer(sample[self.label_name], truncation=True,
209 max_length=self.valid_length, padding='max_length')
210 inputs.update({'labels': inputs['input_ids']})
211
212 return inputs

Callers 10

train_fope.pyFile · 0.90
train_alibi.pyFile · 0.90
train_pythia.pyFile · 0.90
train_rope_pp.pyFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected