Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix aliasing issues #112

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions scripts/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
import sys
import time
import copy

from collections import defaultdict

Expand Down Expand Up @@ -324,9 +325,9 @@ def main(args):

# Save another checkpoint with model weights and
# optimizer state
checkpoint['g_state'] = generator.state_dict()
checkpoint['g_state'] = copy.deepcopy(generator.state_dict())
checkpoint['g_optim_state'] = optimizer_g.state_dict()
checkpoint['d_state'] = discriminator.state_dict()
checkpoint['d_state'] = copy.deepcopy(discriminator.state_dict())
checkpoint['d_optim_state'] = optimizer_d.state_dict()
checkpoint_path = os.path.join(
args.output_dir, '%s_with_model.pt' % args.checkpoint_name
Expand Down Expand Up @@ -460,9 +461,9 @@ def check_accuracy(
):
d_losses = []
metrics = {}
g_l2_losses_abs, g_l2_losses_rel = ([],) * 2
disp_error, disp_error_l, disp_error_nl = ([],) * 3
f_disp_error, f_disp_error_l, f_disp_error_nl = ([],) * 3
g_l2_losses_abs, g_l2_losses_rel = [], []
disp_error, disp_error_l, disp_error_nl = [], [], []
f_disp_error, f_disp_error_l, f_disp_error_nl = [], [], []
total_traj, total_traj_l, total_traj_nl = 0, 0, 0
loss_mask_sum = 0
generator.eval()
Expand Down Expand Up @@ -578,3 +579,4 @@ def cal_fde(
if __name__ == '__main__':
args = parser.parse_args()
main(args)