update to latest versions

This commit is contained in:
Alex Zenla
2024-11-03 03:51:25 -05:00
parent 2e5a37ea4b
commit 8ee3c4c977
26 changed files with 165 additions and 418 deletions

View File

@ -1,5 +1,5 @@
import com.google.protobuf.gradle.id import com.google.protobuf.gradle.id
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.gradle.dsl.JvmTarget
group = "gay.pizza.stable.diffusion" group = "gay.pizza.stable.diffusion"
version = "1.0.0-SNAPSHOT" version = "1.0.0-SNAPSHOT"
@ -8,50 +8,46 @@ plugins {
`java-library` `java-library`
`maven-publish` `maven-publish`
kotlin("jvm") version "1.8.20" kotlin("jvm") version "2.0.21"
kotlin("plugin.serialization") version "1.8.20" kotlin("plugin.serialization") version "2.0.21"
id("com.google.protobuf") version "0.9.2" id("com.google.protobuf") version "0.9.4"
}
java {
withSourcesJar()
} }
repositories { repositories {
mavenCentral() mavenCentral()
} }
java {
val javaVersion = JavaVersion.toVersion(17)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
withSourcesJar()
}
dependencies { dependencies {
implementation("org.jetbrains.kotlin:kotlin-bom") implementation("org.jetbrains.kotlin:kotlin-bom")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.0-RC") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0")
api("io.grpc:grpc-stub:1.54.1") api("io.grpc:grpc-stub:1.68.1")
api("io.grpc:grpc-protobuf:1.54.1") api("io.grpc:grpc-protobuf:1.68.1")
api("io.grpc:grpc-kotlin-stub:1.3.0") api("io.grpc:grpc-kotlin-stub:1.4.1")
implementation("com.google.protobuf:protobuf-java:3.22.3") implementation("com.google.protobuf:protobuf-java:4.28.3")
implementation("io.grpc:grpc-netty:1.54.1") implementation("io.grpc:grpc-netty:1.68.1")
} }
protobuf { protobuf {
protoc { protoc {
artifact = "com.google.protobuf:protoc:3.22.3" artifact = "com.google.protobuf:protoc:4.28.3"
} }
plugins { plugins {
create("grpc") { create("grpc") {
artifact = "io.grpc:protoc-gen-grpc-java:1.54.1" artifact = "io.grpc:protoc-gen-grpc-java:1.68.1"
} }
create("grpckt") { create("grpckt") {
artifact = "io.grpc:protoc-gen-grpc-kotlin:1.3.0:jdk8@jar" artifact = "io.grpc:protoc-gen-grpc-kotlin:1.4.1:jdk8@jar"
} }
} }
@ -96,10 +92,6 @@ publishing {
} }
} }
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "17"
}
tasks.withType<Wrapper> { tasks.withType<Wrapper> {
gradleVersion = "8.1.1" gradleVersion = "8.10.2"
} }

Binary file not shown.

View File

@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

27
Clients/Java/gradlew vendored
View File

@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
# SPDX-License-Identifier: Apache-2.0
#
############################################################################## ##############################################################################
# #
@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop. # Darwin, MinGW, and NonStop.
# #
# (3) This script is generated from the Groovy template # (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project. # within the Gradle project.
# #
# You can find Gradle at https://github.com/gradle/gradle/. # You can find Gradle at https://github.com/gradle/gradle/.
@ -83,7 +85,9 @@ done
# This is normally unused # This is normally unused
# shellcheck disable=SC2034 # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum
@ -130,10 +134,13 @@ location of your Java installation."
fi fi
else else
JAVACMD=java JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
@ -141,7 +148,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #( case $MAX_FD in #(
max*) max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045 # shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) || MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit" warn "Could not query maximum file descriptor limit"
esac esac
@ -149,7 +156,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #( '' | soft) :;; #(
*) *)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045 # shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" || ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD" warn "Could not set maximum file descriptor limit to $MAX_FD"
esac esac
@ -198,11 +205,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command; # Collect all arguments for the java command:
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# shell script including quotes and variable substitutions, so put them in # and any embedded shellness will be escaped.
# double quotes to make sure that they get re-expanded; and # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# * put everything else in single quotes, so that it's not re-expanded. # treated as '${Hostname}' itself on the command line.
set -- \ set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \ "-Dorg.gradle.appname=$APP_BASE_NAME" \

View File

@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and @rem See the License for the specific language governing permissions and
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################
@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute if %ERRORLEVEL% equ 0 goto execute
echo. echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. echo location of your Java installation. 1>&2
goto fail goto fail
@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute if exist "%JAVA_EXE%" goto execute
echo. echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. echo location of your Java installation. 1>&2
goto fail goto fail

View File

@ -13,17 +13,11 @@ dependencies {
implementation("org.jetbrains.kotlin:kotlin-bom") implementation("org.jetbrains.kotlin:kotlin-bom")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.0-RC") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0")
implementation(rootProject) implementation(rootProject)
} }
java {
val javaVersion = JavaVersion.toVersion(17)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}
application { application {
mainClass.set("gay.pizza.stable.diffusion.sample.MainKt") mainClass.set("gay.pizza.stable.diffusion.sample.MainKt")
} }

View File

@ -10,10 +10,10 @@ let package = Package(
.executable(name: "stable-diffusion-ctl", targets: ["StableDiffusionControl"]) .executable(name: "stable-diffusion-ctl", targets: ["StableDiffusionControl"])
], ],
dependencies: [ dependencies: [
.package(url: "https://github.com/apple/ml-stable-diffusion.git", revision: "5d2744e38297b01662b8bdfb41e899ac98036d8b"), .package(url: "https://github.com/apple/ml-stable-diffusion.git", revision: "bef26ae4ff14e6a07551c9e6a1dd25675a830249"),
.package(url: "https://github.com/apple/swift-protobuf.git", from: "1.6.0"), .package(url: "https://github.com/apple/swift-protobuf.git", from: "1.28.2"),
.package(url: "https://github.com/grpc/grpc-swift.git", from: "1.15.0"), .package(url: "https://github.com/grpc/grpc-swift.git", from: "1.24.1"),
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.2.0") .package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.3.0")
], ],
targets: [ targets: [
.target(name: "StableDiffusionProtos", dependencies: [ .target(name: "StableDiffusionProtos", dependencies: [

View File

@ -3,7 +3,7 @@ import GRPC
import StableDiffusionCore import StableDiffusionCore
import StableDiffusionProtos import StableDiffusionProtos
class HostModelServiceProvider: SdHostModelServiceAsyncProvider { final class HostModelServiceProvider: SdHostModelServiceAsyncProvider {
private let modelManager: ModelManager private let modelManager: ModelManager
init(modelManager: ModelManager) { init(modelManager: ModelManager) {

View File

@ -3,7 +3,7 @@ import GRPC
import StableDiffusionCore import StableDiffusionCore
import StableDiffusionProtos import StableDiffusionProtos
class ImageGenerationServiceProvider: SdImageGenerationServiceAsyncProvider { final class ImageGenerationServiceProvider: SdImageGenerationServiceAsyncProvider {
private let jobManager: JobManager private let jobManager: JobManager
private let modelManager: ModelManager private let modelManager: ModelManager

View File

@ -3,7 +3,7 @@ import GRPC
import StableDiffusionCore import StableDiffusionCore
import StableDiffusionProtos import StableDiffusionProtos
class JobServiceProvider: SdJobServiceAsyncProvider { final class JobServiceProvider: SdJobServiceAsyncProvider {
private let jobManager: JobManager private let jobManager: JobManager
init(jobManager: JobManager) { init(jobManager: JobManager) {

View File

@ -3,7 +3,7 @@ import GRPC
import StableDiffusionCore import StableDiffusionCore
import StableDiffusionProtos import StableDiffusionProtos
class ModelServiceProvider: SdModelServiceAsyncProvider { final class ModelServiceProvider: SdModelServiceAsyncProvider {
private let modelManager: ModelManager private let modelManager: ModelManager
init(modelManager: ModelManager) { init(modelManager: ModelManager) {

View File

@ -3,7 +3,7 @@ import GRPC
import StableDiffusionCore import StableDiffusionCore
import StableDiffusionProtos import StableDiffusionProtos
class ServerMetadataServiceProvider: SdServerMetadataServiceAsyncProvider { final class ServerMetadataServiceProvider: SdServerMetadataServiceAsyncProvider {
func getServerMetadata(request _: SdGetServerMetadataRequest, context _: GRPCAsyncServerCallContext) async throws -> SdGetServerMetadataResponse { func getServerMetadata(request _: SdGetServerMetadataRequest, context _: GRPCAsyncServerCallContext) async throws -> SdGetServerMetadataResponse {
.with { response in .with { response in
response.metadata = .with { metadata in response.metadata = .with { metadata in

View File

@ -3,7 +3,7 @@ import GRPC
import StableDiffusionCore import StableDiffusionCore
import StableDiffusionProtos import StableDiffusionProtos
class TokenizerServiceProvider: SdTokenizerServiceAsyncProvider { final class TokenizerServiceProvider: SdTokenizerServiceAsyncProvider {
private let modelManager: ModelManager private let modelManager: ModelManager
init(modelManager: ModelManager) { init(modelManager: ModelManager) {

View File

@ -1,25 +1,10 @@
// //
// DO NOT EDIT. // DO NOT EDIT.
// swift-format-ignore-file
// //
// Generated by the protocol buffer compiler. // Generated by the protocol buffer compiler.
// Source: host.proto // Source: host.proto
// //
//
// Copyright 2018, gRPC Authors All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import GRPC import GRPC
import NIO import NIO
import NIOConcurrencyHelpers import NIOConcurrencyHelpers
@ -65,10 +50,8 @@ extension SdHostModelServiceClientProtocol {
} }
} }
#if compiler(>=5.6)
@available(*, deprecated) @available(*, deprecated)
extension SdHostModelServiceClient: @unchecked Sendable {} extension SdHostModelServiceClient: @unchecked Sendable {}
#endif // compiler(>=5.6)
@available(*, deprecated, renamed: "SdHostModelServiceNIOClient") @available(*, deprecated, renamed: "SdHostModelServiceNIOClient")
public final class SdHostModelServiceClient: SdHostModelServiceClientProtocol { public final class SdHostModelServiceClient: SdHostModelServiceClientProtocol {
@ -124,7 +107,6 @@ public struct SdHostModelServiceNIOClient: SdHostModelServiceClientProtocol {
} }
} }
#if compiler(>=5.6)
///* ///*
/// The model service, for management and loading of models. /// The model service, for management and loading of models.
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
@ -193,9 +175,7 @@ public struct SdHostModelServiceAsyncClient: SdHostModelServiceAsyncClientProtoc
} }
} }
#endif // compiler(>=5.6) public protocol SdHostModelServiceClientInterceptorFactoryProtocol: Sendable {
public protocol SdHostModelServiceClientInterceptorFactoryProtocol: GRPCSendable {
/// - Returns: Interceptors to use when invoking 'loadModel'. /// - Returns: Interceptors to use when invoking 'loadModel'.
func makeLoadModelInterceptors() -> [ClientInterceptor<SdLoadModelRequest, SdLoadModelResponse>] func makeLoadModelInterceptors() -> [ClientInterceptor<SdLoadModelRequest, SdLoadModelResponse>]
@ -258,20 +238,18 @@ extension SdHostModelServiceProvider {
} }
} }
#if compiler(>=5.6)
///* ///*
/// The model service, for management and loading of models. /// The model service, for management and loading of models.
/// ///
/// To implement a server, implement an object which conforms to this protocol. /// To implement a server, implement an object which conforms to this protocol.
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
public protocol SdHostModelServiceAsyncProvider: CallHandlerProvider { public protocol SdHostModelServiceAsyncProvider: CallHandlerProvider, Sendable {
static var serviceDescriptor: GRPCServiceDescriptor { get } static var serviceDescriptor: GRPCServiceDescriptor { get }
var interceptors: SdHostModelServiceServerInterceptorFactoryProtocol? { get } var interceptors: SdHostModelServiceServerInterceptorFactoryProtocol? { get }
///* ///*
/// Loads a model onto a compute unit. /// Loads a model onto a compute unit.
@Sendable func loadModel( func loadModel(
request: SdLoadModelRequest, request: SdLoadModelRequest,
context: GRPCAsyncServerCallContext context: GRPCAsyncServerCallContext
) async throws -> SdLoadModelResponse ) async throws -> SdLoadModelResponse
@ -302,7 +280,7 @@ extension SdHostModelServiceAsyncProvider {
requestDeserializer: ProtobufDeserializer<SdLoadModelRequest>(), requestDeserializer: ProtobufDeserializer<SdLoadModelRequest>(),
responseSerializer: ProtobufSerializer<SdLoadModelResponse>(), responseSerializer: ProtobufSerializer<SdLoadModelResponse>(),
interceptors: self.interceptors?.makeLoadModelInterceptors() ?? [], interceptors: self.interceptors?.makeLoadModelInterceptors() ?? [],
wrapping: self.loadModel(request:context:) wrapping: { try await self.loadModel(request: $0, context: $1) }
) )
default: default:
@ -311,9 +289,7 @@ extension SdHostModelServiceAsyncProvider {
} }
} }
#endif // compiler(>=5.6) public protocol SdHostModelServiceServerInterceptorFactoryProtocol: Sendable {
public protocol SdHostModelServiceServerInterceptorFactoryProtocol {
/// - Returns: Interceptors to use when handling 'loadModel'. /// - Returns: Interceptors to use when handling 'loadModel'.
/// Defaults to calling `self.makeInterceptors()`. /// Defaults to calling `self.makeInterceptors()`.

View File

@ -1,5 +1,6 @@
// DO NOT EDIT. // DO NOT EDIT.
// swift-format-ignore-file // swift-format-ignore-file
// swiftlint:disable all
// //
// Generated by the Swift generator plugin for the protocol buffer compiler. // Generated by the Swift generator plugin for the protocol buffer compiler.
// Source: host.proto // Source: host.proto
@ -10,7 +11,6 @@
///* ///*
/// Host management for the Stable Diffusion RPC service. /// Host management for the Stable Diffusion RPC service.
import Foundation
import SwiftProtobuf import SwiftProtobuf
// If the compiler emits an error on this type, it is because this file // If the compiler emits an error on this type, it is because this file
@ -25,7 +25,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP
///* ///*
/// Represents a request to load a model into a specified compute unit. /// Represents a request to load a model into a specified compute unit.
public struct SdLoadModelRequest { public struct SdLoadModelRequest: Sendable {
// SwiftProtobuf.Message conformance is added in an extension below. See the // SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages. // methods supported on all messages.
@ -45,7 +45,7 @@ public struct SdLoadModelRequest {
///* ///*
/// Represents a response to loading a model. /// Represents a response to loading a model.
public struct SdLoadModelResponse { public struct SdLoadModelResponse: Sendable {
// SwiftProtobuf.Message conformance is added in an extension below. See the // SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages. // methods supported on all messages.
@ -55,11 +55,6 @@ public struct SdLoadModelResponse {
public init() {} public init() {}
} }
#if swift(>=5.5) && canImport(_Concurrency)
extension SdLoadModelRequest: @unchecked Sendable {}
extension SdLoadModelResponse: @unchecked Sendable {}
#endif // swift(>=5.5) && canImport(_Concurrency)
// MARK: - Code below here is support for the SwiftProtobuf runtime. // MARK: - Code below here is support for the SwiftProtobuf runtime.
fileprivate let _protobuf_package = "gay.pizza.stable.diffusion" fileprivate let _protobuf_package = "gay.pizza.stable.diffusion"
@ -107,8 +102,8 @@ extension SdLoadModelResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImpl
public static let _protobuf_nameMap = SwiftProtobuf._NameMap() public static let _protobuf_nameMap = SwiftProtobuf._NameMap()
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws { public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let _ = try decoder.nextFieldNumber() { // Load everything into unknown fields
} while try decoder.nextFieldNumber() != nil {}
} }
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws { public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {

View File

@ -1,25 +1,10 @@
// //
// DO NOT EDIT. // DO NOT EDIT.
// swift-format-ignore-file
// //
// Generated by the protocol buffer compiler. // Generated by the protocol buffer compiler.
// Source: image_generation.proto // Source: image_generation.proto
// //
//
// Copyright 2018, gRPC Authors All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import GRPC import GRPC
import NIO import NIO
import NIOConcurrencyHelpers import NIOConcurrencyHelpers
@ -93,10 +78,8 @@ extension SdImageGenerationServiceClientProtocol {
} }
} }
#if compiler(>=5.6)
@available(*, deprecated) @available(*, deprecated)
extension SdImageGenerationServiceClient: @unchecked Sendable {} extension SdImageGenerationServiceClient: @unchecked Sendable {}
#endif // compiler(>=5.6)
@available(*, deprecated, renamed: "SdImageGenerationServiceNIOClient") @available(*, deprecated, renamed: "SdImageGenerationServiceNIOClient")
public final class SdImageGenerationServiceClient: SdImageGenerationServiceClientProtocol { public final class SdImageGenerationServiceClient: SdImageGenerationServiceClientProtocol {
@ -152,7 +135,6 @@ public struct SdImageGenerationServiceNIOClient: SdImageGenerationServiceClientP
} }
} }
#if compiler(>=5.6)
///* ///*
/// The image generation service, for generating images from loaded models. /// The image generation service, for generating images from loaded models.
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
@ -250,9 +232,7 @@ public struct SdImageGenerationServiceAsyncClient: SdImageGenerationServiceAsync
} }
} }
#endif // compiler(>=5.6) public protocol SdImageGenerationServiceClientInterceptorFactoryProtocol: Sendable {
public protocol SdImageGenerationServiceClientInterceptorFactoryProtocol: GRPCSendable {
/// - Returns: Interceptors to use when invoking 'generateImages'. /// - Returns: Interceptors to use when invoking 'generateImages'.
func makeGenerateImagesInterceptors() -> [ClientInterceptor<SdGenerateImagesRequest, SdGenerateImagesResponse>] func makeGenerateImagesInterceptors() -> [ClientInterceptor<SdGenerateImagesRequest, SdGenerateImagesResponse>]
@ -338,27 +318,25 @@ extension SdImageGenerationServiceProvider {
} }
} }
#if compiler(>=5.6)
///* ///*
/// The image generation service, for generating images from loaded models. /// The image generation service, for generating images from loaded models.
/// ///
/// To implement a server, implement an object which conforms to this protocol. /// To implement a server, implement an object which conforms to this protocol.
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
public protocol SdImageGenerationServiceAsyncProvider: CallHandlerProvider { public protocol SdImageGenerationServiceAsyncProvider: CallHandlerProvider, Sendable {
static var serviceDescriptor: GRPCServiceDescriptor { get } static var serviceDescriptor: GRPCServiceDescriptor { get }
var interceptors: SdImageGenerationServiceServerInterceptorFactoryProtocol? { get } var interceptors: SdImageGenerationServiceServerInterceptorFactoryProtocol? { get }
///* ///*
/// Generates images using a loaded model. /// Generates images using a loaded model.
@Sendable func generateImages( func generateImages(
request: SdGenerateImagesRequest, request: SdGenerateImagesRequest,
context: GRPCAsyncServerCallContext context: GRPCAsyncServerCallContext
) async throws -> SdGenerateImagesResponse ) async throws -> SdGenerateImagesResponse
///* ///*
/// Generates images using a loaded model, providing updates along the way. /// Generates images using a loaded model, providing updates along the way.
@Sendable func generateImagesStreaming( func generateImagesStreaming(
request: SdGenerateImagesRequest, request: SdGenerateImagesRequest,
responseStream: GRPCAsyncResponseStreamWriter<SdGenerateImagesStreamUpdate>, responseStream: GRPCAsyncResponseStreamWriter<SdGenerateImagesStreamUpdate>,
context: GRPCAsyncServerCallContext context: GRPCAsyncServerCallContext
@ -390,7 +368,7 @@ extension SdImageGenerationServiceAsyncProvider {
requestDeserializer: ProtobufDeserializer<SdGenerateImagesRequest>(), requestDeserializer: ProtobufDeserializer<SdGenerateImagesRequest>(),
responseSerializer: ProtobufSerializer<SdGenerateImagesResponse>(), responseSerializer: ProtobufSerializer<SdGenerateImagesResponse>(),
interceptors: self.interceptors?.makeGenerateImagesInterceptors() ?? [], interceptors: self.interceptors?.makeGenerateImagesInterceptors() ?? [],
wrapping: self.generateImages(request:context:) wrapping: { try await self.generateImages(request: $0, context: $1) }
) )
case "GenerateImagesStreaming": case "GenerateImagesStreaming":
@ -399,7 +377,7 @@ extension SdImageGenerationServiceAsyncProvider {
requestDeserializer: ProtobufDeserializer<SdGenerateImagesRequest>(), requestDeserializer: ProtobufDeserializer<SdGenerateImagesRequest>(),
responseSerializer: ProtobufSerializer<SdGenerateImagesStreamUpdate>(), responseSerializer: ProtobufSerializer<SdGenerateImagesStreamUpdate>(),
interceptors: self.interceptors?.makeGenerateImagesStreamingInterceptors() ?? [], interceptors: self.interceptors?.makeGenerateImagesStreamingInterceptors() ?? [],
wrapping: self.generateImagesStreaming(request:responseStream:context:) wrapping: { try await self.generateImagesStreaming(request: $0, responseStream: $1, context: $2) }
) )
default: default:
@ -408,9 +386,7 @@ extension SdImageGenerationServiceAsyncProvider {
} }
} }
#endif // compiler(>=5.6) public protocol SdImageGenerationServiceServerInterceptorFactoryProtocol: Sendable {
public protocol SdImageGenerationServiceServerInterceptorFactoryProtocol {
/// - Returns: Interceptors to use when handling 'generateImages'. /// - Returns: Interceptors to use when handling 'generateImages'.
/// Defaults to calling `self.makeInterceptors()`. /// Defaults to calling `self.makeInterceptors()`.

View File

@ -1,5 +1,6 @@
// DO NOT EDIT. // DO NOT EDIT.
// swift-format-ignore-file // swift-format-ignore-file
// swiftlint:disable all
// //
// Generated by the Swift generator plugin for the protocol buffer compiler. // Generated by the Swift generator plugin for the protocol buffer compiler.
// Source: image_generation.proto // Source: image_generation.proto
@ -10,7 +11,6 @@
///* ///*
/// Image generation for the Stable Diffusion RPC service. /// Image generation for the Stable Diffusion RPC service.
import Foundation
import SwiftProtobuf import SwiftProtobuf
// If the compiler emits an error on this type, it is because this file // If the compiler emits an error on this type, it is because this file
@ -25,7 +25,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP
///* ///*
/// Represents a request to generate images using a loaded model. /// Represents a request to generate images using a loaded model.
public struct SdGenerateImagesRequest { public struct SdGenerateImagesRequest: Sendable {
// SwiftProtobuf.Message conformance is added in an extension below. See the // SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages. // methods supported on all messages.
@ -109,7 +109,7 @@ public struct SdGenerateImagesRequest {
///* ///*
/// Represents the response from image generation. /// Represents the response from image generation.
public struct SdGenerateImagesResponse { public struct SdGenerateImagesResponse: Sendable {
// SwiftProtobuf.Message conformance is added in an extension below. See the // SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages. // methods supported on all messages.
@ -129,7 +129,7 @@ public struct SdGenerateImagesResponse {
///* ///*
/// Represents a progress update for an image generation batch. /// Represents a progress update for an image generation batch.
public struct SdGenerateImagesBatchProgressUpdate { public struct SdGenerateImagesBatchProgressUpdate: Sendable {
// SwiftProtobuf.Message conformance is added in an extension below. See the // SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages. // methods supported on all messages.
@ -152,7 +152,7 @@ public struct SdGenerateImagesBatchProgressUpdate {
///* ///*
/// Represents a completion of an image generation batch. /// Represents a completion of an image generation batch.
public struct SdGenerateImagesBatchCompletedUpdate { public struct SdGenerateImagesBatchCompletedUpdate: Sendable {
// SwiftProtobuf.Message conformance is added in an extension below. See the // SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages. // methods supported on all messages.
@ -172,7 +172,7 @@ public struct SdGenerateImagesBatchCompletedUpdate {
///* ///*
/// Represents a continuous update from an image generation stream. /// Represents a continuous update from an image generation stream.
public struct SdGenerateImagesStreamUpdate { public struct SdGenerateImagesStreamUpdate: Sendable {
// SwiftProtobuf.Message conformance is added in an extension below. See the // SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages. // methods supported on all messages.
@ -217,7 +217,7 @@ public struct SdGenerateImagesStreamUpdate {
///* ///*
/// An update to the image generation pipeline. /// An update to the image generation pipeline.
public enum OneOf_Update: Equatable { public enum OneOf_Update: Equatable, Sendable {
///* ///*
/// Batch progress update. /// Batch progress update.
case batchProgress(SdGenerateImagesBatchProgressUpdate) case batchProgress(SdGenerateImagesBatchProgressUpdate)
@ -225,38 +225,11 @@ public struct SdGenerateImagesStreamUpdate {
/// Batch completion update. /// Batch completion update.
case batchCompleted(SdGenerateImagesBatchCompletedUpdate) case batchCompleted(SdGenerateImagesBatchCompletedUpdate)
#if !swift(>=4.1)
public static func ==(lhs: SdGenerateImagesStreamUpdate.OneOf_Update, rhs: SdGenerateImagesStreamUpdate.OneOf_Update) -> Bool {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every case branch when no optimizations are
// enabled. https://github.com/apple/swift-protobuf/issues/1034
switch (lhs, rhs) {
case (.batchProgress, .batchProgress): return {
guard case .batchProgress(let l) = lhs, case .batchProgress(let r) = rhs else { preconditionFailure() }
return l == r
}()
case (.batchCompleted, .batchCompleted): return {
guard case .batchCompleted(let l) = lhs, case .batchCompleted(let r) = rhs else { preconditionFailure() }
return l == r
}()
default: return false
}
}
#endif
} }
public init() {} public init() {}
} }
#if swift(>=5.5) && canImport(_Concurrency)
extension SdGenerateImagesRequest: @unchecked Sendable {}
extension SdGenerateImagesResponse: @unchecked Sendable {}
extension SdGenerateImagesBatchProgressUpdate: @unchecked Sendable {}
extension SdGenerateImagesBatchCompletedUpdate: @unchecked Sendable {}
extension SdGenerateImagesStreamUpdate: @unchecked Sendable {}
extension SdGenerateImagesStreamUpdate.OneOf_Update: @unchecked Sendable {}
#endif // swift(>=5.5) && canImport(_Concurrency)
// MARK: - Code below here is support for the SwiftProtobuf runtime. // MARK: - Code below here is support for the SwiftProtobuf runtime.
fileprivate let _protobuf_package = "gay.pizza.stable.diffusion" fileprivate let _protobuf_package = "gay.pizza.stable.diffusion"
@ -340,10 +313,10 @@ extension SdGenerateImagesRequest: SwiftProtobuf.Message, SwiftProtobuf._Message
if self.scheduler != .pndm { if self.scheduler != .pndm {
try visitor.visitSingularEnumField(value: self.scheduler, fieldNumber: 10) try visitor.visitSingularEnumField(value: self.scheduler, fieldNumber: 10)
} }
if self.guidanceScale != 0 { if self.guidanceScale.bitPattern != 0 {
try visitor.visitSingularFloatField(value: self.guidanceScale, fieldNumber: 11) try visitor.visitSingularFloatField(value: self.guidanceScale, fieldNumber: 11)
} }
if self.strength != 0 { if self.strength.bitPattern != 0 {
try visitor.visitSingularFloatField(value: self.strength, fieldNumber: 12) try visitor.visitSingularFloatField(value: self.strength, fieldNumber: 12)
} }
if self.stepCount != 0 { if self.stepCount != 0 {
@ -434,7 +407,7 @@ extension SdGenerateImagesBatchProgressUpdate: SwiftProtobuf.Message, SwiftProto
} }
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws { public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if self.percentageComplete != 0 { if self.percentageComplete.bitPattern != 0 {
try visitor.visitSingularFloatField(value: self.percentageComplete, fieldNumber: 1) try visitor.visitSingularFloatField(value: self.percentageComplete, fieldNumber: 1)
} }
if !self.images.isEmpty { if !self.images.isEmpty {
@ -558,7 +531,7 @@ extension SdGenerateImagesStreamUpdate: SwiftProtobuf.Message, SwiftProtobuf._Me
}() }()
case nil: break case nil: break
} }
if self.overallPercentageComplete != 0 { if self.overallPercentageComplete.bitPattern != 0 {
try visitor.visitSingularFloatField(value: self.overallPercentageComplete, fieldNumber: 4) try visitor.visitSingularFloatField(value: self.overallPercentageComplete, fieldNumber: 4)
} }
if self.jobID != 0 { if self.jobID != 0 {

View File

@ -1,25 +1,10 @@
// //
// DO NOT EDIT. // DO NOT EDIT.
// swift-format-ignore-file
// //
// Generated by the protocol buffer compiler. // Generated by the protocol buffer compiler.
// Source: jobs.proto // Source: jobs.proto
// //
//
// Copyright 2018, gRPC Authors All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import GRPC import GRPC
import NIO import NIO
import NIOConcurrencyHelpers import NIOConcurrencyHelpers
@ -114,10 +99,8 @@ extension SdJobServiceClientProtocol {
} }
} }
#if compiler(>=5.6)
@available(*, deprecated) @available(*, deprecated)
extension SdJobServiceClient: @unchecked Sendable {} extension SdJobServiceClient: @unchecked Sendable {}
#endif // compiler(>=5.6)
@available(*, deprecated, renamed: "SdJobServiceNIOClient") @available(*, deprecated, renamed: "SdJobServiceNIOClient")
public final class SdJobServiceClient: SdJobServiceClientProtocol { public final class SdJobServiceClient: SdJobServiceClientProtocol {
@ -173,7 +156,6 @@ public struct SdJobServiceNIOClient: SdJobServiceClientProtocol {
} }
} }
#if compiler(>=5.6)
///* ///*
/// The job service, for inspecting and monitoring the state of jobs executing on the service. /// The job service, for inspecting and monitoring the state of jobs executing on the service.
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
@ -300,9 +282,7 @@ public struct SdJobServiceAsyncClient: SdJobServiceAsyncClientProtocol {
} }
} }
#endif // compiler(>=5.6) public protocol SdJobServiceClientInterceptorFactoryProtocol: Sendable {
public protocol SdJobServiceClientInterceptorFactoryProtocol: GRPCSendable {
/// - Returns: Interceptors to use when invoking 'getJob'. /// - Returns: Interceptors to use when invoking 'getJob'.
func makeGetJobInterceptors() -> [ClientInterceptor<SdGetJobRequest, SdGetJobResponse>] func makeGetJobInterceptors() -> [ClientInterceptor<SdGetJobRequest, SdGetJobResponse>]
@ -405,28 +385,26 @@ extension SdJobServiceProvider {
} }
} }
#if compiler(>=5.6)
///* ///*
/// The job service, for inspecting and monitoring the state of jobs executing on the service. /// The job service, for inspecting and monitoring the state of jobs executing on the service.
/// ///
/// To implement a server, implement an object which conforms to this protocol. /// To implement a server, implement an object which conforms to this protocol.
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
public protocol SdJobServiceAsyncProvider: CallHandlerProvider { public protocol SdJobServiceAsyncProvider: CallHandlerProvider, Sendable {
static var serviceDescriptor: GRPCServiceDescriptor { get } static var serviceDescriptor: GRPCServiceDescriptor { get }
var interceptors: SdJobServiceServerInterceptorFactoryProtocol? { get } var interceptors: SdJobServiceServerInterceptorFactoryProtocol? { get }
@Sendable func getJob( func getJob(
request: SdGetJobRequest, request: SdGetJobRequest,
context: GRPCAsyncServerCallContext context: GRPCAsyncServerCallContext
) async throws -> SdGetJobResponse ) async throws -> SdGetJobResponse
@Sendable func cancelJob( func cancelJob(
request: SdCancelJobRequest, request: SdCancelJobRequest,
context: GRPCAsyncServerCallContext context: GRPCAsyncServerCallContext
) async throws -> SdCancelJobResponse ) async throws -> SdCancelJobResponse
@Sendable func streamJobUpdates( func streamJobUpdates(
request: SdStreamJobUpdatesRequest, request: SdStreamJobUpdatesRequest,
responseStream: GRPCAsyncResponseStreamWriter<SdJobUpdate>, responseStream: GRPCAsyncResponseStreamWriter<SdJobUpdate>,
context: GRPCAsyncServerCallContext context: GRPCAsyncServerCallContext
@ -458,7 +436,7 @@ extension SdJobServiceAsyncProvider {
requestDeserializer: ProtobufDeserializer<SdGetJobRequest>(), requestDeserializer: ProtobufDeserializer<SdGetJobRequest>(),
responseSerializer: ProtobufSerializer<SdGetJobResponse>(), responseSerializer: ProtobufSerializer<SdGetJobResponse>(),
interceptors: self.interceptors?.makeGetJobInterceptors() ?? [], interceptors: self.interceptors?.makeGetJobInterceptors() ?? [],
wrapping: self.getJob(request:context:) wrapping: { try await self.getJob(request: $0, context: $1) }
) )
case "CancelJob": case "CancelJob":
@ -467,7 +445,7 @@ extension SdJobServiceAsyncProvider {
requestDeserializer: ProtobufDeserializer<SdCancelJobRequest>(), requestDeserializer: ProtobufDeserializer<SdCancelJobRequest>(),
responseSerializer: ProtobufSerializer<SdCancelJobResponse>(), responseSerializer: ProtobufSerializer<SdCancelJobResponse>(),
interceptors: self.interceptors?.makeCancelJobInterceptors() ?? [], interceptors: self.interceptors?.makeCancelJobInterceptors() ?? [],
wrapping: self.cancelJob(request:context:) wrapping: { try await self.cancelJob(request: $0, context: $1) }
) )
case "StreamJobUpdates": case "StreamJobUpdates":
@ -476,7 +454,7 @@ extension SdJobServiceAsyncProvider {
requestDeserializer: ProtobufDeserializer<SdStreamJobUpdatesRequest>(), requestDeserializer: ProtobufDeserializer<SdStreamJobUpdatesRequest>(),
responseSerializer: ProtobufSerializer<SdJobUpdate>(), responseSerializer: ProtobufSerializer<SdJobUpdate>(),
interceptors: self.interceptors?.makeStreamJobUpdatesInterceptors() ?? [], interceptors: self.interceptors?.makeStreamJobUpdatesInterceptors() ?? [],
wrapping: self.streamJobUpdates(request:responseStream:context:) wrapping: { try await self.streamJobUpdates(request: $0, responseStream: $1, context: $2) }
) )
default: default:
@ -485,9 +463,7 @@ extension SdJobServiceAsyncProvider {
} }
} }
#endif // compiler(>=5.6) public protocol SdJobServiceServerInterceptorFactoryProtocol: Sendable {
public protocol SdJobServiceServerInterceptorFactoryProtocol {
/// - Returns: Interceptors to use when handling 'getJob'. /// - Returns: Interceptors to use when handling 'getJob'.
/// Defaults to calling `self.makeInterceptors()`. /// Defaults to calling `self.makeInterceptors()`.

View File

@ -1,5 +1,6 @@
// DO NOT EDIT. // DO NOT EDIT.
// swift-format-ignore-file // swift-format-ignore-file
// swiftlint:disable all
// //
// Generated by the Swift generator plugin for the protocol buffer compiler. // Generated by the Swift generator plugin for the protocol buffer compiler.
// Source: jobs.proto // Source: jobs.proto
@ -10,7 +11,6 @@
///* ///*
/// Job management for the Stable Diffusion RPC service. /// Job management for the Stable Diffusion RPC service.
import Foundation
import SwiftProtobuf import SwiftProtobuf
// If the compiler emits an error on this type, it is because this file // If the compiler emits an error on this type, it is because this file
@ -25,7 +25,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP
///* ///*
/// Represents the current state of a job. /// Represents the current state of a job.
public enum SdJobState: SwiftProtobuf.Enum { public enum SdJobState: SwiftProtobuf.Enum, Swift.CaseIterable {
public typealias RawValue = Int public typealias RawValue = Int
///* ///*
@ -75,26 +75,20 @@ public enum SdJobState: SwiftProtobuf.Enum {
} }
} }
}
#if swift(>=4.2)
extension SdJobState: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case. // The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [SdJobState] = [ public static let allCases: [SdJobState] = [
.unknownState, .unknownState,
.queued, .queued,
.running, .running,
.completed, .completed,
.cancelled, .cancelled,
] ]
}
#endif // swift(>=4.2) }
///* ///*
/// Represents a job that is active /// Represents a job that is active
public struct SdJob { public struct SdJob: Sendable {
// SwiftProtobuf.Message conformance is added in an extension below. See the // SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages. // methods supported on all messages.
@ -122,7 +116,7 @@ public struct SdJob {
///* ///*
/// Represents a request to get the state of a job. /// Represents a request to get the state of a job.
public struct SdGetJobRequest { public struct SdGetJobRequest: Sendable {
// SwiftProtobuf.Message conformance is added in an extension below. See the // SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages. // methods supported on all messages.
@ -138,7 +132,7 @@ public struct SdGetJobRequest {
///* ///*
/// Represents a response to getting the state of a job. /// Represents a response to getting the state of a job.
public struct SdGetJobResponse { public struct SdGetJobResponse: Sendable {
// SwiftProtobuf.Message conformance is added in an extension below. See the // SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages. // methods supported on all messages.
@ -163,7 +157,7 @@ public struct SdGetJobResponse {
///* ///*
/// Represents a request to cancel a job. /// Represents a request to cancel a job.
public struct SdCancelJobRequest { public struct SdCancelJobRequest: Sendable {
// SwiftProtobuf.Message conformance is added in an extension below. See the // SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages. // methods supported on all messages.
@ -179,7 +173,7 @@ public struct SdCancelJobRequest {
///* ///*
/// Represents a response to cancel a job. /// Represents a response to cancel a job.
public struct SdCancelJobResponse { public struct SdCancelJobResponse: Sendable {
// SwiftProtobuf.Message conformance is added in an extension below. See the // SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages. // methods supported on all messages.
@ -191,7 +185,7 @@ public struct SdCancelJobResponse {
///* ///*
/// Represents a request to stream job updates. /// Represents a request to stream job updates.
public struct SdStreamJobUpdatesRequest { public struct SdStreamJobUpdatesRequest: Sendable {
// SwiftProtobuf.Message conformance is added in an extension below. See the // SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages. // methods supported on all messages.
@ -208,7 +202,7 @@ public struct SdStreamJobUpdatesRequest {
///* ///*
/// Represents an update to a job. /// Represents an update to a job.
public struct SdJobUpdate { public struct SdJobUpdate: Sendable {
// SwiftProtobuf.Message conformance is added in an extension below. See the // SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages. // methods supported on all messages.
@ -231,17 +225,6 @@ public struct SdJobUpdate {
fileprivate var _job: SdJob? = nil fileprivate var _job: SdJob? = nil
} }
#if swift(>=5.5) && canImport(_Concurrency)
extension SdJobState: @unchecked Sendable {}
extension SdJob: @unchecked Sendable {}
extension SdGetJobRequest: @unchecked Sendable {}
extension SdGetJobResponse: @unchecked Sendable {}
extension SdCancelJobRequest: @unchecked Sendable {}
extension SdCancelJobResponse: @unchecked Sendable {}
extension SdStreamJobUpdatesRequest: @unchecked Sendable {}
extension SdJobUpdate: @unchecked Sendable {}
#endif // swift(>=5.5) && canImport(_Concurrency)
// MARK: - Code below here is support for the SwiftProtobuf runtime. // MARK: - Code below here is support for the SwiftProtobuf runtime.
fileprivate let _protobuf_package = "gay.pizza.stable.diffusion" fileprivate let _protobuf_package = "gay.pizza.stable.diffusion"
@ -290,7 +273,7 @@ extension SdJob: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase
if self.state != .unknownState { if self.state != .unknownState {
try visitor.visitSingularEnumField(value: self.state, fieldNumber: 3) try visitor.visitSingularEnumField(value: self.state, fieldNumber: 3)
} }
if self.overallPercentageComplete != 0 { if self.overallPercentageComplete.bitPattern != 0 {
try visitor.visitSingularFloatField(value: self.overallPercentageComplete, fieldNumber: 4) try visitor.visitSingularFloatField(value: self.overallPercentageComplete, fieldNumber: 4)
} }
try unknownFields.traverse(visitor: &visitor) try unknownFields.traverse(visitor: &visitor)
@ -411,8 +394,8 @@ extension SdCancelJobResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImpl
public static let _protobuf_nameMap = SwiftProtobuf._NameMap() public static let _protobuf_nameMap = SwiftProtobuf._NameMap()
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws { public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let _ = try decoder.nextFieldNumber() { // Load everything into unknown fields
} while try decoder.nextFieldNumber() != nil {}
} }
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws { public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {

View File

@ -1,25 +1,10 @@
// //
// DO NOT EDIT. // DO NOT EDIT.
// swift-format-ignore-file
// //
// Generated by the protocol buffer compiler. // Generated by the protocol buffer compiler.
// Source: metadata.proto // Source: metadata.proto
// //
//
// Copyright 2018, gRPC Authors All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import GRPC import GRPC
import NIO import NIO
import NIOConcurrencyHelpers import NIOConcurrencyHelpers
@ -61,10 +46,8 @@ extension SdServerMetadataServiceClientProtocol {
} }
} }
#if compiler(>=5.6)
@available(*, deprecated) @available(*, deprecated)
extension SdServerMetadataServiceClient: @unchecked Sendable {} extension SdServerMetadataServiceClient: @unchecked Sendable {}
#endif // compiler(>=5.6)
@available(*, deprecated, renamed: "SdServerMetadataServiceNIOClient") @available(*, deprecated, renamed: "SdServerMetadataServiceNIOClient")
public final class SdServerMetadataServiceClient: SdServerMetadataServiceClientProtocol { public final class SdServerMetadataServiceClient: SdServerMetadataServiceClientProtocol {
@ -120,7 +103,6 @@ public struct SdServerMetadataServiceNIOClient: SdServerMetadataServiceClientPro
} }
} }
#if compiler(>=5.6)
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
public protocol SdServerMetadataServiceAsyncClientProtocol: GRPCClient { public protocol SdServerMetadataServiceAsyncClientProtocol: GRPCClient {
static var serviceDescriptor: GRPCServiceDescriptor { get } static var serviceDescriptor: GRPCServiceDescriptor { get }
@ -187,9 +169,7 @@ public struct SdServerMetadataServiceAsyncClient: SdServerMetadataServiceAsyncCl
} }
} }
#endif // compiler(>=5.6) public protocol SdServerMetadataServiceClientInterceptorFactoryProtocol: Sendable {
public protocol SdServerMetadataServiceClientInterceptorFactoryProtocol: GRPCSendable {
/// - Returns: Interceptors to use when invoking 'getServerMetadata'. /// - Returns: Interceptors to use when invoking 'getServerMetadata'.
func makeGetServerMetadataInterceptors() -> [ClientInterceptor<SdGetServerMetadataRequest, SdGetServerMetadataResponse>] func makeGetServerMetadataInterceptors() -> [ClientInterceptor<SdGetServerMetadataRequest, SdGetServerMetadataResponse>]
@ -247,15 +227,13 @@ extension SdServerMetadataServiceProvider {
} }
} }
#if compiler(>=5.6)
/// To implement a server, implement an object which conforms to this protocol. /// To implement a server, implement an object which conforms to this protocol.
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
public protocol SdServerMetadataServiceAsyncProvider: CallHandlerProvider { public protocol SdServerMetadataServiceAsyncProvider: CallHandlerProvider, Sendable {
static var serviceDescriptor: GRPCServiceDescriptor { get } static var serviceDescriptor: GRPCServiceDescriptor { get }
var interceptors: SdServerMetadataServiceServerInterceptorFactoryProtocol? { get } var interceptors: SdServerMetadataServiceServerInterceptorFactoryProtocol? { get }
@Sendable func getServerMetadata( func getServerMetadata(
request: SdGetServerMetadataRequest, request: SdGetServerMetadataRequest,
context: GRPCAsyncServerCallContext context: GRPCAsyncServerCallContext
) async throws -> SdGetServerMetadataResponse ) async throws -> SdGetServerMetadataResponse
@ -286,7 +264,7 @@ extension SdServerMetadataServiceAsyncProvider {
requestDeserializer: ProtobufDeserializer<SdGetServerMetadataRequest>(), requestDeserializer: ProtobufDeserializer<SdGetServerMetadataRequest>(),
responseSerializer: ProtobufSerializer<SdGetServerMetadataResponse>(), responseSerializer: ProtobufSerializer<SdGetServerMetadataResponse>(),
interceptors: self.interceptors?.makeGetServerMetadataInterceptors() ?? [], interceptors: self.interceptors?.makeGetServerMetadataInterceptors() ?? [],
wrapping: self.getServerMetadata(request:context:) wrapping: { try await self.getServerMetadata(request: $0, context: $1) }
) )
default: default:
@ -295,9 +273,7 @@ extension SdServerMetadataServiceAsyncProvider {
} }
} }
#endif // compiler(>=5.6) public protocol SdServerMetadataServiceServerInterceptorFactoryProtocol: Sendable {
public protocol SdServerMetadataServiceServerInterceptorFactoryProtocol {
/// - Returns: Interceptors to use when handling 'getServerMetadata'. /// - Returns: Interceptors to use when handling 'getServerMetadata'.
/// Defaults to calling `self.makeInterceptors()`. /// Defaults to calling `self.makeInterceptors()`.

View File

@ -1,5 +1,6 @@
// DO NOT EDIT. // DO NOT EDIT.
// swift-format-ignore-file // swift-format-ignore-file
// swiftlint:disable all
// //
// Generated by the Swift generator plugin for the protocol buffer compiler. // Generated by the Swift generator plugin for the protocol buffer compiler.
// Source: metadata.proto // Source: metadata.proto
@ -10,7 +11,6 @@
///* ///*
/// Server metadata for the Stable Diffusion RPC service. /// Server metadata for the Stable Diffusion RPC service.
import Foundation
import SwiftProtobuf import SwiftProtobuf
// If the compiler emits an error on this type, it is because this file // If the compiler emits an error on this type, it is because this file
@ -23,7 +23,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP
typealias Version = _2 typealias Version = _2
} }
public enum SdServerRole: SwiftProtobuf.Enum { public enum SdServerRole: SwiftProtobuf.Enum, Swift.CaseIterable {
public typealias RawValue = Int public typealias RawValue = Int
case unknownRole // = 0 case unknownRole // = 0
case node // = 1 case node // = 1
@ -52,22 +52,16 @@ public enum SdServerRole: SwiftProtobuf.Enum {
} }
} }
}
#if swift(>=4.2)
extension SdServerRole: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case. // The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [SdServerRole] = [ public static let allCases: [SdServerRole] = [
.unknownRole, .unknownRole,
.node, .node,
.coordinator, .coordinator,
] ]
} }
#endif // swift(>=4.2) public struct SdServerMetadata: Sendable {
public struct SdServerMetadata {
// SwiftProtobuf.Message conformance is added in an extension below. See the // SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages. // methods supported on all messages.
@ -79,7 +73,7 @@ public struct SdServerMetadata {
public init() {} public init() {}
} }
public struct SdGetServerMetadataRequest { public struct SdGetServerMetadataRequest: Sendable {
// SwiftProtobuf.Message conformance is added in an extension below. See the // SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages. // methods supported on all messages.
@ -89,7 +83,7 @@ public struct SdGetServerMetadataRequest {
public init() {} public init() {}
} }
public struct SdGetServerMetadataResponse { public struct SdGetServerMetadataResponse: Sendable {
// SwiftProtobuf.Message conformance is added in an extension below. See the // SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages. // methods supported on all messages.
@ -110,13 +104,6 @@ public struct SdGetServerMetadataResponse {
fileprivate var _metadata: SdServerMetadata? = nil fileprivate var _metadata: SdServerMetadata? = nil
} }
#if swift(>=5.5) && canImport(_Concurrency)
extension SdServerRole: @unchecked Sendable {}
extension SdServerMetadata: @unchecked Sendable {}
extension SdGetServerMetadataRequest: @unchecked Sendable {}
extension SdGetServerMetadataResponse: @unchecked Sendable {}
#endif // swift(>=5.5) && canImport(_Concurrency)
// MARK: - Code below here is support for the SwiftProtobuf runtime. // MARK: - Code below here is support for the SwiftProtobuf runtime.
fileprivate let _protobuf_package = "gay.pizza.stable.diffusion" fileprivate let _protobuf_package = "gay.pizza.stable.diffusion"
@ -166,8 +153,8 @@ extension SdGetServerMetadataRequest: SwiftProtobuf.Message, SwiftProtobuf._Mess
public static let _protobuf_nameMap = SwiftProtobuf._NameMap() public static let _protobuf_nameMap = SwiftProtobuf._NameMap()
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws { public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let _ = try decoder.nextFieldNumber() { // Load everything into unknown fields
} while try decoder.nextFieldNumber() != nil {}
} }
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws { public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {

View File

@ -1,25 +1,10 @@
// //
// DO NOT EDIT. // DO NOT EDIT.
// swift-format-ignore-file
// //
// Generated by the protocol buffer compiler. // Generated by the protocol buffer compiler.
// Source: model.proto // Source: model.proto
// //
//
// Copyright 2018, gRPC Authors All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import GRPC import GRPC
import NIO import NIO
import NIOConcurrencyHelpers import NIOConcurrencyHelpers
@ -66,10 +51,8 @@ extension SdModelServiceClientProtocol {
} }
} }
#if compiler(>=5.6)
@available(*, deprecated) @available(*, deprecated)
extension SdModelServiceClient: @unchecked Sendable {} extension SdModelServiceClient: @unchecked Sendable {}
#endif // compiler(>=5.6)
@available(*, deprecated, renamed: "SdModelServiceNIOClient") @available(*, deprecated, renamed: "SdModelServiceNIOClient")
public final class SdModelServiceClient: SdModelServiceClientProtocol { public final class SdModelServiceClient: SdModelServiceClientProtocol {
@ -125,7 +108,6 @@ public struct SdModelServiceNIOClient: SdModelServiceClientProtocol {
} }
} }
#if compiler(>=5.6)
///* ///*
/// The model service, for management and loading of models. /// The model service, for management and loading of models.
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
@ -194,9 +176,7 @@ public struct SdModelServiceAsyncClient: SdModelServiceAsyncClientProtocol {
} }
} }
#endif // compiler(>=5.6) public protocol SdModelServiceClientInterceptorFactoryProtocol: Sendable {
public protocol SdModelServiceClientInterceptorFactoryProtocol: GRPCSendable {
/// - Returns: Interceptors to use when invoking 'listModels'. /// - Returns: Interceptors to use when invoking 'listModels'.
func makeListModelsInterceptors() -> [ClientInterceptor<SdListModelsRequest, SdListModelsResponse>] func makeListModelsInterceptors() -> [ClientInterceptor<SdListModelsRequest, SdListModelsResponse>]
@ -260,21 +240,19 @@ extension SdModelServiceProvider {
} }
} }
#if compiler(>=5.6)
///* ///*
/// The model service, for management and loading of models. /// The model service, for management and loading of models.
/// ///
/// To implement a server, implement an object which conforms to this protocol. /// To implement a server, implement an object which conforms to this protocol.
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
public protocol SdModelServiceAsyncProvider: CallHandlerProvider { public protocol SdModelServiceAsyncProvider: CallHandlerProvider, Sendable {
static var serviceDescriptor: GRPCServiceDescriptor { get } static var serviceDescriptor: GRPCServiceDescriptor { get }
var interceptors: SdModelServiceServerInterceptorFactoryProtocol? { get } var interceptors: SdModelServiceServerInterceptorFactoryProtocol? { get }
///* ///*
/// Lists the available models on the host. /// Lists the available models on the host.
/// This will return both models that are currently loaded, and models that are not yet loaded. /// This will return both models that are currently loaded, and models that are not yet loaded.
@Sendable func listModels( func listModels(
request: SdListModelsRequest, request: SdListModelsRequest,
context: GRPCAsyncServerCallContext context: GRPCAsyncServerCallContext
) async throws -> SdListModelsResponse ) async throws -> SdListModelsResponse
@ -305,7 +283,7 @@ extension SdModelServiceAsyncProvider {
requestDeserializer: ProtobufDeserializer<SdListModelsRequest>(), requestDeserializer: ProtobufDeserializer<SdListModelsRequest>(),
responseSerializer: ProtobufSerializer<SdListModelsResponse>(), responseSerializer: ProtobufSerializer<SdListModelsResponse>(),
interceptors: self.interceptors?.makeListModelsInterceptors() ?? [], interceptors: self.interceptors?.makeListModelsInterceptors() ?? [],
wrapping: self.listModels(request:context:) wrapping: { try await self.listModels(request: $0, context: $1) }
) )
default: default:
@ -314,9 +292,7 @@ extension SdModelServiceAsyncProvider {
} }
} }
#endif // compiler(>=5.6) public protocol SdModelServiceServerInterceptorFactoryProtocol: Sendable {
public protocol SdModelServiceServerInterceptorFactoryProtocol {
/// - Returns: Interceptors to use when handling 'listModels'. /// - Returns: Interceptors to use when handling 'listModels'.
/// Defaults to calling `self.makeInterceptors()`. /// Defaults to calling `self.makeInterceptors()`.

View File

@ -1,5 +1,6 @@
// DO NOT EDIT. // DO NOT EDIT.
// swift-format-ignore-file // swift-format-ignore-file
// swiftlint:disable all
// //
// Generated by the Swift generator plugin for the protocol buffer compiler. // Generated by the Swift generator plugin for the protocol buffer compiler.
// Source: model.proto // Source: model.proto
@ -10,7 +11,6 @@
///* ///*
/// Host management for the Stable Diffusion RPC service. /// Host management for the Stable Diffusion RPC service.
import Foundation
import SwiftProtobuf import SwiftProtobuf
// If the compiler emits an error on this type, it is because this file // If the compiler emits an error on this type, it is because this file
@ -25,7 +25,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP
///* ///*
/// Represents a request to list the models available on the host. /// Represents a request to list the models available on the host.
public struct SdListModelsRequest { public struct SdListModelsRequest: Sendable {
// SwiftProtobuf.Message conformance is added in an extension below. See the // SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages. // methods supported on all messages.
@ -37,7 +37,7 @@ public struct SdListModelsRequest {
///* ///*
/// Represents a response to listing the models available on the host. /// Represents a response to listing the models available on the host.
public struct SdListModelsResponse { public struct SdListModelsResponse: Sendable {
// SwiftProtobuf.Message conformance is added in an extension below. See the // SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages. // methods supported on all messages.
@ -51,11 +51,6 @@ public struct SdListModelsResponse {
public init() {} public init() {}
} }
#if swift(>=5.5) && canImport(_Concurrency)
extension SdListModelsRequest: @unchecked Sendable {}
extension SdListModelsResponse: @unchecked Sendable {}
#endif // swift(>=5.5) && canImport(_Concurrency)
// MARK: - Code below here is support for the SwiftProtobuf runtime. // MARK: - Code below here is support for the SwiftProtobuf runtime.
fileprivate let _protobuf_package = "gay.pizza.stable.diffusion" fileprivate let _protobuf_package = "gay.pizza.stable.diffusion"
@ -65,8 +60,8 @@ extension SdListModelsRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImpl
public static let _protobuf_nameMap = SwiftProtobuf._NameMap() public static let _protobuf_nameMap = SwiftProtobuf._NameMap()
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws { public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let _ = try decoder.nextFieldNumber() { // Load everything into unknown fields
} while try decoder.nextFieldNumber() != nil {}
} }
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws { public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {

View File

@ -1,5 +1,6 @@
// DO NOT EDIT. // DO NOT EDIT.
// swift-format-ignore-file // swift-format-ignore-file
// swiftlint:disable all
// //
// Generated by the Swift generator plugin for the protocol buffer compiler. // Generated by the Swift generator plugin for the protocol buffer compiler.
// Source: shared.proto // Source: shared.proto
@ -26,7 +27,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP
///* ///*
/// Represents the model attention. Model attention has to do with how the model is encoded, and /// Represents the model attention. Model attention has to do with how the model is encoded, and
/// can determine what compute units are able to support a particular model. /// can determine what compute units are able to support a particular model.
public enum SdModelAttention: SwiftProtobuf.Enum { public enum SdModelAttention: SwiftProtobuf.Enum, Swift.CaseIterable {
public typealias RawValue = Int public typealias RawValue = Int
///* ///*
@ -59,23 +60,17 @@ public enum SdModelAttention: SwiftProtobuf.Enum {
} }
} }
}
#if swift(>=4.2)
extension SdModelAttention: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case. // The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [SdModelAttention] = [ public static let allCases: [SdModelAttention] = [
.original, .original,
.splitEinSum, .splitEinSum,
] ]
}
#endif // swift(>=4.2) }
///* ///*
/// Represents the schedulers that are used to sample images. /// Represents the schedulers that are used to sample images.
public enum SdScheduler: SwiftProtobuf.Enum { public enum SdScheduler: SwiftProtobuf.Enum, Swift.CaseIterable {
public typealias RawValue = Int public typealias RawValue = Int
///* ///*
@ -107,23 +102,17 @@ public enum SdScheduler: SwiftProtobuf.Enum {
} }
} }
}
#if swift(>=4.2)
extension SdScheduler: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case. // The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [SdScheduler] = [ public static let allCases: [SdScheduler] = [
.pndm, .pndm,
.dpmSolverPlusPlus, .dpmSolverPlusPlus,
] ]
}
#endif // swift(>=4.2) }
///* ///*
/// Represents a specifier for what compute units are available for ML tasks. /// Represents a specifier for what compute units are available for ML tasks.
public enum SdComputeUnits: SwiftProtobuf.Enum { public enum SdComputeUnits: SwiftProtobuf.Enum, Swift.CaseIterable {
public typealias RawValue = Int public typealias RawValue = Int
///* ///*
@ -167,25 +156,19 @@ public enum SdComputeUnits: SwiftProtobuf.Enum {
} }
} }
}
#if swift(>=4.2)
extension SdComputeUnits: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case. // The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [SdComputeUnits] = [ public static let allCases: [SdComputeUnits] = [
.cpu, .cpu,
.cpuAndGpu, .cpuAndGpu,
.all, .all,
.cpuAndNeuralEngine, .cpuAndNeuralEngine,
] ]
}
#endif // swift(>=4.2) }
///* ///*
/// Represents the format of an image. /// Represents the format of an image.
public enum SdImageFormat: SwiftProtobuf.Enum { public enum SdImageFormat: SwiftProtobuf.Enum, Swift.CaseIterable {
public typealias RawValue = Int public typealias RawValue = Int
///* ///*
@ -211,22 +194,16 @@ public enum SdImageFormat: SwiftProtobuf.Enum {
} }
} }
}
#if swift(>=4.2)
extension SdImageFormat: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case. // The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [SdImageFormat] = [ public static let allCases: [SdImageFormat] = [
.png, .png,
] ]
}
#endif // swift(>=4.2) }
///* ///*
/// Represents a 128-bit UUID value. /// Represents a 128-bit UUID value.
public struct SdUniqueIdentifier { public struct SdUniqueIdentifier: Sendable {
// SwiftProtobuf.Message conformance is added in an extension below. See the // SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages. // methods supported on all messages.
@ -247,7 +224,7 @@ public struct SdUniqueIdentifier {
///* ///*
/// Represents information about an available model. /// Represents information about an available model.
/// The primary key of a model is it's 'name' field. /// The primary key of a model is it's 'name' field.
public struct SdModelInfo { public struct SdModelInfo: Sendable {
// SwiftProtobuf.Message conformance is added in an extension below. See the // SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages. // methods supported on all messages.
@ -274,7 +251,7 @@ public struct SdModelInfo {
/// Represents an image within the Stable Diffusion context. /// Represents an image within the Stable Diffusion context.
/// This could be an input image for an image generation request, or it could be /// This could be an input image for an image generation request, or it could be
/// a generated image from the Stable Diffusion model. /// a generated image from the Stable Diffusion model.
public struct SdImage { public struct SdImage: @unchecked Sendable {
// SwiftProtobuf.Message conformance is added in an extension below. See the // SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages. // methods supported on all messages.
@ -292,16 +269,6 @@ public struct SdImage {
public init() {} public init() {}
} }
#if swift(>=5.5) && canImport(_Concurrency)
extension SdModelAttention: @unchecked Sendable {}
extension SdScheduler: @unchecked Sendable {}
extension SdComputeUnits: @unchecked Sendable {}
extension SdImageFormat: @unchecked Sendable {}
extension SdUniqueIdentifier: @unchecked Sendable {}
extension SdModelInfo: @unchecked Sendable {}
extension SdImage: @unchecked Sendable {}
#endif // swift(>=5.5) && canImport(_Concurrency)
// MARK: - Code below here is support for the SwiftProtobuf runtime. // MARK: - Code below here is support for the SwiftProtobuf runtime.
fileprivate let _protobuf_package = "gay.pizza.stable.diffusion" fileprivate let _protobuf_package = "gay.pizza.stable.diffusion"

View File

@ -1,25 +1,10 @@
// //
// DO NOT EDIT. // DO NOT EDIT.
// swift-format-ignore-file
// //
// Generated by the protocol buffer compiler. // Generated by the protocol buffer compiler.
// Source: tokenizer.proto // Source: tokenizer.proto
// //
//
// Copyright 2018, gRPC Authors All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import GRPC import GRPC
import NIO import NIO
import NIOConcurrencyHelpers import NIOConcurrencyHelpers
@ -65,10 +50,8 @@ extension SdTokenizerServiceClientProtocol {
} }
} }
#if compiler(>=5.6)
@available(*, deprecated) @available(*, deprecated)
extension SdTokenizerServiceClient: @unchecked Sendable {} extension SdTokenizerServiceClient: @unchecked Sendable {}
#endif // compiler(>=5.6)
@available(*, deprecated, renamed: "SdTokenizerServiceNIOClient") @available(*, deprecated, renamed: "SdTokenizerServiceNIOClient")
public final class SdTokenizerServiceClient: SdTokenizerServiceClientProtocol { public final class SdTokenizerServiceClient: SdTokenizerServiceClientProtocol {
@ -124,7 +107,6 @@ public struct SdTokenizerServiceNIOClient: SdTokenizerServiceClientProtocol {
} }
} }
#if compiler(>=5.6)
///* ///*
/// The tokenizer service, for analyzing tokens for a loaded model. /// The tokenizer service, for analyzing tokens for a loaded model.
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
@ -193,9 +175,7 @@ public struct SdTokenizerServiceAsyncClient: SdTokenizerServiceAsyncClientProtoc
} }
} }
#endif // compiler(>=5.6) public protocol SdTokenizerServiceClientInterceptorFactoryProtocol: Sendable {
public protocol SdTokenizerServiceClientInterceptorFactoryProtocol: GRPCSendable {
/// - Returns: Interceptors to use when invoking 'tokenize'. /// - Returns: Interceptors to use when invoking 'tokenize'.
func makeTokenizeInterceptors() -> [ClientInterceptor<SdTokenizeRequest, SdTokenizeResponse>] func makeTokenizeInterceptors() -> [ClientInterceptor<SdTokenizeRequest, SdTokenizeResponse>]
@ -258,20 +238,18 @@ extension SdTokenizerServiceProvider {
} }
} }
#if compiler(>=5.6)
///* ///*
/// The tokenizer service, for analyzing tokens for a loaded model. /// The tokenizer service, for analyzing tokens for a loaded model.
/// ///
/// To implement a server, implement an object which conforms to this protocol. /// To implement a server, implement an object which conforms to this protocol.
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
public protocol SdTokenizerServiceAsyncProvider: CallHandlerProvider { public protocol SdTokenizerServiceAsyncProvider: CallHandlerProvider, Sendable {
static var serviceDescriptor: GRPCServiceDescriptor { get } static var serviceDescriptor: GRPCServiceDescriptor { get }
var interceptors: SdTokenizerServiceServerInterceptorFactoryProtocol? { get } var interceptors: SdTokenizerServiceServerInterceptorFactoryProtocol? { get }
///* ///*
/// Analyze the input using a loaded model and return the results. /// Analyze the input using a loaded model and return the results.
@Sendable func tokenize( func tokenize(
request: SdTokenizeRequest, request: SdTokenizeRequest,
context: GRPCAsyncServerCallContext context: GRPCAsyncServerCallContext
) async throws -> SdTokenizeResponse ) async throws -> SdTokenizeResponse
@ -302,7 +280,7 @@ extension SdTokenizerServiceAsyncProvider {
requestDeserializer: ProtobufDeserializer<SdTokenizeRequest>(), requestDeserializer: ProtobufDeserializer<SdTokenizeRequest>(),
responseSerializer: ProtobufSerializer<SdTokenizeResponse>(), responseSerializer: ProtobufSerializer<SdTokenizeResponse>(),
interceptors: self.interceptors?.makeTokenizeInterceptors() ?? [], interceptors: self.interceptors?.makeTokenizeInterceptors() ?? [],
wrapping: self.tokenize(request:context:) wrapping: { try await self.tokenize(request: $0, context: $1) }
) )
default: default:
@ -311,9 +289,7 @@ extension SdTokenizerServiceAsyncProvider {
} }
} }
#endif // compiler(>=5.6) public protocol SdTokenizerServiceServerInterceptorFactoryProtocol: Sendable {
public protocol SdTokenizerServiceServerInterceptorFactoryProtocol {
/// - Returns: Interceptors to use when handling 'tokenize'. /// - Returns: Interceptors to use when handling 'tokenize'.
/// Defaults to calling `self.makeInterceptors()`. /// Defaults to calling `self.makeInterceptors()`.

View File

@ -1,5 +1,6 @@
// DO NOT EDIT. // DO NOT EDIT.
// swift-format-ignore-file // swift-format-ignore-file
// swiftlint:disable all
// //
// Generated by the Swift generator plugin for the protocol buffer compiler. // Generated by the Swift generator plugin for the protocol buffer compiler.
// Source: tokenizer.proto // Source: tokenizer.proto
@ -10,7 +11,6 @@
///* ///*
/// Tokenization for the Stable Diffusion RPC service. /// Tokenization for the Stable Diffusion RPC service.
import Foundation
import SwiftProtobuf import SwiftProtobuf
// If the compiler emits an error on this type, it is because this file // If the compiler emits an error on this type, it is because this file
@ -25,7 +25,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP
///* ///*
/// Represents a request to tokenize an input. /// Represents a request to tokenize an input.
public struct SdTokenizeRequest { public struct SdTokenizeRequest: Sendable {
// SwiftProtobuf.Message conformance is added in an extension below. See the // SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages. // methods supported on all messages.
@ -45,7 +45,7 @@ public struct SdTokenizeRequest {
///* ///*
/// Represents a response to tokenization. /// Represents a response to tokenization.
public struct SdTokenizeResponse { public struct SdTokenizeResponse: Sendable {
// SwiftProtobuf.Message conformance is added in an extension below. See the // SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages. // methods supported on all messages.
@ -63,11 +63,6 @@ public struct SdTokenizeResponse {
public init() {} public init() {}
} }
#if swift(>=5.5) && canImport(_Concurrency)
extension SdTokenizeRequest: @unchecked Sendable {}
extension SdTokenizeResponse: @unchecked Sendable {}
#endif // swift(>=5.5) && canImport(_Concurrency)
// MARK: - Code below here is support for the SwiftProtobuf runtime. // MARK: - Code below here is support for the SwiftProtobuf runtime.
fileprivate let _protobuf_package = "gay.pizza.stable.diffusion" fileprivate let _protobuf_package = "gay.pizza.stable.diffusion"