From 4b5e7cedf4a6e001f1d20e02f5248e980828177b Mon Sep 17 00:00:00 2001 From: Innoy <109030166+Innoy-qwq@users.noreply.github.com> Date: Thu, 17 Oct 2024 11:58:28 +0800 Subject: [PATCH] Fix invalid characters in filename in neural_style.py (line 119 in train function) Replaced colon (:) in the timestamp to ensure the file can be saved correctly on Windows. The change was made at line 119 of the train function in neural_style.py. --- fast_neural_style/neural_style/neural_style.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fast_neural_style/neural_style/neural_style.py b/fast_neural_style/neural_style/neural_style.py index 91bf642d82..49217770a6 100644 --- a/fast_neural_style/neural_style/neural_style.py +++ b/fast_neural_style/neural_style/neural_style.py @@ -116,8 +116,8 @@ def train(args): # save model transformer.eval().cpu() - save_model_filename = "epoch_" + str(args.epochs) + "_" + str(time.ctime()).replace(' ', '_') + "_" + str( - args.content_weight) + "_" + str(args.style_weight) + ".model" + timestamp = time.strftime("%Y-%m-%d_%H-%M-%S") + save_model_filename = f"epoch_{args.epochs}_{timestamp}_{args.content_weight}_{args.style_weight}.model" save_model_path = os.path.join(args.save_model_dir, save_model_filename) torch.save(transformer.state_dict(), save_model_path)