Skip to content

Commit 20e7eb5

Browse files
committed
cleanup
1 parent e2f9615 commit 20e7eb5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

dalle2_pytorch/dalle2_pytorch.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,12 @@ def __init__(
173173
name = 'ViT-B/32'
174174
):
175175
import clip
176-
openai_clip, _ = clip.load(name)
176+
openai_clip, preprocess = clip.load(name)
177177
super().__init__(openai_clip)
178178

179179
text_attention_final = self.find_layer('ln_final')
180180
self.handle = text_attention_final.register_forward_hook(self._hook)
181-
self.clip_normalize = T.Normalize((0.48145466, 0.4578275, 0.40821073), (0.26862954, 0.26130258, 0.27577711))
181+
self.clip_normalize = preprocess.transforms[-1]
182182
self.cleared = False
183183

184184
def find_layer(self, layer):

0 commit comments

Comments
 (0)