Skip to content

Commit 05ec799

Browse files
authored
Merge pull request #16 from thongonary/master
python3 compatible
2 parents a048deb + 884b584 commit 05ec799

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

MPIDriver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
### This script creates an MPIManager object and launches distributed training.
44

mpi_learn/mpi/process.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def print_metrics(self, metrics):
118118
"""Display metrics computed during training or validation"""
119119
names = self.model.metrics_names
120120
if len(names) == 1:
121-
print "%s: %.3f" % (names[0],metrics)
121+
print ("%s: %.3f" % (names[0],metrics))
122122
else:
123123
for name, metric in zip( names, metrics ):
124124
print ("{0}: {1:.3f}".format(name,metric))

mpi_learn/train/model.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def __init__(self, comm, filename=None,json_str=None, custom_objects={}, weights
3131
self.filename = filename
3232
self.json_str = json_str
3333
self.weights = weights
34-
self.custom_objects = custom_objects
34+
self.custom_objects = custom_objects
3535
super(ModelFromJson, self).__init__(comm)
3636

3737
def build_model(self):
@@ -51,7 +51,7 @@ def __init__(self, comm, filename=None, json_str=None, device_name='cpu',
5151
self.filename = filename
5252
self.json_str = json_str
5353
self.weights = weights
54-
self.custom_objects = custom_objects
54+
self.custom_objects = custom_objects
5555
self.device = self.get_device_name(device_name)
5656
super(ModelFromJsonTF, self).__init__(comm)
5757

@@ -66,11 +66,11 @@ def get_device_name(self, device):
6666
dev_num = int(device[3:])
6767
dev_type = 'gpu'
6868
except ValueError:
69-
print "GPU number could not be parsed from {}; using CPU".format(device)
69+
print ("GPU number could not be parsed from {}; using CPU".format(device))
7070
dev_num = 0
7171
dev_type = 'cpu'
7272
else:
73-
print "Please specify 'cpu' or 'gpuN' for device name"
73+
print ("Please specify 'cpu' or 'gpuN' for device name")
7474
dev_num = 0
7575
dev_type = 'cpu'
7676
return get_device_name(dev_type, dev_num, backend='tensorflow')

0 commit comments

Comments
 (0)