Skip to content

Commit 2783801

Browse files
committed
stable softmax when generating images
1 parent 4a7958d commit 2783801

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

dalle_pytorch/dalle_pytorch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ def generate_images(
489489
logits = self(text, image, mask = mask)[:, -1, :]
490490

491491
filtered_logits = top_k(logits, thres = filter_thres)
492-
probs = F.softmax(filtered_logits / temperature, dim = -1)
492+
probs = stable_softmax(filtered_logits / temperature, dim = -1)
493493
sample = torch.multinomial(probs, 1)
494494

495495
sample -= (num_text_tokens if is_image else 0) # offset sampled token if it is an image token, since logit space is composed of text and then image tokens

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
name = 'dalle-pytorch',
55
packages = find_packages(),
66
include_package_data = True,
7-
version = '1.1.6',
7+
version = '1.1.7',
88
license='MIT',
99
description = 'DALL-E - Pytorch',
1010
author = 'Phil Wang',

0 commit comments

Comments
 (0)