- if min([m.main_test_accuracy for m in models]) >= accuracy_to_make_quizzes:
- other_models = models.copy()
- other_models.remove(model)
-
- average_logits = create_quizzes(
- model,
- other_models,
- task,
- nb_for_train=nb_new_quizzes_for_train,
- nb_for_test=nb_new_quizzes_for_test,
- desired_average_logits=desired_average_logits,
+if args.dirty_debug:
+ args.accuracy_to_make_c_quizzes = 0.0
+ args.nb_gpts = 2
+ nb_new_c_quizzes_for_train = 100
+ nb_new_c_quizzes_for_test = 10
+
+ def standard_validity(logproba):
+ l = logproba.sort(dim=-1).values
+ return l[:, 0] < math.log(0.99)
+
+
+######################################################################
+
+for n_epoch in range(args.nb_epochs):
+ log_string(f"--- epoch {n_epoch} ----------------------------------------")
+
+ cta = " ".join([f"{float(m.main_test_accuracy):.04f}" for m in models])
+ log_string(f"current_test_accuracies {cta}")
+
+ ##################################################
+ # Select, improve, and eval the worst models
+
+ ranked_models = sorted(models, key=lambda m: float(m.main_test_accuracy))
+
+ weakest_models = ranked_models[: args.nb_gpus]
+
+ for gpu_id, model in enumerate(weakest_models):
+ model.TRAINING_LOCK.acquire()
+
+ log_string(
+ f"training model {model.id} main_test_accuracy {model.main_test_accuracy}"