From: François Fleuret Date: Wed, 19 Jul 2023 15:53:33 +0000 (+0200) Subject: Update. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=5d46a9bd7d032d90ef4c4b38ac3c9b5b66526527;p=culture.git Update. --- diff --git a/expr.py b/expr.py index 847cd36..685efd3 100755 --- a/expr.py +++ b/expr.py @@ -1,5 +1,10 @@ #!/usr/bin/env python +# Any copyright is dedicated to the Public Domain. +# https://creativecommons.org/publicdomain/zero/1.0/ + +# Written by Francois Fleuret + import math, re import torch, torchvision diff --git a/main.py b/main.py index 901b1d0..71026c5 100755 --- a/main.py +++ b/main.py @@ -5,9 +5,6 @@ # Written by Francois Fleuret -# torch.backends.cuda.matmul.allow_tf23 -# torch.autocast(torch.bfloat16) - import math, sys, argparse, time, tqdm, os import torch, torchvision diff --git a/rpl.py b/rpl.py index 7e865a5..7c1c96e 100755 --- a/rpl.py +++ b/rpl.py @@ -1,5 +1,10 @@ #!/usr/bin/env python +# Any copyright is dedicated to the Public Domain. +# https://creativecommons.org/publicdomain/zero/1.0/ + +# Written by Francois Fleuret + import math import torch, torchvision diff --git a/tasks.py b/tasks.py index 0a4dd6f..bad4536 100755 --- a/tasks.py +++ b/tasks.py @@ -1,5 +1,10 @@ #!/usr/bin/env python +# Any copyright is dedicated to the Public Domain. +# https://creativecommons.org/publicdomain/zero/1.0/ + +# Written by Francois Fleuret + import math, os, tqdm import torch, torchvision @@ -108,9 +113,7 @@ class ProblemLevel1(Problem): source = torch.rand(nb, 10).sort(dim=1).indices[:, : self.len_source] marker2 = torch.full((nb, 1), 11) result = operators.bmm(source[:, :, None]).squeeze(-1) - print(f"{nb_operators.dtype=} {marker1.dtype=}") sequences = torch.cat((nb_operators, marker1, source, marker2, result), 1) - print(f"{sequences.size()=}") ar_mask = (sequences == 11).long() ar_mask = (ar_mask.cumsum(1) - ar_mask).clamp(max=1) return sequences, ar_mask @@ -1091,7 +1094,6 @@ class RPL(Task): symbols = list(filter(lambda x: type(x) is str, symbols)) symbols.sort() symbols += [str(n) for n in range(val_max + 1)] - print(f"{val_max=}") self.token2id = dict([(c, n) for n, c in enumerate(symbols)]) self.id2token = dict([(n, c) for c, n in self.token2id.items()]) @@ -1101,6 +1103,7 @@ class RPL(Task): self.test_input = self.tensorize(test_sequences) if logger is not None: + logger(f"value_max {val_max}") for x in self.train_input[:25]: end = (x != self.t_nul).nonzero().max().item() + 1 seq = [self.id2token[i.item()] for i in x[:end]] diff --git a/world.py b/world.py index 1d64fa3..aad0bfb 100755 --- a/world.py +++ b/world.py @@ -1,5 +1,10 @@ #!/usr/bin/env python +# Any copyright is dedicated to the Public Domain. +# https://creativecommons.org/publicdomain/zero/1.0/ + +# Written by Francois Fleuret + import math, sys, tqdm import torch, torchvision