X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=tasks.py;h=04b8f84577097a7ef3de515fa90f6a461429e7e5;hb=3d6738c9406c70bd3593b49c596bcf451bc2b946;hp=b277b96683a211cf07ea4a642a8f22c8ff6e1972;hpb=9c974541bec4b1aa67bb39bfff4ef128c36ae3d9;p=picoclvr.git diff --git a/tasks.py b/tasks.py index b277b96..04b8f84 100755 --- a/tasks.py +++ b/tasks.py @@ -809,9 +809,8 @@ class Expr(Task): nb_train_samples, nb_variables=nb_variables, length=sequence_length, - # length=2 * sequence_length, - # randomize_length=True, ) + test_sequences = expr.generate_sequences( nb_test_samples, nb_variables=nb_variables, @@ -911,7 +910,7 @@ class Expr(Task): test_nb_correct, test_nb_delta, test_nb_missed, - ) = compute_nb_correct(self.test_input[:1000]) + ) = compute_nb_correct(self.test_input[:10000]) logger( f"accuracy_test {n_epoch} nb_total {test_nb_total} nb_correct {test_nb_correct} accuracy {(100.0*test_nb_correct)/test_nb_total:.02f}%" @@ -937,11 +936,12 @@ class Expr(Task): input = self.tensorize(sequences) result = input.clone() - ar_mask = (result == self.space).long().cumsum(dim=1).clamp(max=1) + s = (result == self.space).long() + ar_mask = (s.cumsum(dim=1) - s).clamp(min=0, max=1) result = (1 - ar_mask) * result + ar_mask * self.filler - # for n in range(result.size(0)): - # logger(f"test_before {self.seq2str(result[n])}") + for n in range(result.size(0)): + logger(f"test_before {self.seq2str(result[n])}") masked_inplace_autoregression( model,