Skip to content

Commit

Permalink
Merge pull request #16 from thongonary/master
Browse files Browse the repository at this point in the history
python3 compatible
  • Loading branch information
duanders authored Jan 23, 2018
2 parents a048deb + 884b584 commit 05ec799
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion MPIDriver.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

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

Expand Down
2 changes: 1 addition & 1 deletion mpi_learn/mpi/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def print_metrics(self, metrics):
"""Display metrics computed during training or validation"""
names = self.model.metrics_names
if len(names) == 1:
print "%s: %.3f" % (names[0],metrics)
print ("%s: %.3f" % (names[0],metrics))
else:
for name, metric in zip( names, metrics ):
print ("{0}: {1:.3f}".format(name,metric))
Expand Down
8 changes: 4 additions & 4 deletions mpi_learn/train/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(self, comm, filename=None,json_str=None, custom_objects={}, weights
self.filename = filename
self.json_str = json_str
self.weights = weights
self.custom_objects = custom_objects
self.custom_objects = custom_objects
super(ModelFromJson, self).__init__(comm)

def build_model(self):
Expand All @@ -51,7 +51,7 @@ def __init__(self, comm, filename=None, json_str=None, device_name='cpu',
self.filename = filename
self.json_str = json_str
self.weights = weights
self.custom_objects = custom_objects
self.custom_objects = custom_objects
self.device = self.get_device_name(device_name)
super(ModelFromJsonTF, self).__init__(comm)

Expand All @@ -66,11 +66,11 @@ def get_device_name(self, device):
dev_num = int(device[3:])
dev_type = 'gpu'
except ValueError:
print "GPU number could not be parsed from {}; using CPU".format(device)
print ("GPU number could not be parsed from {}; using CPU".format(device))
dev_num = 0
dev_type = 'cpu'
else:
print "Please specify 'cpu' or 'gpuN' for device name"
print ("Please specify 'cpu' or 'gpuN' for device name")
dev_num = 0
dev_type = 'cpu'
return get_device_name(dev_type, dev_num, backend='tensorflow')
Expand Down

0 comments on commit 05ec799

Please sign in to comment.