DALLE-pytorch icon indicating copy to clipboard operation
DALLE-pytorch copied to clipboard

TypeError: sum() takes no keyword arguments

Open Tylersuard opened this issue 5 years ago • 3 comments

TypeError Traceback (most recent call last)

in () ----> 1 all_words = list(sorted(frozenset(sum(captions, start=[])))) 2 word_tokens = dict(zip(all_words, range(1, len(all_words) + 1))) 3 caption_tokens = [[word_tokens[w] for w in c] for c in captions]

TypeError: sum() takes no keyword arguments

Using rainbow_dalle.ipynb in Colab

Last line executed: all_words = list(sorted(frozenset(sum(captions, start=[]))))

Tylersuard avatar Mar 20 '21 04:03 Tylersuard

@Tylersuard you'll have to take this up with @sorrge

lucidrains avatar Mar 20 '21 16:03 lucidrains

You need python 3.8+ for this: https://docs.python.org/3/library/functions.html#sum

sorrge avatar Mar 20 '21 16:03 sorrge

A workaround will be:

captions_joined = []
for caption in captions:
    captions_joined += caption

all_words = list(sorted(frozenset(captions_joined)))

sorrge avatar Mar 20 '21 16:03 sorrge