From 31ed8a54992e7701eebd1c3d49bfe8dc20aa65e3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fran=C3=A7ois=20Fleuret?= Date: Sat, 22 Jun 2024 11:39:44 +0200 Subject: [PATCH] Update. --- world.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/world.py b/world.py index 1d86bc6..ab02c82 100755 --- a/world.py +++ b/world.py @@ -27,9 +27,9 @@ colors = torch.tensor( ) token_background = 0 -first_fish_token = 1 -nb_fish_tokens = len(colors) - 1 -token_forward = first_fish_token + nb_fish_tokens +first_bird_token = 1 +nb_bird_tokens = len(colors) - 1 +token_forward = first_bird_token + nb_bird_tokens token_backward = token_forward + 1 token2char = "_" + "".join([str(n) for n in range(len(colors) - 1)]) + "><" @@ -49,9 +49,9 @@ def generate( f_end = torch.zeros(height, width, dtype=torch.int64) n = torch.arange(f_start.size(0)) - nb_fish = torch.randint(max_nb_obj, (1,)).item() + 1 + nb_birds = torch.randint(max_nb_obj, (1,)).item() + 1 for c in ( - (torch.randperm(nb_fish_tokens) + first_fish_token)[:nb_fish].sort().values + (torch.randperm(nb_bird_tokens) + first_bird_token)[:nb_birds].sort().values ): i, j = ( torch.randint(height - 2, (1,))[0] + 1, @@ -109,7 +109,7 @@ def sample2img(seq, height, width, upscale=15): def mosaic(x, upscale): x = x.reshape(-1, height, width) - m = torch.logical_and(x >= 0, x < first_fish_token + nb_fish_tokens).long() + m = torch.logical_and(x >= 0, x < first_bird_token + nb_bird_tokens).long() x = colors[x * m].permute(0, 3, 1, 2) s = x.shape x = x[:, :, :, None, :, None].expand(-1, -1, -1, upscale, -1, upscale) -- 2.39.5