From 672bf7fb3aad41e6e9f249e2e9240e3c562dcfec Mon Sep 17 00:00:00 2001
From: Tim O'Donnell <timodonnell@gmail.com>
Date: Tue, 28 Nov 2017 15:06:17 -0500
Subject: [PATCH] Free up memory: get rid of train data as models are trained

---
 .../train_allele_specific_models_command.py                    | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mhcflurry/class1_affinity_prediction/train_allele_specific_models_command.py b/mhcflurry/class1_affinity_prediction/train_allele_specific_models_command.py
index c763b92d..836e4fdc 100644
--- a/mhcflurry/class1_affinity_prediction/train_allele_specific_models_command.py
+++ b/mhcflurry/class1_affinity_prediction/train_allele_specific_models_command.py
@@ -189,7 +189,8 @@ def run(argv=sys.argv[1:]):
             # Run in serial. In this case, every worker is passed the same predictor,
             # which it adds models to, so no merging is required. It also saves
             # as it goes so no saving is required at the end.
-            for item in work_items:
+            while work_items:
+                item = work_items.pop(0)
                 work_predictor = work_entrypoint(item)
                 assert work_predictor is predictor
 
-- 
GitLab