Skip to content

Commit 01433fb

Browse files
committed
make sure generate_text works when shift token feature is turned on
1 parent 459c46a commit 01433fb

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

dalle_pytorch/transformer.py

+5
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ def forward(self, x, **kwargs):
103103
text_len = seq_len - img_seq_len + 1
104104
padding = seq_len - n + 1
105105

106+
# if sequence is shorter than the text length, no image tokens to shift
107+
108+
if n < text_len:
109+
return self.fn(x, **kwargs)
110+
106111
# get text and image tokens
107112

108113
x_text, x_img = x[:, :text_len], x[:, text_len:]

setup.py

+1-1
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.2.1',
7+
version = '1.2.2',
88
license='MIT',
99
description = 'DALL-E - Pytorch',
1010
author = 'Phil Wang',

0 commit comments

Comments
 (0)