Skip to content

Commit 491dbd1

Browse files
committed
Revert usage of filter to work around issue with cloudpickle in python 3.8
1 parent 26ef93f commit 491dbd1

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/pydvl/value/semivalues.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,11 +278,16 @@ def compute_generic_semivalues(
278278
raise StopIteration
279279

280280
# Filter out samples for indices that have already converged
281-
filtered_samples: Iterable = samples
281+
filtered_samples = samples
282282
if skip_converged and len(done.converged) > 0:
283-
# t[0] is the index for the sample
284-
filtered_samples = filter(
285-
lambda t: not done.converged[t[0]], samples
283+
# cloudpickle can't pickle this on python 3.8:
284+
# filtered_samples = filter(
285+
# lambda t: not done.converged[t[0]], samples
286+
# )
287+
filtered_samples = tuple(
288+
(idx, sample)
289+
for idx, sample in samples
290+
if not done.converged[idx]
286291
)
287292

288293
if filtered_samples:

0 commit comments

Comments
 (0)