diff --git a/swift/StableDiffusion/pipeline/StableDiffusionPipeline.swift b/swift/StableDiffusion/pipeline/StableDiffusionPipeline.swift index bc888cc..e33f57b 100644 --- a/swift/StableDiffusion/pipeline/StableDiffusionPipeline.swift +++ b/swift/StableDiffusion/pipeline/StableDiffusionPipeline.swift @@ -68,7 +68,7 @@ public struct StableDiffusionPipeline { prompt: String, imageCount: Int = 1, stepCount: Int = 50, - seed: Int = 0, + seed: UInt32 = 0, disableSafety: Bool = false, progressHandler: (Progress) -> Bool = { _ in true } ) throws -> [CGImage?] { @@ -140,11 +140,11 @@ public struct StableDiffusionPipeline { return try decodeToImages(latents, disableSafety: disableSafety) } - func generateLatentSamples(_ count: Int, stdev: Float, seed: Int) -> [MLShapedArray] { + func generateLatentSamples(_ count: Int, stdev: Float, seed: UInt32) -> [MLShapedArray] { var sampleShape = unet.latentSampleShape sampleShape[0] = 1 - var random = NumPyRandomSource(seed: UInt32(seed)) + var random = NumPyRandomSource(seed: seed) let samples = (0..( converting: random.normalShapedArray(sampleShape, mean: 0.0, stdev: Double(stdev))) diff --git a/swift/StableDiffusionCLI/main.swift b/swift/StableDiffusionCLI/main.swift index 6b09af6..6175978 100644 --- a/swift/StableDiffusionCLI/main.swift +++ b/swift/StableDiffusionCLI/main.swift @@ -47,7 +47,7 @@ struct StableDiffusionSample: ParsableCommand { var outputPath: String = "./" @Option(help: "Random seed") - var seed: Int = 93 + var seed: UInt32 = 93 @Option(help: "Compute units to load model with {all,cpuOnly,cpuAndGPU,cpuAndNeuralEngine}") var computeUnits: ComputeUnits = .all