Skip to content

Commit

Permalink
Formats code with black
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-j-h committed Sep 12, 2018
1 parent d073f4a commit be9d6a6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion robosat/tools/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def unbuffered(shape):
else:
print("Warning: merged feature is neither Polygon nor MultiPoylgon, skipping", file=sys.stderr)
continue

# equal-area projection; round to full m^2, we're not that precise anyway
area = int(round(project(merged, "epsg:4326", "esri:54009").area))

Expand Down
3 changes: 3 additions & 0 deletions robosat/tools/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def no_grad():
with torch.no_grad():
yield


def add_parser(subparser):
parser = subparser.add_parser(
"train", help="trains model on dataset", formatter_class=argparse.ArgumentDefaultsHelpFormatter
Expand Down Expand Up @@ -73,8 +74,10 @@ def main(args):
torch.backends.cudnn.benchmark = True

if args.checkpoint:

def map_location(storage, _):
return storage.cuda() if model["common"]["cuda"] else storage.cpu()

# https://github.com/pytorch/pytorch/issues/7178
chkpt = torch.load(args.checkpoint, map_location=map_location)
net.load_state_dict(chkpt)
Expand Down

0 comments on commit be9d6a6

Please sign in to comment.