Skip to content

Commit 35099a7

Browse files
Supports SDXL Lightning
1 parent a561fae commit 35099a7

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

Diffusion/Common/Pipeline/Pipeline.swift

+2
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,11 @@ class Pipeline {
7676
negativePrompt: String = "",
7777
scheduler: StableDiffusionScheduler,
7878
numInferenceSteps stepCount: Int = 50,
79+
//numInferenceSteps stepCount: Int = 4,
7980
seed: UInt32 = 0,
8081
numPreviews previewCount: Int = 5,
8182
guidanceScale: Float = 7.5,
83+
//guidanceScale: Float = 0,
8284
disableSafety: Bool = false
8385
) throws -> GenerationResult {
8486
let beginDate = Date()

Diffusion/Common/Pipeline/PipelineLoader.swift

+9-2
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,16 @@ extension PipelineLoader {
9393

9494
var packagesFilename: String { (filename as NSString).deletingPathExtension }
9595

96-
var compiledURL: URL { downloadedURL.deletingLastPathComponent().appendingPathComponent(packagesFilename) }
96+
//var compiledURL: URL { downloadedURL.deletingLastPathComponent().appendingPathComponent(packagesFilename) }
97+
var compiledURL: URL { URL(fileURLWithPath: Bundle.main.resourcePath!) }
9798

9899
var downloaded: Bool {
99100
return FileManager.default.fileExists(atPath: downloadedURL.path)
100101
}
101102

102103
var ready: Bool {
103-
return FileManager.default.fileExists(atPath: compiledURL.path)
104+
//return FileManager.default.fileExists(atPath: compiledURL.path)
105+
true
104106
}
105107

106108
var variant: AttentionVariant {
@@ -165,6 +167,11 @@ extension PipelineLoader {
165167
let beginDate = Date()
166168
let configuration = MLModelConfiguration()
167169
configuration.computeUnits = computeUnits
170+
171+
print(configuration.computeUnits.rawValue)
172+
print(model.reduceMemory)
173+
print(compiledURL)
174+
168175
let pipeline: StableDiffusionPipelineProtocol
169176
if model.isXL {
170177
if #available(macOS 14.0, iOS 17.0, *) {

Diffusion/Common/State.swift

+5-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import StableDiffusion
1212
import CoreML
1313

1414
let DEFAULT_MODEL = ModelInfo.sd3
15-
let DEFAULT_PROMPT = "Labrador in the style of Vermeer"
15+
let DEFAULT_PROMPT = "a photo of puppy"
1616

1717
enum GenerationState {
1818
case startup
@@ -130,8 +130,10 @@ class Settings {
130130
Keys.computeUnits.rawValue: -1, // Use default
131131
Keys.prompt.rawValue: DEFAULT_PROMPT,
132132
Keys.negativePrompt.rawValue: "",
133-
Keys.guidanceScale.rawValue: 7.5,
134-
Keys.stepCount.rawValue: 25,
133+
//Keys.guidanceScale.rawValue: 7.5,
134+
Keys.guidanceScale.rawValue: 0,
135+
//Keys.stepCount.rawValue: 25,
136+
Keys.stepCount.rawValue: 4,
135137
Keys.previewCount.rawValue: 5,
136138
Keys.seed.rawValue: 0
137139
])

Diffusion/Info.plist

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
4-
<dict>
5-
<key>NSPhotoLibraryAddUsageDescription</key>
6-
<string>To be able to save generated images to your Photo Library, you’ll need to allow this.</string>
7-
<key>CFBundleDisplayName</key>
8-
<string>Diffusers</string>
9-
</dict>
4+
<dict/>
105
</plist>

0 commit comments

Comments
 (0)