- if q.size(0) > 0:
- quiz_machine.save_quiz_illustrations(
- args.result_dir, f"culture_c_quiz_{n_epoch:04d}", q
- )
+ vq = validated_quizzes[:72]
+ vl = validated_logprobas[:72]
+
+ if vq.size(0) > 0:
+ prefix = f"culture_c_quiz_{n_epoch:04d}"
+
+ file_name = os.path.join(args.result_dir, prefix + "_logp.dat")
+ with open(file_name, "w") as logp_file:
+ for l in vl:
+ s = " ".join([str(x.item()) for x in l])
+ logp_file.write(s + "\n")
+
+ quiz_machine.save_quiz_illustrations(args.result_dir, prefix, vq)