Skip to content

Commit 4633727

Browse files
authored
Fix SD generation in batch mode (#170)
* fix batch mode * format
1 parent 7813a92 commit 4633727

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Libraries/StableDiffusion/StableDiffusion.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ open class StableDiffusion {
255255
xt: MLXArray, t: MLXArray, tPrev: MLXArray, conditioning: MLXArray, cfgWeight: Float,
256256
textTime: (MLXArray, MLXArray)?
257257
) -> MLXArray {
258-
let xtUnet = cfgWeight > 1 ? repeated(xt, count: 2, axis: 0) : xt
258+
let xtUnet = cfgWeight > 1 ? concatenated([xt, xt], axis: 0) : xt
259259
let tUnet = broadcast(t, to: [xtUnet.count])
260260

261261
var epsPred = unet(xtUnet, timestep: tUnet, encoderX: conditioning, textTime: textTime)

0 commit comments

Comments
 (0)