MCPcopy Create free account
hub / github.com/THUDM/GLM / _create_examples

Method _create_examples

tasks/superglue/dataset.py:1342–1353  ·  view source on GitHub ↗
(self, path: str, set_type: str)

Source from the content-addressed store, hash-verified

1340 return self._create_examples(data_dir, "test")
1341
1342 def _create_examples(self, path: str, set_type: str) -> List[InputExample]:
1343 examples = []
1344 for relation in self.relations:
1345 template = self.relation_meta[relation]['template']
1346 with open(os.path.join(path, f"{relation}/{set_type}.jsonl")) as f:
1347 for i, line in enumerate(f):
1348 obj = json.loads(line)
1349 text = template.replace("[X]", obj["sub_label"])
1350 guid = f"{set_type}-{relation}-{i}"
1351 example = InputExample(guid=guid, text_a=text, meta={'answer': obj['obj_label']})
1352 examples.append(example)
1353 return examples
1354
1355
1356class CLUEWSCProcessor(DataProcessor):

Callers 3

get_train_examplesMethod · 0.95
get_dev_examplesMethod · 0.95
get_test_examplesMethod · 0.95

Calls 2

InputExampleClass · 0.90
appendMethod · 0.80

Tested by

no test coverage detected