From b96eabfe2a7c2d19c83f928aad7f87215cca3186 Mon Sep 17 00:00:00 2001 From: cafeai <116491182+cafeai@users.noreply.github.com> Date: Fri, 2 Dec 2022 01:23:47 +0900 Subject: [PATCH 1/3] Fix --- trainer/diffusers_trainer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trainer/diffusers_trainer.py b/trainer/diffusers_trainer.py index b36b09c..f1ad9a0 100644 --- a/trainer/diffusers_trainer.py +++ b/trainer/diffusers_trainer.py @@ -570,7 +570,7 @@ class AspectDataset(torch.utils.data.Dataset): input_ids = z else: for i, x in enumerate(input_ids): - input_ids[i] = [self.tokenizer.bos_token_id, *x, *np.full((self.max_length - len(x) - 1), self.tokenizer.eos_token_id)] + input_ids[i] = [self.tokenizer.bos_token_id, *x, *np.full((self.tokenizer.model_max_length - len(x) - 1), self.tokenizer.eos_token_id)] if args.clip_penultimate: input_ids = self.text_encoder.text_model.final_layer_norm(self.text_encoder(torch.asarray(input_ids).to(self.device), output_hidden_states=True)['hidden_states'][-2]) else: From d225cd57e7aa1d16211883ee44293fd6f7772f13 Mon Sep 17 00:00:00 2001 From: cafeai <116491182+cafeai@users.noreply.github.com> Date: Fri, 2 Dec 2022 01:41:22 +0900 Subject: [PATCH 2/3] Fix Seed --- trainer/diffusers_trainer.py | 1 + 1 file changed, 1 insertion(+) diff --git a/trainer/diffusers_trainer.py b/trainer/diffusers_trainer.py index f1ad9a0..407303a 100644 --- a/trainer/diffusers_trainer.py +++ b/trainer/diffusers_trainer.py @@ -717,6 +717,7 @@ def main(): # Set seed torch.manual_seed(args.seed) + random.seed(args.seed) print('RANDOM SEED:', args.seed) if args.resume: From c4b17e41f1dde5c4d4cda5b6dd7e957fc353db9b Mon Sep 17 00:00:00 2001 From: cafeai <116491182+cafeai@users.noreply.github.com> Date: Fri, 2 Dec 2022 01:49:12 +0900 Subject: [PATCH 3/3] Add np seed Just in case! --- trainer/diffusers_trainer.py | 1 + 1 file changed, 1 insertion(+) diff --git a/trainer/diffusers_trainer.py b/trainer/diffusers_trainer.py index 407303a..b130561 100644 --- a/trainer/diffusers_trainer.py +++ b/trainer/diffusers_trainer.py @@ -718,6 +718,7 @@ def main(): # Set seed torch.manual_seed(args.seed) random.seed(args.seed) + np.random.seed(args.seed) print('RANDOM SEED:', args.seed) if args.resume: