Files
stable-diffusion-rpc/Sources/StableDiffusionProtos/shared.pb.swift

457 lines
13 KiB
Swift

// DO NOT EDIT.
// swift-format-ignore-file
//
// Generated by the Swift generator plugin for the protocol buffer compiler.
// Source: shared.proto
//
// For information on using the generated types, please see the documentation:
// https://github.com/apple/swift-protobuf/
///*
/// Shared messages for the Stable Diffusion RPC service.
import Foundation
import SwiftProtobuf
// If the compiler emits an error on this type, it is because this file
// was generated by a version of the `protoc` Swift plug-in that is
// incompatible with the version of SwiftProtobuf to which you are linking.
// Please ensure that you are building against the same version of the API
// that was used to generate this file.
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
typealias Version = _2
}
///*
/// 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 typealias RawValue = Int
///*
/// The model is an original attention type. It can be loaded only onto CPU & GPU compute units.
case original // = 0
///*
/// The model is a split-ein-sum attention type. It can be loaded onto all compute units,
/// including the Apple Neural Engine.
case splitEinSum // = 1
case UNRECOGNIZED(Int)
public init() {
self = .original
}
public init?(rawValue: Int) {
switch rawValue {
case 0: self = .original
case 1: self = .splitEinSum
default: self = .UNRECOGNIZED(rawValue)
}
}
public var rawValue: Int {
switch self {
case .original: return 0
case .splitEinSum: return 1
case .UNRECOGNIZED(let i): return i
}
}
}
#if swift(>=4.2)
extension SdModelAttention: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [SdModelAttention] = [
.original,
.splitEinSum,
]
}
#endif // swift(>=4.2)
///*
/// Represents the schedulers that are used to sample images.
public enum SdScheduler: SwiftProtobuf.Enum {
public typealias RawValue = Int
///*
/// The PNDM (Pseudo numerical methods for diffusion models) scheduler.
case pndm // = 0
///*
/// The DPM-Solver++ scheduler.
case dpmSolverPlusPlus // = 1
case UNRECOGNIZED(Int)
public init() {
self = .pndm
}
public init?(rawValue: Int) {
switch rawValue {
case 0: self = .pndm
case 1: self = .dpmSolverPlusPlus
default: self = .UNRECOGNIZED(rawValue)
}
}
public var rawValue: Int {
switch self {
case .pndm: return 0
case .dpmSolverPlusPlus: return 1
case .UNRECOGNIZED(let i): return i
}
}
}
#if swift(>=4.2)
extension SdScheduler: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case.
public static var 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 typealias RawValue = Int
///*
/// The CPU as a singular compute unit.
case cpu // = 0
///*
/// The CPU & GPU combined into a singular compute unit.
case cpuAndGpu // = 1
///*
/// Allow the usage of all compute units. CoreML will decided where the model is loaded.
case all // = 2
///*
/// The CPU & Neural Engine combined into a singular compute unit.
case cpuAndNeuralEngine // = 3
case UNRECOGNIZED(Int)
public init() {
self = .cpu
}
public init?(rawValue: Int) {
switch rawValue {
case 0: self = .cpu
case 1: self = .cpuAndGpu
case 2: self = .all
case 3: self = .cpuAndNeuralEngine
default: self = .UNRECOGNIZED(rawValue)
}
}
public var rawValue: Int {
switch self {
case .cpu: return 0
case .cpuAndGpu: return 1
case .all: return 2
case .cpuAndNeuralEngine: return 3
case .UNRECOGNIZED(let i): return i
}
}
}
#if swift(>=4.2)
extension SdComputeUnits: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [SdComputeUnits] = [
.cpu,
.cpuAndGpu,
.all,
.cpuAndNeuralEngine,
]
}
#endif // swift(>=4.2)
///*
/// Represents the format of an image.
public enum SdImageFormat: SwiftProtobuf.Enum {
public typealias RawValue = Int
///*
/// The PNG image format.
case png // = 0
case UNRECOGNIZED(Int)
public init() {
self = .png
}
public init?(rawValue: Int) {
switch rawValue {
case 0: self = .png
default: self = .UNRECOGNIZED(rawValue)
}
}
public var rawValue: Int {
switch self {
case .png: return 0
case .UNRECOGNIZED(let i): return i
}
}
}
#if swift(>=4.2)
extension SdImageFormat: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [SdImageFormat] = [
.png,
]
}
#endif // swift(>=4.2)
///*
/// Represents a 128-bit UUID value.
public struct SdUniqueIdentifier {
// 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.
///*
/// The upper bits of the UUID.
public var upperBits: UInt64 = 0
///*
/// The lower bits of the UUID.
public var lowerBits: UInt64 = 0
public var unknownFields = SwiftProtobuf.UnknownStorage()
public init() {}
}
///*
/// Represents information about an available model.
/// The primary key of a model is it's 'name' field.
public struct SdModelInfo {
// 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.
///*
/// The name of the available model. Note that a model name is considered a unique identifier.
public var name: String = String()
///*
/// The attention of the model. Model attention determines what compute units can be used to
/// load the model and make predictions.
public var attention: SdModelAttention = .original
///*
/// The compute units that this model supports using.
public var supportedComputeUnits: [SdComputeUnits] = []
public var unknownFields = SwiftProtobuf.UnknownStorage()
public init() {}
}
///*
/// 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 {
// 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.
///*
/// The format of the image.
public var format: SdImageFormat = .png
///*
/// The raw data of the image, in the specified format.
public var data: Data = Data()
public var unknownFields = SwiftProtobuf.UnknownStorage()
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"
extension SdModelAttention: SwiftProtobuf._ProtoNameProviding {
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
0: .same(proto: "original"),
1: .same(proto: "split_ein_sum"),
]
}
extension SdScheduler: SwiftProtobuf._ProtoNameProviding {
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
0: .same(proto: "pndm"),
1: .same(proto: "dpm_solver_plus_plus"),
]
}
extension SdComputeUnits: SwiftProtobuf._ProtoNameProviding {
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
0: .same(proto: "cpu"),
1: .same(proto: "cpu_and_gpu"),
2: .same(proto: "all"),
3: .same(proto: "cpu_and_neural_engine"),
]
}
extension SdImageFormat: SwiftProtobuf._ProtoNameProviding {
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
0: .same(proto: "png"),
]
}
extension SdUniqueIdentifier: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = _protobuf_package + ".UniqueIdentifier"
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .standard(proto: "upper_bits"),
2: .standard(proto: "lower_bits"),
]
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
// 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 fieldNumber {
case 1: try { try decoder.decodeSingularUInt64Field(value: &self.upperBits) }()
case 2: try { try decoder.decodeSingularUInt64Field(value: &self.lowerBits) }()
default: break
}
}
}
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if self.upperBits != 0 {
try visitor.visitSingularUInt64Field(value: self.upperBits, fieldNumber: 1)
}
if self.lowerBits != 0 {
try visitor.visitSingularUInt64Field(value: self.lowerBits, fieldNumber: 2)
}
try unknownFields.traverse(visitor: &visitor)
}
public static func ==(lhs: SdUniqueIdentifier, rhs: SdUniqueIdentifier) -> Bool {
if lhs.upperBits != rhs.upperBits {return false}
if lhs.lowerBits != rhs.lowerBits {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}
extension SdModelInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = _protobuf_package + ".ModelInfo"
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .same(proto: "name"),
2: .same(proto: "attention"),
5: .standard(proto: "supported_compute_units"),
]
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
// 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 fieldNumber {
case 1: try { try decoder.decodeSingularStringField(value: &self.name) }()
case 2: try { try decoder.decodeSingularEnumField(value: &self.attention) }()
case 5: try { try decoder.decodeRepeatedEnumField(value: &self.supportedComputeUnits) }()
default: break
}
}
}
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if !self.name.isEmpty {
try visitor.visitSingularStringField(value: self.name, fieldNumber: 1)
}
if self.attention != .original {
try visitor.visitSingularEnumField(value: self.attention, fieldNumber: 2)
}
if !self.supportedComputeUnits.isEmpty {
try visitor.visitPackedEnumField(value: self.supportedComputeUnits, fieldNumber: 5)
}
try unknownFields.traverse(visitor: &visitor)
}
public static func ==(lhs: SdModelInfo, rhs: SdModelInfo) -> Bool {
if lhs.name != rhs.name {return false}
if lhs.attention != rhs.attention {return false}
if lhs.supportedComputeUnits != rhs.supportedComputeUnits {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}
extension SdImage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = _protobuf_package + ".Image"
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .same(proto: "format"),
2: .same(proto: "data"),
]
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
// 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 fieldNumber {
case 1: try { try decoder.decodeSingularEnumField(value: &self.format) }()
case 2: try { try decoder.decodeSingularBytesField(value: &self.data) }()
default: break
}
}
}
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if self.format != .png {
try visitor.visitSingularEnumField(value: self.format, fieldNumber: 1)
}
if !self.data.isEmpty {
try visitor.visitSingularBytesField(value: self.data, fieldNumber: 2)
}
try unknownFields.traverse(visitor: &visitor)
}
public static func ==(lhs: SdImage, rhs: SdImage) -> Bool {
if lhs.format != rhs.format {return false}
if lhs.data != rhs.data {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}