mirror of
https://github.com/GayPizzaSpecifications/stable-diffusion-rpc.git
synced 2025-08-03 05:30:54 +00:00
update to latest versions
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
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"
|
||||
version = "1.0.0-SNAPSHOT"
|
||||
@ -8,50 +8,46 @@ plugins {
|
||||
`java-library`
|
||||
`maven-publish`
|
||||
|
||||
kotlin("jvm") version "1.8.20"
|
||||
kotlin("plugin.serialization") version "1.8.20"
|
||||
kotlin("jvm") version "2.0.21"
|
||||
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 {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
java {
|
||||
val javaVersion = JavaVersion.toVersion(17)
|
||||
sourceCompatibility = javaVersion
|
||||
targetCompatibility = javaVersion
|
||||
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("org.jetbrains.kotlin:kotlin-bom")
|
||||
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-protobuf:1.54.1")
|
||||
api("io.grpc:grpc-kotlin-stub:1.3.0")
|
||||
implementation("com.google.protobuf:protobuf-java:3.22.3")
|
||||
api("io.grpc:grpc-stub:1.68.1")
|
||||
api("io.grpc:grpc-protobuf:1.68.1")
|
||||
api("io.grpc:grpc-kotlin-stub:1.4.1")
|
||||
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 {
|
||||
protoc {
|
||||
artifact = "com.google.protobuf:protoc:3.22.3"
|
||||
artifact = "com.google.protobuf:protoc:4.28.3"
|
||||
}
|
||||
|
||||
plugins {
|
||||
create("grpc") {
|
||||
artifact = "io.grpc:protoc-gen-grpc-java:1.54.1"
|
||||
artifact = "io.grpc:protoc-gen-grpc-java:1.68.1"
|
||||
}
|
||||
|
||||
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> {
|
||||
gradleVersion = "8.1.1"
|
||||
gradleVersion = "8.10.2"
|
||||
}
|
||||
|
BIN
Clients/Java/gradle/wrapper/gradle-wrapper.jar
vendored
BIN
Clients/Java/gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
@ -1,6 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
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
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
27
Clients/Java/gradlew
vendored
27
Clients/Java/gradlew
vendored
@ -15,6 +15,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
@ -55,7 +57,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (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.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@ -83,7 +85,9 @@ done
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
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.
|
||||
MAX_FD=maximum
|
||||
@ -130,10 +134,13 @@ location of your Java installation."
|
||||
fi
|
||||
else
|
||||
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
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
@ -141,7 +148,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# 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 ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
@ -149,7 +156,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# 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" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
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.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
|
22
Clients/Java/gradlew.bat
vendored
22
Clients/Java/gradlew.bat
vendored
@ -13,6 +13,8 @@
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
|
@ -13,17 +13,11 @@ dependencies {
|
||||
implementation("org.jetbrains.kotlin:kotlin-bom")
|
||||
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)
|
||||
}
|
||||
|
||||
java {
|
||||
val javaVersion = JavaVersion.toVersion(17)
|
||||
sourceCompatibility = javaVersion
|
||||
targetCompatibility = javaVersion
|
||||
}
|
||||
|
||||
application {
|
||||
mainClass.set("gay.pizza.stable.diffusion.sample.MainKt")
|
||||
}
|
||||
|
@ -10,10 +10,10 @@ let package = Package(
|
||||
.executable(name: "stable-diffusion-ctl", targets: ["StableDiffusionControl"])
|
||||
],
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/apple/ml-stable-diffusion.git", revision: "5d2744e38297b01662b8bdfb41e899ac98036d8b"),
|
||||
.package(url: "https://github.com/apple/swift-protobuf.git", from: "1.6.0"),
|
||||
.package(url: "https://github.com/grpc/grpc-swift.git", from: "1.15.0"),
|
||||
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.2.0")
|
||||
.package(url: "https://github.com/apple/ml-stable-diffusion.git", revision: "bef26ae4ff14e6a07551c9e6a1dd25675a830249"),
|
||||
.package(url: "https://github.com/apple/swift-protobuf.git", from: "1.28.2"),
|
||||
.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.3.0")
|
||||
],
|
||||
targets: [
|
||||
.target(name: "StableDiffusionProtos", dependencies: [
|
||||
|
@ -3,7 +3,7 @@ import GRPC
|
||||
import StableDiffusionCore
|
||||
import StableDiffusionProtos
|
||||
|
||||
class HostModelServiceProvider: SdHostModelServiceAsyncProvider {
|
||||
final class HostModelServiceProvider: SdHostModelServiceAsyncProvider {
|
||||
private let modelManager: ModelManager
|
||||
|
||||
init(modelManager: ModelManager) {
|
||||
|
@ -3,7 +3,7 @@ import GRPC
|
||||
import StableDiffusionCore
|
||||
import StableDiffusionProtos
|
||||
|
||||
class ImageGenerationServiceProvider: SdImageGenerationServiceAsyncProvider {
|
||||
final class ImageGenerationServiceProvider: SdImageGenerationServiceAsyncProvider {
|
||||
private let jobManager: JobManager
|
||||
private let modelManager: ModelManager
|
||||
|
||||
|
@ -3,7 +3,7 @@ import GRPC
|
||||
import StableDiffusionCore
|
||||
import StableDiffusionProtos
|
||||
|
||||
class JobServiceProvider: SdJobServiceAsyncProvider {
|
||||
final class JobServiceProvider: SdJobServiceAsyncProvider {
|
||||
private let jobManager: JobManager
|
||||
|
||||
init(jobManager: JobManager) {
|
||||
|
@ -3,7 +3,7 @@ import GRPC
|
||||
import StableDiffusionCore
|
||||
import StableDiffusionProtos
|
||||
|
||||
class ModelServiceProvider: SdModelServiceAsyncProvider {
|
||||
final class ModelServiceProvider: SdModelServiceAsyncProvider {
|
||||
private let modelManager: ModelManager
|
||||
|
||||
init(modelManager: ModelManager) {
|
||||
|
@ -3,7 +3,7 @@ import GRPC
|
||||
import StableDiffusionCore
|
||||
import StableDiffusionProtos
|
||||
|
||||
class ServerMetadataServiceProvider: SdServerMetadataServiceAsyncProvider {
|
||||
final class ServerMetadataServiceProvider: SdServerMetadataServiceAsyncProvider {
|
||||
func getServerMetadata(request _: SdGetServerMetadataRequest, context _: GRPCAsyncServerCallContext) async throws -> SdGetServerMetadataResponse {
|
||||
.with { response in
|
||||
response.metadata = .with { metadata in
|
||||
|
@ -3,7 +3,7 @@ import GRPC
|
||||
import StableDiffusionCore
|
||||
import StableDiffusionProtos
|
||||
|
||||
class TokenizerServiceProvider: SdTokenizerServiceAsyncProvider {
|
||||
final class TokenizerServiceProvider: SdTokenizerServiceAsyncProvider {
|
||||
private let modelManager: ModelManager
|
||||
|
||||
init(modelManager: ModelManager) {
|
||||
|
@ -1,25 +1,10 @@
|
||||
//
|
||||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
//
|
||||
// Generated by the protocol buffer compiler.
|
||||
// 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 NIO
|
||||
import NIOConcurrencyHelpers
|
||||
@ -65,10 +50,8 @@ extension SdHostModelServiceClientProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
#if compiler(>=5.6)
|
||||
@available(*, deprecated)
|
||||
extension SdHostModelServiceClient: @unchecked Sendable {}
|
||||
#endif // compiler(>=5.6)
|
||||
|
||||
@available(*, deprecated, renamed: "SdHostModelServiceNIOClient")
|
||||
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.
|
||||
@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: GRPCSendable {
|
||||
public protocol SdHostModelServiceClientInterceptorFactoryProtocol: Sendable {
|
||||
|
||||
/// - Returns: Interceptors to use when invoking 'loadModel'.
|
||||
func makeLoadModelInterceptors() -> [ClientInterceptor<SdLoadModelRequest, SdLoadModelResponse>]
|
||||
@ -258,20 +238,18 @@ extension SdHostModelServiceProvider {
|
||||
}
|
||||
}
|
||||
|
||||
#if compiler(>=5.6)
|
||||
|
||||
///*
|
||||
/// The model service, for management and loading of models.
|
||||
///
|
||||
/// To implement a server, implement an object which conforms to this protocol.
|
||||
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
|
||||
public protocol SdHostModelServiceAsyncProvider: CallHandlerProvider {
|
||||
public protocol SdHostModelServiceAsyncProvider: CallHandlerProvider, Sendable {
|
||||
static var serviceDescriptor: GRPCServiceDescriptor { get }
|
||||
var interceptors: SdHostModelServiceServerInterceptorFactoryProtocol? { get }
|
||||
|
||||
///*
|
||||
/// Loads a model onto a compute unit.
|
||||
@Sendable func loadModel(
|
||||
func loadModel(
|
||||
request: SdLoadModelRequest,
|
||||
context: GRPCAsyncServerCallContext
|
||||
) async throws -> SdLoadModelResponse
|
||||
@ -302,7 +280,7 @@ extension SdHostModelServiceAsyncProvider {
|
||||
requestDeserializer: ProtobufDeserializer<SdLoadModelRequest>(),
|
||||
responseSerializer: ProtobufSerializer<SdLoadModelResponse>(),
|
||||
interceptors: self.interceptors?.makeLoadModelInterceptors() ?? [],
|
||||
wrapping: self.loadModel(request:context:)
|
||||
wrapping: { try await self.loadModel(request: $0, context: $1) }
|
||||
)
|
||||
|
||||
default:
|
||||
@ -311,9 +289,7 @@ extension SdHostModelServiceAsyncProvider {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // compiler(>=5.6)
|
||||
|
||||
public protocol SdHostModelServiceServerInterceptorFactoryProtocol {
|
||||
public protocol SdHostModelServiceServerInterceptorFactoryProtocol: Sendable {
|
||||
|
||||
/// - Returns: Interceptors to use when handling 'loadModel'.
|
||||
/// Defaults to calling `self.makeInterceptors()`.
|
||||
|
@ -1,5 +1,6 @@
|
||||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
// swiftlint:disable all
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: host.proto
|
||||
@ -10,7 +11,6 @@
|
||||
///*
|
||||
/// Host management for the Stable Diffusion RPC service.
|
||||
|
||||
import Foundation
|
||||
import SwiftProtobuf
|
||||
|
||||
// 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.
|
||||
public struct SdLoadModelRequest {
|
||||
public struct SdLoadModelRequest: Sendable {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
@ -45,7 +45,7 @@ public struct SdLoadModelRequest {
|
||||
|
||||
///*
|
||||
/// 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
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
@ -55,11 +55,6 @@ public struct SdLoadModelResponse {
|
||||
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.
|
||||
|
||||
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 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 {
|
||||
|
@ -1,25 +1,10 @@
|
||||
//
|
||||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
//
|
||||
// Generated by the protocol buffer compiler.
|
||||
// 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 NIO
|
||||
import NIOConcurrencyHelpers
|
||||
@ -93,10 +78,8 @@ extension SdImageGenerationServiceClientProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
#if compiler(>=5.6)
|
||||
@available(*, deprecated)
|
||||
extension SdImageGenerationServiceClient: @unchecked Sendable {}
|
||||
#endif // compiler(>=5.6)
|
||||
|
||||
@available(*, deprecated, renamed: "SdImageGenerationServiceNIOClient")
|
||||
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.
|
||||
@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: GRPCSendable {
|
||||
public protocol SdImageGenerationServiceClientInterceptorFactoryProtocol: Sendable {
|
||||
|
||||
/// - Returns: Interceptors to use when invoking 'generateImages'.
|
||||
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.
|
||||
///
|
||||
/// To implement a server, implement an object which conforms to this protocol.
|
||||
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
|
||||
public protocol SdImageGenerationServiceAsyncProvider: CallHandlerProvider {
|
||||
public protocol SdImageGenerationServiceAsyncProvider: CallHandlerProvider, Sendable {
|
||||
static var serviceDescriptor: GRPCServiceDescriptor { get }
|
||||
var interceptors: SdImageGenerationServiceServerInterceptorFactoryProtocol? { get }
|
||||
|
||||
///*
|
||||
/// Generates images using a loaded model.
|
||||
@Sendable func generateImages(
|
||||
func generateImages(
|
||||
request: SdGenerateImagesRequest,
|
||||
context: GRPCAsyncServerCallContext
|
||||
) async throws -> SdGenerateImagesResponse
|
||||
|
||||
///*
|
||||
/// Generates images using a loaded model, providing updates along the way.
|
||||
@Sendable func generateImagesStreaming(
|
||||
func generateImagesStreaming(
|
||||
request: SdGenerateImagesRequest,
|
||||
responseStream: GRPCAsyncResponseStreamWriter<SdGenerateImagesStreamUpdate>,
|
||||
context: GRPCAsyncServerCallContext
|
||||
@ -390,7 +368,7 @@ extension SdImageGenerationServiceAsyncProvider {
|
||||
requestDeserializer: ProtobufDeserializer<SdGenerateImagesRequest>(),
|
||||
responseSerializer: ProtobufSerializer<SdGenerateImagesResponse>(),
|
||||
interceptors: self.interceptors?.makeGenerateImagesInterceptors() ?? [],
|
||||
wrapping: self.generateImages(request:context:)
|
||||
wrapping: { try await self.generateImages(request: $0, context: $1) }
|
||||
)
|
||||
|
||||
case "GenerateImagesStreaming":
|
||||
@ -399,7 +377,7 @@ extension SdImageGenerationServiceAsyncProvider {
|
||||
requestDeserializer: ProtobufDeserializer<SdGenerateImagesRequest>(),
|
||||
responseSerializer: ProtobufSerializer<SdGenerateImagesStreamUpdate>(),
|
||||
interceptors: self.interceptors?.makeGenerateImagesStreamingInterceptors() ?? [],
|
||||
wrapping: self.generateImagesStreaming(request:responseStream:context:)
|
||||
wrapping: { try await self.generateImagesStreaming(request: $0, responseStream: $1, context: $2) }
|
||||
)
|
||||
|
||||
default:
|
||||
@ -408,9 +386,7 @@ extension SdImageGenerationServiceAsyncProvider {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // compiler(>=5.6)
|
||||
|
||||
public protocol SdImageGenerationServiceServerInterceptorFactoryProtocol {
|
||||
public protocol SdImageGenerationServiceServerInterceptorFactoryProtocol: Sendable {
|
||||
|
||||
/// - Returns: Interceptors to use when handling 'generateImages'.
|
||||
/// Defaults to calling `self.makeInterceptors()`.
|
||||
|
@ -1,5 +1,6 @@
|
||||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
// swiftlint:disable all
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: image_generation.proto
|
||||
@ -10,7 +11,6 @@
|
||||
///*
|
||||
/// Image generation for the Stable Diffusion RPC service.
|
||||
|
||||
import Foundation
|
||||
import SwiftProtobuf
|
||||
|
||||
// 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.
|
||||
public struct SdGenerateImagesRequest {
|
||||
public struct SdGenerateImagesRequest: Sendable {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
@ -109,7 +109,7 @@ public struct SdGenerateImagesRequest {
|
||||
|
||||
///*
|
||||
/// Represents the response from image generation.
|
||||
public struct SdGenerateImagesResponse {
|
||||
public struct SdGenerateImagesResponse: Sendable {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
@ -129,7 +129,7 @@ public struct SdGenerateImagesResponse {
|
||||
|
||||
///*
|
||||
/// 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
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
@ -152,7 +152,7 @@ public struct SdGenerateImagesBatchProgressUpdate {
|
||||
|
||||
///*
|
||||
/// 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
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
@ -172,7 +172,7 @@ public struct SdGenerateImagesBatchCompletedUpdate {
|
||||
|
||||
///*
|
||||
/// 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
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
@ -217,7 +217,7 @@ public struct SdGenerateImagesStreamUpdate {
|
||||
|
||||
///*
|
||||
/// An update to the image generation pipeline.
|
||||
public enum OneOf_Update: Equatable {
|
||||
public enum OneOf_Update: Equatable, Sendable {
|
||||
///*
|
||||
/// Batch progress update.
|
||||
case batchProgress(SdGenerateImagesBatchProgressUpdate)
|
||||
@ -225,38 +225,11 @@ public struct SdGenerateImagesStreamUpdate {
|
||||
/// Batch completion update.
|
||||
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() {}
|
||||
}
|
||||
|
||||
#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.
|
||||
|
||||
fileprivate let _protobuf_package = "gay.pizza.stable.diffusion"
|
||||
@ -340,10 +313,10 @@ extension SdGenerateImagesRequest: SwiftProtobuf.Message, SwiftProtobuf._Message
|
||||
if self.scheduler != .pndm {
|
||||
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)
|
||||
}
|
||||
if self.strength != 0 {
|
||||
if self.strength.bitPattern != 0 {
|
||||
try visitor.visitSingularFloatField(value: self.strength, fieldNumber: 12)
|
||||
}
|
||||
if self.stepCount != 0 {
|
||||
@ -434,7 +407,7 @@ extension SdGenerateImagesBatchProgressUpdate: SwiftProtobuf.Message, SwiftProto
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
if !self.images.isEmpty {
|
||||
@ -558,7 +531,7 @@ extension SdGenerateImagesStreamUpdate: SwiftProtobuf.Message, SwiftProtobuf._Me
|
||||
}()
|
||||
case nil: break
|
||||
}
|
||||
if self.overallPercentageComplete != 0 {
|
||||
if self.overallPercentageComplete.bitPattern != 0 {
|
||||
try visitor.visitSingularFloatField(value: self.overallPercentageComplete, fieldNumber: 4)
|
||||
}
|
||||
if self.jobID != 0 {
|
||||
|
@ -1,25 +1,10 @@
|
||||
//
|
||||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
//
|
||||
// Generated by the protocol buffer compiler.
|
||||
// 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 NIO
|
||||
import NIOConcurrencyHelpers
|
||||
@ -114,10 +99,8 @@ extension SdJobServiceClientProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
#if compiler(>=5.6)
|
||||
@available(*, deprecated)
|
||||
extension SdJobServiceClient: @unchecked Sendable {}
|
||||
#endif // compiler(>=5.6)
|
||||
|
||||
@available(*, deprecated, renamed: "SdJobServiceNIOClient")
|
||||
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.
|
||||
@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: GRPCSendable {
|
||||
public protocol SdJobServiceClientInterceptorFactoryProtocol: Sendable {
|
||||
|
||||
/// - Returns: Interceptors to use when invoking 'getJob'.
|
||||
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.
|
||||
///
|
||||
/// To implement a server, implement an object which conforms to this protocol.
|
||||
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
|
||||
public protocol SdJobServiceAsyncProvider: CallHandlerProvider {
|
||||
public protocol SdJobServiceAsyncProvider: CallHandlerProvider, Sendable {
|
||||
static var serviceDescriptor: GRPCServiceDescriptor { get }
|
||||
var interceptors: SdJobServiceServerInterceptorFactoryProtocol? { get }
|
||||
|
||||
@Sendable func getJob(
|
||||
func getJob(
|
||||
request: SdGetJobRequest,
|
||||
context: GRPCAsyncServerCallContext
|
||||
) async throws -> SdGetJobResponse
|
||||
|
||||
@Sendable func cancelJob(
|
||||
func cancelJob(
|
||||
request: SdCancelJobRequest,
|
||||
context: GRPCAsyncServerCallContext
|
||||
) async throws -> SdCancelJobResponse
|
||||
|
||||
@Sendable func streamJobUpdates(
|
||||
func streamJobUpdates(
|
||||
request: SdStreamJobUpdatesRequest,
|
||||
responseStream: GRPCAsyncResponseStreamWriter<SdJobUpdate>,
|
||||
context: GRPCAsyncServerCallContext
|
||||
@ -458,7 +436,7 @@ extension SdJobServiceAsyncProvider {
|
||||
requestDeserializer: ProtobufDeserializer<SdGetJobRequest>(),
|
||||
responseSerializer: ProtobufSerializer<SdGetJobResponse>(),
|
||||
interceptors: self.interceptors?.makeGetJobInterceptors() ?? [],
|
||||
wrapping: self.getJob(request:context:)
|
||||
wrapping: { try await self.getJob(request: $0, context: $1) }
|
||||
)
|
||||
|
||||
case "CancelJob":
|
||||
@ -467,7 +445,7 @@ extension SdJobServiceAsyncProvider {
|
||||
requestDeserializer: ProtobufDeserializer<SdCancelJobRequest>(),
|
||||
responseSerializer: ProtobufSerializer<SdCancelJobResponse>(),
|
||||
interceptors: self.interceptors?.makeCancelJobInterceptors() ?? [],
|
||||
wrapping: self.cancelJob(request:context:)
|
||||
wrapping: { try await self.cancelJob(request: $0, context: $1) }
|
||||
)
|
||||
|
||||
case "StreamJobUpdates":
|
||||
@ -476,7 +454,7 @@ extension SdJobServiceAsyncProvider {
|
||||
requestDeserializer: ProtobufDeserializer<SdStreamJobUpdatesRequest>(),
|
||||
responseSerializer: ProtobufSerializer<SdJobUpdate>(),
|
||||
interceptors: self.interceptors?.makeStreamJobUpdatesInterceptors() ?? [],
|
||||
wrapping: self.streamJobUpdates(request:responseStream:context:)
|
||||
wrapping: { try await self.streamJobUpdates(request: $0, responseStream: $1, context: $2) }
|
||||
)
|
||||
|
||||
default:
|
||||
@ -485,9 +463,7 @@ extension SdJobServiceAsyncProvider {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // compiler(>=5.6)
|
||||
|
||||
public protocol SdJobServiceServerInterceptorFactoryProtocol {
|
||||
public protocol SdJobServiceServerInterceptorFactoryProtocol: Sendable {
|
||||
|
||||
/// - Returns: Interceptors to use when handling 'getJob'.
|
||||
/// Defaults to calling `self.makeInterceptors()`.
|
||||
|
@ -1,5 +1,6 @@
|
||||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
// swiftlint:disable all
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: jobs.proto
|
||||
@ -10,7 +11,6 @@
|
||||
///*
|
||||
/// Job management for the Stable Diffusion RPC service.
|
||||
|
||||
import Foundation
|
||||
import SwiftProtobuf
|
||||
|
||||
// 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.
|
||||
public enum SdJobState: SwiftProtobuf.Enum {
|
||||
public enum SdJobState: SwiftProtobuf.Enum, Swift.CaseIterable {
|
||||
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.
|
||||
public static var allCases: [SdJobState] = [
|
||||
public static let allCases: [SdJobState] = [
|
||||
.unknownState,
|
||||
.queued,
|
||||
.running,
|
||||
.completed,
|
||||
.cancelled,
|
||||
]
|
||||
}
|
||||
|
||||
#endif // swift(>=4.2)
|
||||
}
|
||||
|
||||
///*
|
||||
/// Represents a job that is active
|
||||
public struct SdJob {
|
||||
public struct SdJob: Sendable {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
@ -122,7 +116,7 @@ public struct SdJob {
|
||||
|
||||
///*
|
||||
/// 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
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
@ -138,7 +132,7 @@ public struct SdGetJobRequest {
|
||||
|
||||
///*
|
||||
/// 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
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
@ -163,7 +157,7 @@ public struct SdGetJobResponse {
|
||||
|
||||
///*
|
||||
/// 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
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
@ -179,7 +173,7 @@ public struct SdCancelJobRequest {
|
||||
|
||||
///*
|
||||
/// 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
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
@ -191,7 +185,7 @@ public struct SdCancelJobResponse {
|
||||
|
||||
///*
|
||||
/// 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
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
@ -208,7 +202,7 @@ public struct SdStreamJobUpdatesRequest {
|
||||
|
||||
///*
|
||||
/// Represents an update to a job.
|
||||
public struct SdJobUpdate {
|
||||
public struct SdJobUpdate: Sendable {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
@ -231,17 +225,6 @@ public struct SdJobUpdate {
|
||||
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.
|
||||
|
||||
fileprivate let _protobuf_package = "gay.pizza.stable.diffusion"
|
||||
@ -290,7 +273,7 @@ extension SdJob: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase
|
||||
if self.state != .unknownState {
|
||||
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 unknownFields.traverse(visitor: &visitor)
|
||||
@ -411,8 +394,8 @@ extension SdCancelJobResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImpl
|
||||
public static let _protobuf_nameMap = SwiftProtobuf._NameMap()
|
||||
|
||||
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 {
|
||||
|
@ -1,25 +1,10 @@
|
||||
//
|
||||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
//
|
||||
// Generated by the protocol buffer compiler.
|
||||
// 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 NIO
|
||||
import NIOConcurrencyHelpers
|
||||
@ -61,10 +46,8 @@ extension SdServerMetadataServiceClientProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
#if compiler(>=5.6)
|
||||
@available(*, deprecated)
|
||||
extension SdServerMetadataServiceClient: @unchecked Sendable {}
|
||||
#endif // compiler(>=5.6)
|
||||
|
||||
@available(*, deprecated, renamed: "SdServerMetadataServiceNIOClient")
|
||||
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, *)
|
||||
public protocol SdServerMetadataServiceAsyncClientProtocol: GRPCClient {
|
||||
static var serviceDescriptor: GRPCServiceDescriptor { get }
|
||||
@ -187,9 +169,7 @@ public struct SdServerMetadataServiceAsyncClient: SdServerMetadataServiceAsyncCl
|
||||
}
|
||||
}
|
||||
|
||||
#endif // compiler(>=5.6)
|
||||
|
||||
public protocol SdServerMetadataServiceClientInterceptorFactoryProtocol: GRPCSendable {
|
||||
public protocol SdServerMetadataServiceClientInterceptorFactoryProtocol: Sendable {
|
||||
|
||||
/// - Returns: Interceptors to use when invoking 'getServerMetadata'.
|
||||
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.
|
||||
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
|
||||
public protocol SdServerMetadataServiceAsyncProvider: CallHandlerProvider {
|
||||
public protocol SdServerMetadataServiceAsyncProvider: CallHandlerProvider, Sendable {
|
||||
static var serviceDescriptor: GRPCServiceDescriptor { get }
|
||||
var interceptors: SdServerMetadataServiceServerInterceptorFactoryProtocol? { get }
|
||||
|
||||
@Sendable func getServerMetadata(
|
||||
func getServerMetadata(
|
||||
request: SdGetServerMetadataRequest,
|
||||
context: GRPCAsyncServerCallContext
|
||||
) async throws -> SdGetServerMetadataResponse
|
||||
@ -286,7 +264,7 @@ extension SdServerMetadataServiceAsyncProvider {
|
||||
requestDeserializer: ProtobufDeserializer<SdGetServerMetadataRequest>(),
|
||||
responseSerializer: ProtobufSerializer<SdGetServerMetadataResponse>(),
|
||||
interceptors: self.interceptors?.makeGetServerMetadataInterceptors() ?? [],
|
||||
wrapping: self.getServerMetadata(request:context:)
|
||||
wrapping: { try await self.getServerMetadata(request: $0, context: $1) }
|
||||
)
|
||||
|
||||
default:
|
||||
@ -295,9 +273,7 @@ extension SdServerMetadataServiceAsyncProvider {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // compiler(>=5.6)
|
||||
|
||||
public protocol SdServerMetadataServiceServerInterceptorFactoryProtocol {
|
||||
public protocol SdServerMetadataServiceServerInterceptorFactoryProtocol: Sendable {
|
||||
|
||||
/// - Returns: Interceptors to use when handling 'getServerMetadata'.
|
||||
/// Defaults to calling `self.makeInterceptors()`.
|
||||
|
@ -1,5 +1,6 @@
|
||||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
// swiftlint:disable all
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: metadata.proto
|
||||
@ -10,7 +11,6 @@
|
||||
///*
|
||||
/// Server metadata for the Stable Diffusion RPC service.
|
||||
|
||||
import Foundation
|
||||
import SwiftProtobuf
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
public enum SdServerRole: SwiftProtobuf.Enum {
|
||||
public enum SdServerRole: SwiftProtobuf.Enum, Swift.CaseIterable {
|
||||
public typealias RawValue = Int
|
||||
case unknownRole // = 0
|
||||
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.
|
||||
public static var allCases: [SdServerRole] = [
|
||||
public static let allCases: [SdServerRole] = [
|
||||
.unknownRole,
|
||||
.node,
|
||||
.coordinator,
|
||||
]
|
||||
|
||||
}
|
||||
|
||||
#endif // swift(>=4.2)
|
||||
|
||||
public struct SdServerMetadata {
|
||||
public struct SdServerMetadata: Sendable {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
@ -79,7 +73,7 @@ public struct SdServerMetadata {
|
||||
public init() {}
|
||||
}
|
||||
|
||||
public struct SdGetServerMetadataRequest {
|
||||
public struct SdGetServerMetadataRequest: Sendable {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
@ -89,7 +83,7 @@ public struct SdGetServerMetadataRequest {
|
||||
public init() {}
|
||||
}
|
||||
|
||||
public struct SdGetServerMetadataResponse {
|
||||
public struct SdGetServerMetadataResponse: Sendable {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
@ -110,13 +104,6 @@ public struct SdGetServerMetadataResponse {
|
||||
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.
|
||||
|
||||
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 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 {
|
||||
|
@ -1,25 +1,10 @@
|
||||
//
|
||||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
//
|
||||
// Generated by the protocol buffer compiler.
|
||||
// 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 NIO
|
||||
import NIOConcurrencyHelpers
|
||||
@ -66,10 +51,8 @@ extension SdModelServiceClientProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
#if compiler(>=5.6)
|
||||
@available(*, deprecated)
|
||||
extension SdModelServiceClient: @unchecked Sendable {}
|
||||
#endif // compiler(>=5.6)
|
||||
|
||||
@available(*, deprecated, renamed: "SdModelServiceNIOClient")
|
||||
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.
|
||||
@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: GRPCSendable {
|
||||
public protocol SdModelServiceClientInterceptorFactoryProtocol: Sendable {
|
||||
|
||||
/// - Returns: Interceptors to use when invoking 'listModels'.
|
||||
func makeListModelsInterceptors() -> [ClientInterceptor<SdListModelsRequest, SdListModelsResponse>]
|
||||
@ -260,21 +240,19 @@ extension SdModelServiceProvider {
|
||||
}
|
||||
}
|
||||
|
||||
#if compiler(>=5.6)
|
||||
|
||||
///*
|
||||
/// The model service, for management and loading of models.
|
||||
///
|
||||
/// To implement a server, implement an object which conforms to this protocol.
|
||||
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
|
||||
public protocol SdModelServiceAsyncProvider: CallHandlerProvider {
|
||||
public protocol SdModelServiceAsyncProvider: CallHandlerProvider, Sendable {
|
||||
static var serviceDescriptor: GRPCServiceDescriptor { get }
|
||||
var interceptors: SdModelServiceServerInterceptorFactoryProtocol? { get }
|
||||
|
||||
///*
|
||||
/// Lists the available models on the host.
|
||||
/// This will return both models that are currently loaded, and models that are not yet loaded.
|
||||
@Sendable func listModels(
|
||||
func listModels(
|
||||
request: SdListModelsRequest,
|
||||
context: GRPCAsyncServerCallContext
|
||||
) async throws -> SdListModelsResponse
|
||||
@ -305,7 +283,7 @@ extension SdModelServiceAsyncProvider {
|
||||
requestDeserializer: ProtobufDeserializer<SdListModelsRequest>(),
|
||||
responseSerializer: ProtobufSerializer<SdListModelsResponse>(),
|
||||
interceptors: self.interceptors?.makeListModelsInterceptors() ?? [],
|
||||
wrapping: self.listModels(request:context:)
|
||||
wrapping: { try await self.listModels(request: $0, context: $1) }
|
||||
)
|
||||
|
||||
default:
|
||||
@ -314,9 +292,7 @@ extension SdModelServiceAsyncProvider {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // compiler(>=5.6)
|
||||
|
||||
public protocol SdModelServiceServerInterceptorFactoryProtocol {
|
||||
public protocol SdModelServiceServerInterceptorFactoryProtocol: Sendable {
|
||||
|
||||
/// - Returns: Interceptors to use when handling 'listModels'.
|
||||
/// Defaults to calling `self.makeInterceptors()`.
|
||||
|
@ -1,5 +1,6 @@
|
||||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
// swiftlint:disable all
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: model.proto
|
||||
@ -10,7 +11,6 @@
|
||||
///*
|
||||
/// Host management for the Stable Diffusion RPC service.
|
||||
|
||||
import Foundation
|
||||
import SwiftProtobuf
|
||||
|
||||
// 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.
|
||||
public struct SdListModelsRequest {
|
||||
public struct SdListModelsRequest: Sendable {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
@ -37,7 +37,7 @@ public struct SdListModelsRequest {
|
||||
|
||||
///*
|
||||
/// 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
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
@ -51,11 +51,6 @@ public struct SdListModelsResponse {
|
||||
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.
|
||||
|
||||
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 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 {
|
||||
|
@ -1,5 +1,6 @@
|
||||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
// swiftlint:disable all
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// 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
|
||||
/// 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
|
||||
|
||||
///*
|
||||
@ -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.
|
||||
public static var allCases: [SdModelAttention] = [
|
||||
public static let allCases: [SdModelAttention] = [
|
||||
.original,
|
||||
.splitEinSum,
|
||||
]
|
||||
}
|
||||
|
||||
#endif // swift(>=4.2)
|
||||
}
|
||||
|
||||
///*
|
||||
/// 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
|
||||
|
||||
///*
|
||||
@ -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.
|
||||
public static var allCases: [SdScheduler] = [
|
||||
public static let allCases: [SdScheduler] = [
|
||||
.pndm,
|
||||
.dpmSolverPlusPlus,
|
||||
]
|
||||
}
|
||||
|
||||
#endif // swift(>=4.2)
|
||||
}
|
||||
|
||||
///*
|
||||
/// 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
|
||||
|
||||
///*
|
||||
@ -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.
|
||||
public static var allCases: [SdComputeUnits] = [
|
||||
public static let allCases: [SdComputeUnits] = [
|
||||
.cpu,
|
||||
.cpuAndGpu,
|
||||
.all,
|
||||
.cpuAndNeuralEngine,
|
||||
]
|
||||
}
|
||||
|
||||
#endif // swift(>=4.2)
|
||||
}
|
||||
|
||||
///*
|
||||
/// Represents the format of an image.
|
||||
public enum SdImageFormat: SwiftProtobuf.Enum {
|
||||
public enum SdImageFormat: SwiftProtobuf.Enum, Swift.CaseIterable {
|
||||
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.
|
||||
public static var allCases: [SdImageFormat] = [
|
||||
public static let allCases: [SdImageFormat] = [
|
||||
.png,
|
||||
]
|
||||
}
|
||||
|
||||
#endif // swift(>=4.2)
|
||||
}
|
||||
|
||||
///*
|
||||
/// Represents a 128-bit UUID value.
|
||||
public struct SdUniqueIdentifier {
|
||||
public struct SdUniqueIdentifier: Sendable {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
@ -247,7 +224,7 @@ public struct SdUniqueIdentifier {
|
||||
///*
|
||||
/// Represents information about an available model.
|
||||
/// 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
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
@ -274,7 +251,7 @@ public struct SdModelInfo {
|
||||
/// Represents an image within the Stable Diffusion context.
|
||||
/// This could be an input image for an image generation request, or it could be
|
||||
/// 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
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
@ -292,16 +269,6 @@ public struct SdImage {
|
||||
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.
|
||||
|
||||
fileprivate let _protobuf_package = "gay.pizza.stable.diffusion"
|
||||
|
@ -1,25 +1,10 @@
|
||||
//
|
||||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
//
|
||||
// Generated by the protocol buffer compiler.
|
||||
// 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 NIO
|
||||
import NIOConcurrencyHelpers
|
||||
@ -65,10 +50,8 @@ extension SdTokenizerServiceClientProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
#if compiler(>=5.6)
|
||||
@available(*, deprecated)
|
||||
extension SdTokenizerServiceClient: @unchecked Sendable {}
|
||||
#endif // compiler(>=5.6)
|
||||
|
||||
@available(*, deprecated, renamed: "SdTokenizerServiceNIOClient")
|
||||
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.
|
||||
@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: GRPCSendable {
|
||||
public protocol SdTokenizerServiceClientInterceptorFactoryProtocol: Sendable {
|
||||
|
||||
/// - Returns: Interceptors to use when invoking 'tokenize'.
|
||||
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.
|
||||
///
|
||||
/// To implement a server, implement an object which conforms to this protocol.
|
||||
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
|
||||
public protocol SdTokenizerServiceAsyncProvider: CallHandlerProvider {
|
||||
public protocol SdTokenizerServiceAsyncProvider: CallHandlerProvider, Sendable {
|
||||
static var serviceDescriptor: GRPCServiceDescriptor { get }
|
||||
var interceptors: SdTokenizerServiceServerInterceptorFactoryProtocol? { get }
|
||||
|
||||
///*
|
||||
/// Analyze the input using a loaded model and return the results.
|
||||
@Sendable func tokenize(
|
||||
func tokenize(
|
||||
request: SdTokenizeRequest,
|
||||
context: GRPCAsyncServerCallContext
|
||||
) async throws -> SdTokenizeResponse
|
||||
@ -302,7 +280,7 @@ extension SdTokenizerServiceAsyncProvider {
|
||||
requestDeserializer: ProtobufDeserializer<SdTokenizeRequest>(),
|
||||
responseSerializer: ProtobufSerializer<SdTokenizeResponse>(),
|
||||
interceptors: self.interceptors?.makeTokenizeInterceptors() ?? [],
|
||||
wrapping: self.tokenize(request:context:)
|
||||
wrapping: { try await self.tokenize(request: $0, context: $1) }
|
||||
)
|
||||
|
||||
default:
|
||||
@ -311,9 +289,7 @@ extension SdTokenizerServiceAsyncProvider {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // compiler(>=5.6)
|
||||
|
||||
public protocol SdTokenizerServiceServerInterceptorFactoryProtocol {
|
||||
public protocol SdTokenizerServiceServerInterceptorFactoryProtocol: Sendable {
|
||||
|
||||
/// - Returns: Interceptors to use when handling 'tokenize'.
|
||||
/// Defaults to calling `self.makeInterceptors()`.
|
||||
|
@ -1,5 +1,6 @@
|
||||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
// swiftlint:disable all
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: tokenizer.proto
|
||||
@ -10,7 +11,6 @@
|
||||
///*
|
||||
/// Tokenization for the Stable Diffusion RPC service.
|
||||
|
||||
import Foundation
|
||||
import SwiftProtobuf
|
||||
|
||||
// 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.
|
||||
public struct SdTokenizeRequest {
|
||||
public struct SdTokenizeRequest: Sendable {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
@ -45,7 +45,7 @@ public struct SdTokenizeRequest {
|
||||
|
||||
///*
|
||||
/// Represents a response to tokenization.
|
||||
public struct SdTokenizeResponse {
|
||||
public struct SdTokenizeResponse: Sendable {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
@ -63,11 +63,6 @@ public struct SdTokenizeResponse {
|
||||
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.
|
||||
|
||||
fileprivate let _protobuf_package = "gay.pizza.stable.diffusion"
|
||||
|
Reference in New Issue
Block a user