MCPcopy Create free account
hub / github.com/google-research/language / load_data

Function load_data

language/compir/utils/io_utils.py:46–61  ·  view source on GitHub ↗

Loads train and test data, and possibly loads predictions.

(train_data_path, test_data_path,
              prediction_path)

Source from the content-addressed store, hash-verified

44
45
46def load_data(train_data_path, test_data_path,
47 prediction_path):
48 """Loads train and test data, and possibly loads predictions."""
49 train_examples = _load_examples(train_data_path)
50 test_examples = _load_examples(test_data_path)
51 if prediction_path:
52 predictions = _load_predictions(prediction_path)
53 num_predictions = len(predictions)
54 num_test_examples = len(test_examples)
55 if num_predictions != num_test_examples:
56 raise RuntimeError(
57 "#predictions ({}) must equal #test_examples ({})!".format(
58 num_predictions, num_test_examples))
59 else:
60 predictions = None
61 return train_examples, test_examples, predictions
62
63
64def write_to_tsv(examples, output_filename):

Callers

nothing calls this directly

Calls 2

_load_examplesFunction · 0.85
_load_predictionsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…