MCPcopy Create free account
hub / github.com/AIS-SNU/Smart-Infinity / process_files

Function process_files

DeepSpeedExample/tasks/ensemble_classifier.py:9–33  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

7
8
9def process_files(args):
10 all_predictions = collections.OrderedDict()
11 all_labels = collections.OrderedDict()
12 all_uid = collections.OrderedDict()
13 for path in args.paths:
14 path = os.path.join(path, args.prediction_name)
15 try:
16 data = torch.load(path)
17 for dataset in data:
18 name, d = dataset
19 predictions, labels, uid = d
20 if name not in all_predictions:
21 all_predictions[name] = np.array(predictions)
22 if args.labels is None:
23 args.labels = [i for i in range(all_predictions[name].shape[1])]
24 if args.eval:
25 all_labels[name] = np.array(labels)
26 all_uid[name] = np.array(uid)
27 else:
28 all_predictions[name] += np.array(predictions)
29 assert np.allclose(all_uid[name], np.array(uid))
30 except Exception as e:
31 print(e)
32 continue
33 return all_predictions, all_labels, all_uid
34
35
36def get_threshold(all_predictions, all_labels, one_threshold=False):

Callers 1

ensemble_predictionsFunction · 0.85

Calls 1

loadMethod · 0.45

Tested by

no test coverage detected