Closed gitraffica closed 3 years ago
I found out the problem by myself. The var name coincidently conflicts with the parent for loop var(.........)
cap = captions[0].data.cpu().numpy() sentence = "" for l in range(len(cap)): if cap[l] == 0: break word = self.ixtoword[cap[l]].encode('ascii', 'ignore').decode('ascii') sentence += word + " "
I also ran into the problem here, problem and I used the corresponding code you provided:
cap = captions[0].data.cpu().numpy() sentence = "" for j in range(len(cap)): if cap[j] == 0: break word = self.ixtoword[cap[j]].encode('ascii', 'ignore').decode('ascii') sentence += word + " "
and the altered sampling function: ubuntu pastebin
I am confused about why this code was generating multiple same images under a same keys[j](referring to the screenshot below, the same generated images were sampled due to a same keys[j]), with different captions: