Skip to content

Commit

Permalink
MAINT: attempt to limit memory leaks (#89)
Browse files Browse the repository at this point in the history
* limit queries searched
* del pytorch variables
  • Loading branch information
stsievert authored Nov 25, 2020
1 parent 90be880 commit e452970
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion salmon/triplets/algs/_adaptive_runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def get_queries(
rng = None
if random_state:
rng = check_random_state(random_state)
for pwr in itertools.count(start=13):
for pwr in range(12, 20 + 1):
queries, scores = self.search.score(num=2 ** pwr, random_state=rng)
ret_queries.append(queries)
ret_scores.append(scores)
Expand Down
2 changes: 2 additions & 0 deletions salmon/triplets/algs/adaptive/_embed.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ def partial_fit(self, answers, sample_weight=None):
self.meta_["model_updates"] += 1
logger.info("%s", self.meta_)
if self.meta_["num_grad_comps"] >= eg_deadline:
del loss
del losses
break
return self

Expand Down

0 comments on commit e452970

Please sign in to comment.