diff --git a/README.md b/README.md index 9c61c00..1dca229 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,8 @@ A minimal iOS app that generates images using Stable Diffusion v2. You can create images specifying any prompt (text) such as "a photo of an astronaut riding a horse on mars". -- macOS 13.1 RC or newer, Xcode 14.2 or newer -- iPhone 12+ / iOS 16.2 RC or newer, iPad Pro with M1/M2 / iPadOS 16.2 RC or newer +- macOS 13.1 or newer, Xcode 14.2 or newer +- iPhone Pro 12+ / iOS 16.2 or newer, iPad Pro with M1/M2 / iPadOS 16.2 or newer You can run the app on above mobile devices. And you can run the app on Mac, building as a Designed for iPad app. @@ -26,6 +26,12 @@ You can see how it works through the simple sample code. ## Change Log +- [1.0.2 (3)] - 2022-12-16 `[Changed]` + - The apple/ml-stable-diffusion Swift Package v0.1.0 was released. + - At apple/ml-stable-diffusion Swift Package v0.1.0, `reduceMemory` option of StableDiffusionPipeline(resourcesAt:) + was added. And on iOS, the reduceMemory option should be set to true. + - This option was added and set to true, in `ImageGenerator.swift` when creating StableDiffusionPipeline. + - According to the new apple readme, iPhone requirement was changed to iPhone Pro 12+. - [1.0.1 (2)] - 2022-12-08 `[Changed]` - Changed to delay creation of `StableDiffusionPipeline` until the first image generation and execute it in a background task. diff --git a/imggensd2.xcodeproj/project.pbxproj b/imggensd2.xcodeproj/project.pbxproj index 8eed75a..8efe91b 100644 --- a/imggensd2.xcodeproj/project.pbxproj +++ b/imggensd2.xcodeproj/project.pbxproj @@ -7,12 +7,12 @@ objects = { /* Begin PBXBuildFile section */ + BA01CAE9294C92FC00C89D87 /* StableDiffusion in Frameworks */ = {isa = PBXBuildFile; productRef = BA01CAE8294C92FC00C89D87 /* StableDiffusion */; }; BA03C378293D785C001426DE /* imggensd2App.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA03C377293D785C001426DE /* imggensd2App.swift */; }; BA03C37A293D785C001426DE /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA03C379293D785C001426DE /* ContentView.swift */; }; BA03C37C293D785D001426DE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BA03C37B293D785D001426DE /* Assets.xcassets */; }; BA03C37F293D785D001426DE /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BA03C37E293D785D001426DE /* Preview Assets.xcassets */; }; BA03C388293D80A4001426DE /* CoreMLModels in Resources */ = {isa = PBXBuildFile; fileRef = BA03C387293D80A4001426DE /* CoreMLModels */; }; - BA03C38B293D8362001426DE /* StableDiffusion in Frameworks */ = {isa = PBXBuildFile; productRef = BA03C38A293D8362001426DE /* StableDiffusion */; }; BA03C38D293D8773001426DE /* ImageGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA03C38C293D8773001426DE /* ImageGenerator.swift */; }; /* End PBXBuildFile section */ @@ -32,7 +32,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - BA03C38B293D8362001426DE /* StableDiffusion in Frameworks */, + BA01CAE9294C92FC00C89D87 /* StableDiffusion in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -95,7 +95,7 @@ ); name = imggensd2; packageProductDependencies = ( - BA03C38A293D8362001426DE /* StableDiffusion */, + BA01CAE8294C92FC00C89D87 /* StableDiffusion */, ); productName = imggensd2; productReference = BA03C374293D785C001426DE /* imggensd2.app */; @@ -126,7 +126,7 @@ ); mainGroup = BA03C36B293D785C001426DE; packageReferences = ( - BA03C389293D8362001426DE /* XCRemoteSwiftPackageReference "ml-stable-diffusion" */, + BA01CAE7294C92FB00C89D87 /* XCRemoteSwiftPackageReference "ml-stable-diffusion" */, ); productRefGroup = BA03C375293D785C001426DE /* Products */; projectDirPath = ""; @@ -305,7 +305,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_ASSET_PATHS = "\"imggensd2/Preview Content\""; DEVELOPMENT_TEAM = J5CY9Q9UP5; ENABLE_PREVIEWS = YES; @@ -316,11 +316,12 @@ INFOPLIST_KEY_UILaunchScreen_Generation = YES; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 16.2; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.1; + MARKETING_VERSION = 1.0.2; PRODUCT_BUNDLE_IDENTIFIER = com.atarayosd.imggensd2; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; @@ -335,7 +336,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_ASSET_PATHS = "\"imggensd2/Preview Content\""; DEVELOPMENT_TEAM = J5CY9Q9UP5; ENABLE_PREVIEWS = YES; @@ -346,11 +347,12 @@ INFOPLIST_KEY_UILaunchScreen_Generation = YES; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 16.2; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.1; + MARKETING_VERSION = 1.0.2; PRODUCT_BUNDLE_IDENTIFIER = com.atarayosd.imggensd2; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; @@ -383,7 +385,7 @@ /* End XCConfigurationList section */ /* Begin XCRemoteSwiftPackageReference section */ - BA03C389293D8362001426DE /* XCRemoteSwiftPackageReference "ml-stable-diffusion" */ = { + BA01CAE7294C92FB00C89D87 /* XCRemoteSwiftPackageReference "ml-stable-diffusion" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/apple/ml-stable-diffusion#swift-requirements"; requirement = { @@ -394,9 +396,9 @@ /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ - BA03C38A293D8362001426DE /* StableDiffusion */ = { + BA01CAE8294C92FC00C89D87 /* StableDiffusion */ = { isa = XCSwiftPackageProductDependency; - package = BA03C389293D8362001426DE /* XCRemoteSwiftPackageReference "ml-stable-diffusion" */; + package = BA01CAE7294C92FB00C89D87 /* XCRemoteSwiftPackageReference "ml-stable-diffusion" */; productName = StableDiffusion; }; /* End XCSwiftPackageProductDependency section */ diff --git a/imggensd2.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/imggensd2.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 080d4b8..fc21992 100644 --- a/imggensd2.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/imggensd2.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -6,7 +6,7 @@ "location" : "https://github.com/apple/ml-stable-diffusion#swift-requirements", "state" : { "branch" : "main", - "revision" : "583cc04ece3dce9e1e8d44449f58d2eb7edef11c" + "revision" : "66dde8da135593eccef7bbb3a329ccf7bb1724d3" } }, { diff --git a/imggensd2/ImageGenerator.swift b/imggensd2/ImageGenerator.swift index ceeb45e..b368b26 100644 --- a/imggensd2/ImageGenerator.swift +++ b/imggensd2/ImageGenerator.swift @@ -77,7 +77,10 @@ final class ImageGenerator: ObservableObject { } let resourceURL = URL(fileURLWithPath: path) - if let pipeline = try? StableDiffusionPipeline(resourcesAt: resourceURL) { + // reduceMemory option was added at v0.1.0 + // On iOS, the reduceMemory option should be set to true + if let pipeline = try? StableDiffusionPipeline(resourcesAt: resourceURL, + reduceMemory: true) { await self.setPipeline(pipeline) } else { fatalError("Fatal error: failed to create the Stable-Diffusion-Pipeline.")