import ffutils
import mygpt
-import sky, reasoning, quiz_machine
+import sky, grids, quiz_machine
# world quizzes vs. culture quizzes
speed=args.sky_speed,
)
back_accuracy = False
-elif args.problem == "reasoning":
- problem = reasoning.Reasoning(device=device)
+elif args.problem == "grids":
+ problem = grids.Grids(device=device)
back_accuracy = True
else:
raise ValueError
import problem
-class Reasoning(problem.Problem):
+class Grids(problem.Problem):
named_colors = [
("white", [255, 255, 255]),
("red", [255, 0, 0]),
if n < nb_rec - 1:
f_X[i1, j1] = c[-1]
- def contact(X, i, j, q):
+ def contact(self, X, i, j, q):
nq, nq_diag = 0, 0
no = 0
k = torch.randperm(self.height * self.width)
for p in range(self.height * self.width):
i, j = k[p] % self.height, k[p] // self.height
- no, nq, nq_diag = contact(X, i, j, c[q[p]])
+ no, nq, nq_diag = self.contact(X, i, j, c[q[p]])
if no == 0 and nq_diag == 0:
if nq == 0:
if nb[q[p]] < self.width:
nb = 48
- reasoning = Reasoning()
+ grids = Grids()
- for t in [reasoning.task_islands]: # reasoning.all_tasks():
+ for t in grids.all_tasks():
+ # for t in [grids.task_islands]:
print(t.__name__)
- prompts, answers = reasoning.generate_prompts_and_answers(nb, tasks=[t])
- reasoning.save_quizzes("/tmp", t.__name__, prompts[:nb], answers[:nb], nrow=4)
+ prompts, answers = grids.generate_prompts_and_answers(nb, tasks=[t])
+ grids.save_quizzes("/tmp", t.__name__, prompts[:nb], answers[:nb], nrow=4)
exit(0)
nb = 72
start_time = time.perf_counter()
- prompts, answers = reasoning.generate_prompts_and_answers(nb)
+ prompts, answers = grids.generate_prompts_and_answers(nb)
delay = time.perf_counter() - start_time
print(f"{prompts.size(0)/delay:02f} seq/s")
predicted_prompts = m * (torch.randint(2, (prompts.size(0),)) * 2 - 1)
predicted_answers = (1 - m) * (torch.randint(2, (prompts.size(0),)) * 2 - 1)
- reasoning.save_quizzes(
+ grids.save_quizzes(
"/tmp",
"test",
prompts[:nb],