From 4361735b9e9bf596b256d9cc4b75543e05623ca3 Mon Sep 17 00:00:00 2001 From: KyuHwan00 Date: Sat, 21 Sep 2024 14:43:19 +0900 Subject: [PATCH] Fix invalid mask implementation --- swift/StableDiffusion/pipeline/TextEncoderT5.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/swift/StableDiffusion/pipeline/TextEncoderT5.swift b/swift/StableDiffusion/pipeline/TextEncoderT5.swift index 51ad305..b5982b0 100644 --- a/swift/StableDiffusion/pipeline/TextEncoderT5.swift +++ b/swift/StableDiffusion/pipeline/TextEncoderT5.swift @@ -91,9 +91,9 @@ public struct TextEncoderT5: TextEncoderT5Model { let attentionMaskName = "attention_mask" var attentionMask: [Int] = inputIds.map { token in - token == padToken ? maskToken : padToken + token == padToken ? padToken : maskToken } - attentionMask[0] = bosToken + attentionMask[0] = eosToken let floatIds = inputIds.map { Float32($0) } let floatMask = attentionMask.map { Float32($0) }