From: François Fleuret Date: Thu, 12 Sep 2024 17:15:46 +0000 (+0200) Subject: Update. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=9e508a333a34bc4b65e9e78d9dd3106b08157acb;p=culture.git Update. --- diff --git a/main.py b/main.py index 80e99fd..63cd377 100755 --- a/main.py +++ b/main.py @@ -1386,13 +1386,6 @@ def multithread_execution(fun, arguments): ] -# ----- test - -# ranked_models = sorted(models, key=lambda m: float(m.test_accuracy)) -# weakest_models = ranked_models[: len(gpus)] - -# n_epoch = 14 - ###################################################################### for n_epoch in range(current_epoch, args.nb_epochs): @@ -1446,36 +1439,6 @@ for n_epoch in range(current_epoch, args.nb_epochs): [(models, nb_c_quizzes_to_generate, gpu) for gpu in gpus], ) - ## records, threads = [], [] - ## - ## start_time = time.perf_counter() - ## - ## if len(gpus) > 1: - ## for gpu in gpus: - ## t = threading.Thread( - ## target=thread_generate_ae_c_quizzes, - ## daemon=True, - ## args=(models, nb_c_quizzes_to_generate, records, gpu), - ## ) - ## - ## # To get a different sequence between threads - ## log_string(f"dummy {torch.rand(1)}") - ## threads.append(t) - ## t.start() - ## - ## for t in threads: - ## t.join() - ## - ## else: - ## records.append( - ## generate_ae_c_quizzes(models, nb_c_quizzes_to_generate, gpus[0]) - ## ) - ## - ## time_c_quizzes = int(time.perf_counter() - start_time) - ## - ## c_quizzes = torch.cat([q.to(main_device) for q, _ in records], dim=0) - ## agreements = torch.cat([a.to(main_device) for _, a in records], dim=0) - # -------------------------------------------------------------------- filename = f"culture_c_quiz_{n_epoch:04d}.png" @@ -1499,9 +1462,6 @@ for n_epoch in range(current_epoch, args.nb_epochs): else: log_string(f"nb_c_quizzes {c_quizzes.size(0)}") - # one_ae_epoch(model, quiz_machine, n_epoch, None) - # exit(0) - # -------------------------------------------------------------------- ranked_models = sorted(models, key=lambda m: float(m.test_accuracy)) @@ -1521,41 +1481,6 @@ for n_epoch in range(current_epoch, args.nb_epochs): ], ) - ## threads = [] - ## - ## start_time = time.perf_counter() - ## - ## if len(gpus) > 1: - ## for gpu, model in zip(gpus, weakest_models): - ## log_string(f"training model {model.id} (accuracy {model.test_accuracy})") - ## if c_quizzes is None: - ## c_quizzes_for_this_model = None - ## else: - ## c_quizzes_for_this_model = c_quizzes[agreements[:, model.id]] - ## - ## t = threading.Thread( - ## target=one_ae_epoch, - ## daemon=True, - ## args=(model, quiz_machine, n_epoch, c_quizzes_for_this_model, gpu), - ## ) - ## - ## threads.append(t) - ## - ## t.start() - ## - ## for t in threads: - ## t.join() - ## - ## else: - ## model = weakest_models[0] - ## log_string(f"training model {model.id} (accuracy {model.test_accuracy})") - ## if c_quizzes is None: - ## c_quizzes_for_this_model = None - ## else: - ## c_quizzes_for_this_model = c_quizzes[agreements[:, model.id]] - ## - ## one_ae_epoch(model, quiz_machine, n_epoch, c_quizzes_for_this_model, gpus[0]) - time_train += int(time.perf_counter() - start_time) # --------------------------------------------------------------------