// DO NOT EDIT. // swift-format-ignore-file // // Generated by the Swift generator plugin for the protocol buffer compiler. // Source: StableDiffusion.proto // // For information on using the generated types, please see the documentation: // https://github.com/apple/swift-protobuf/ ///* /// Stable Diffusion RPC service for Apple Platforms. 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 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 within the context of a single RPC server, /// the name of a model is a unique identifier. This may not be true when utilizing a cluster or /// load balanced server, so keep that in mind. 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 ///* /// Whether the model is currently loaded onto an available compute unit. public var isLoaded: Bool = false ///* /// The compute unit that the model is currently loaded into, if it is loaded to one at all. /// When is_loaded is false, the value of this field should be null. public var loadedComputeUnits: SdComputeUnits = .cpu ///* /// 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() {} } ///* /// Represents a request to list the models available on the host. public struct SdListModelsRequest { // 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. public var unknownFields = SwiftProtobuf.UnknownStorage() public init() {} } ///* /// Represents a response to listing the models available on the host. public struct SdListModelsResponse { // 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 available models on the Stable Diffusion server. public var availableModels: [SdModelInfo] = [] public var unknownFields = SwiftProtobuf.UnknownStorage() public init() {} } ///* /// Represents a request to load a model into a specified compute unit. public struct SdLoadModelRequest { // 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 model name to load onto the compute unit. public var modelName: String = String() ///* /// The compute units to load the model onto. public var computeUnits: SdComputeUnits = .cpu public var unknownFields = SwiftProtobuf.UnknownStorage() public init() {} } ///* /// Represents a response to loading a model. public struct SdLoadModelResponse { // 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. public var unknownFields = SwiftProtobuf.UnknownStorage() public init() {} } ///* /// Represents a request to generate images using a loaded model. public struct SdGenerateImagesRequest { // 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 model name to use for generation. /// The model must be already be loaded using ModelService.LoadModel RPC method. public var modelName: String = String() ///* /// The output format for generated images. public var outputImageFormat: SdImageFormat = .png ///* /// The number of batches of images to generate. public var batchCount: UInt32 = 0 ///* /// The number of images inside a single batch. public var batchSize: UInt32 = 0 ///* /// The positive textual prompt for image generation. public var prompt: String = String() ///* /// The negative prompt for image generation. public var negativePrompt: String = String() ///* /// The random seed to use. /// Zero indicates that the seed should be random. public var seed: UInt32 = 0 ///* /// An optional starting image to use for generation. public var startingImage: SdImage { get {return _startingImage ?? SdImage()} set {_startingImage = newValue} } /// Returns true if `startingImage` has been explicitly set. public var hasStartingImage: Bool {return self._startingImage != nil} /// Clears the value of `startingImage`. Subsequent reads from it will return its default value. public mutating func clearStartingImage() {self._startingImage = nil} ///* /// Indicates whether to enable the safety check network, if it is available. public var enableSafetyCheck: Bool = false ///* /// The scheduler to use for generation. /// The default is PNDM, if not specified. public var scheduler: SdScheduler = .pndm ///* /// The guidance scale, which controls the influence the prompt has on the image. /// If not specified, a reasonable default value is used. public var guidanceScale: Float = 0 ///* /// The strength of the image generation. /// If not specified, a reasonable default value is used. public var strength: Float = 0 ///* /// The number of inference steps to perform. /// If not specified, a reasonable default value is used. public var stepCount: UInt32 = 0 ///* /// Indicates whether to send intermediate images /// while in streaming mode. public var sendIntermediates: Bool = false public var unknownFields = SwiftProtobuf.UnknownStorage() public init() {} fileprivate var _startingImage: SdImage? = nil } ///* /// Represents the response from image generation. public struct SdGenerateImagesResponse { // 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 set of generated images by the Stable Diffusion pipeline. public var images: [SdImage] = [] ///* /// The seeds that were used to generate the images. public var seeds: [UInt32] = [] public var unknownFields = SwiftProtobuf.UnknownStorage() public init() {} } ///* /// Represents a progress update for an image generation batch. public struct SdGenerateImagesBatchProgressUpdate { // 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 percentage of this batch that is complete. public var percentageComplete: Float = 0 ///* /// The current state of the generated images from this batch. /// These are not usually completed images, but partial images. /// These are only available if the request's send_intermediates /// parameter is set to true. public var images: [SdImage] = [] public var unknownFields = SwiftProtobuf.UnknownStorage() public init() {} } ///* /// Represents a completion of an image generation batch. public struct SdGenerateImagesBatchCompletedUpdate { // 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 generated images from this batch. public var images: [SdImage] = [] ///* /// The seed for this batch. public var seed: UInt32 = 0 public var unknownFields = SwiftProtobuf.UnknownStorage() public init() {} } ///* /// Represents a continuous update from an image generation stream. public struct SdGenerateImagesStreamUpdate { // 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 current batch number that is processing. public var currentBatch: UInt32 = 0 ///* /// An update to the image generation pipeline. public var update: SdGenerateImagesStreamUpdate.OneOf_Update? = nil ///* /// Batch progress update. public var batchProgress: SdGenerateImagesBatchProgressUpdate { get { if case .batchProgress(let v)? = update {return v} return SdGenerateImagesBatchProgressUpdate() } set {update = .batchProgress(newValue)} } ///* /// Batch completion update. public var batchCompleted: SdGenerateImagesBatchCompletedUpdate { get { if case .batchCompleted(let v)? = update {return v} return SdGenerateImagesBatchCompletedUpdate() } set {update = .batchCompleted(newValue)} } public var overallPercentageComplete: Float = 0 public var unknownFields = SwiftProtobuf.UnknownStorage() ///* /// An update to the image generation pipeline. public enum OneOf_Update: Equatable { ///* /// Batch progress update. case batchProgress(SdGenerateImagesBatchProgressUpdate) ///* /// 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() {} } ///* /// Represents a request to tokenize an input. public struct SdTokenizeRequest { // 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 a loaded model to use for tokenization. public var modelName: String = String() ///* /// The input string to tokenize. public var input: String = String() public var unknownFields = SwiftProtobuf.UnknownStorage() public init() {} } ///* /// Represents a response to tokenization. public struct SdTokenizeResponse { // 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 tokens inside the input string. public var tokens: [String] = [] ///* /// The token IDs inside the input string. public var tokenIds: [UInt64] = [] 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 SdModelInfo: @unchecked Sendable {} extension SdImage: @unchecked Sendable {} extension SdListModelsRequest: @unchecked Sendable {} extension SdListModelsResponse: @unchecked Sendable {} extension SdLoadModelRequest: @unchecked Sendable {} extension SdLoadModelResponse: @unchecked Sendable {} 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 {} 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" 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 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"), 3: .standard(proto: "is_loaded"), 4: .standard(proto: "loaded_compute_units"), 5: .standard(proto: "supported_compute_units"), ] public mutating func decodeMessage(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 3: try { try decoder.decodeSingularBoolField(value: &self.isLoaded) }() case 4: try { try decoder.decodeSingularEnumField(value: &self.loadedComputeUnits) }() case 5: try { try decoder.decodeRepeatedEnumField(value: &self.supportedComputeUnits) }() default: break } } } public func traverse(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.isLoaded != false { try visitor.visitSingularBoolField(value: self.isLoaded, fieldNumber: 3) } if self.loadedComputeUnits != .cpu { try visitor.visitSingularEnumField(value: self.loadedComputeUnits, fieldNumber: 4) } 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.isLoaded != rhs.isLoaded {return false} if lhs.loadedComputeUnits != rhs.loadedComputeUnits {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(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(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 } } extension SdListModelsRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".ListModelsRequest" public static let _protobuf_nameMap = SwiftProtobuf._NameMap() public mutating func decodeMessage(decoder: inout D) throws { while let _ = try decoder.nextFieldNumber() { } } public func traverse(visitor: inout V) throws { try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: SdListModelsRequest, rhs: SdListModelsRequest) -> Bool { if lhs.unknownFields != rhs.unknownFields {return false} return true } } extension SdListModelsResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".ListModelsResponse" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "available_models"), ] public mutating func decodeMessage(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.decodeRepeatedMessageField(value: &self.availableModels) }() default: break } } } public func traverse(visitor: inout V) throws { if !self.availableModels.isEmpty { try visitor.visitRepeatedMessageField(value: self.availableModels, fieldNumber: 1) } try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: SdListModelsResponse, rhs: SdListModelsResponse) -> Bool { if lhs.availableModels != rhs.availableModels {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } } extension SdLoadModelRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".LoadModelRequest" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "model_name"), 2: .standard(proto: "compute_units"), ] public mutating func decodeMessage(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.modelName) }() case 2: try { try decoder.decodeSingularEnumField(value: &self.computeUnits) }() default: break } } } public func traverse(visitor: inout V) throws { if !self.modelName.isEmpty { try visitor.visitSingularStringField(value: self.modelName, fieldNumber: 1) } if self.computeUnits != .cpu { try visitor.visitSingularEnumField(value: self.computeUnits, fieldNumber: 2) } try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: SdLoadModelRequest, rhs: SdLoadModelRequest) -> Bool { if lhs.modelName != rhs.modelName {return false} if lhs.computeUnits != rhs.computeUnits {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } } extension SdLoadModelResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".LoadModelResponse" public static let _protobuf_nameMap = SwiftProtobuf._NameMap() public mutating func decodeMessage(decoder: inout D) throws { while let _ = try decoder.nextFieldNumber() { } } public func traverse(visitor: inout V) throws { try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: SdLoadModelResponse, rhs: SdLoadModelResponse) -> Bool { if lhs.unknownFields != rhs.unknownFields {return false} return true } } extension SdGenerateImagesRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".GenerateImagesRequest" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "model_name"), 2: .standard(proto: "output_image_format"), 3: .standard(proto: "batch_count"), 4: .standard(proto: "batch_size"), 5: .same(proto: "prompt"), 6: .standard(proto: "negative_prompt"), 7: .same(proto: "seed"), 8: .standard(proto: "starting_image"), 9: .standard(proto: "enable_safety_check"), 10: .same(proto: "scheduler"), 11: .standard(proto: "guidance_scale"), 12: .same(proto: "strength"), 13: .standard(proto: "step_count"), 14: .standard(proto: "send_intermediates"), ] public mutating func decodeMessage(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.modelName) }() case 2: try { try decoder.decodeSingularEnumField(value: &self.outputImageFormat) }() case 3: try { try decoder.decodeSingularUInt32Field(value: &self.batchCount) }() case 4: try { try decoder.decodeSingularUInt32Field(value: &self.batchSize) }() case 5: try { try decoder.decodeSingularStringField(value: &self.prompt) }() case 6: try { try decoder.decodeSingularStringField(value: &self.negativePrompt) }() case 7: try { try decoder.decodeSingularUInt32Field(value: &self.seed) }() case 8: try { try decoder.decodeSingularMessageField(value: &self._startingImage) }() case 9: try { try decoder.decodeSingularBoolField(value: &self.enableSafetyCheck) }() case 10: try { try decoder.decodeSingularEnumField(value: &self.scheduler) }() case 11: try { try decoder.decodeSingularFloatField(value: &self.guidanceScale) }() case 12: try { try decoder.decodeSingularFloatField(value: &self.strength) }() case 13: try { try decoder.decodeSingularUInt32Field(value: &self.stepCount) }() case 14: try { try decoder.decodeSingularBoolField(value: &self.sendIntermediates) }() default: break } } } public func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 if !self.modelName.isEmpty { try visitor.visitSingularStringField(value: self.modelName, fieldNumber: 1) } if self.outputImageFormat != .png { try visitor.visitSingularEnumField(value: self.outputImageFormat, fieldNumber: 2) } if self.batchCount != 0 { try visitor.visitSingularUInt32Field(value: self.batchCount, fieldNumber: 3) } if self.batchSize != 0 { try visitor.visitSingularUInt32Field(value: self.batchSize, fieldNumber: 4) } if !self.prompt.isEmpty { try visitor.visitSingularStringField(value: self.prompt, fieldNumber: 5) } if !self.negativePrompt.isEmpty { try visitor.visitSingularStringField(value: self.negativePrompt, fieldNumber: 6) } if self.seed != 0 { try visitor.visitSingularUInt32Field(value: self.seed, fieldNumber: 7) } try { if let v = self._startingImage { try visitor.visitSingularMessageField(value: v, fieldNumber: 8) } }() if self.enableSafetyCheck != false { try visitor.visitSingularBoolField(value: self.enableSafetyCheck, fieldNumber: 9) } if self.scheduler != .pndm { try visitor.visitSingularEnumField(value: self.scheduler, fieldNumber: 10) } if self.guidanceScale != 0 { try visitor.visitSingularFloatField(value: self.guidanceScale, fieldNumber: 11) } if self.strength != 0 { try visitor.visitSingularFloatField(value: self.strength, fieldNumber: 12) } if self.stepCount != 0 { try visitor.visitSingularUInt32Field(value: self.stepCount, fieldNumber: 13) } if self.sendIntermediates != false { try visitor.visitSingularBoolField(value: self.sendIntermediates, fieldNumber: 14) } try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: SdGenerateImagesRequest, rhs: SdGenerateImagesRequest) -> Bool { if lhs.modelName != rhs.modelName {return false} if lhs.outputImageFormat != rhs.outputImageFormat {return false} if lhs.batchCount != rhs.batchCount {return false} if lhs.batchSize != rhs.batchSize {return false} if lhs.prompt != rhs.prompt {return false} if lhs.negativePrompt != rhs.negativePrompt {return false} if lhs.seed != rhs.seed {return false} if lhs._startingImage != rhs._startingImage {return false} if lhs.enableSafetyCheck != rhs.enableSafetyCheck {return false} if lhs.scheduler != rhs.scheduler {return false} if lhs.guidanceScale != rhs.guidanceScale {return false} if lhs.strength != rhs.strength {return false} if lhs.stepCount != rhs.stepCount {return false} if lhs.sendIntermediates != rhs.sendIntermediates {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } } extension SdGenerateImagesResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".GenerateImagesResponse" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "images"), 2: .same(proto: "seeds"), ] public mutating func decodeMessage(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.decodeRepeatedMessageField(value: &self.images) }() case 2: try { try decoder.decodeRepeatedUInt32Field(value: &self.seeds) }() default: break } } } public func traverse(visitor: inout V) throws { if !self.images.isEmpty { try visitor.visitRepeatedMessageField(value: self.images, fieldNumber: 1) } if !self.seeds.isEmpty { try visitor.visitPackedUInt32Field(value: self.seeds, fieldNumber: 2) } try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: SdGenerateImagesResponse, rhs: SdGenerateImagesResponse) -> Bool { if lhs.images != rhs.images {return false} if lhs.seeds != rhs.seeds {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } } extension SdGenerateImagesBatchProgressUpdate: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".GenerateImagesBatchProgressUpdate" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "percentage_complete"), 2: .same(proto: "images"), ] public mutating func decodeMessage(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.decodeSingularFloatField(value: &self.percentageComplete) }() case 2: try { try decoder.decodeRepeatedMessageField(value: &self.images) }() default: break } } } public func traverse(visitor: inout V) throws { if self.percentageComplete != 0 { try visitor.visitSingularFloatField(value: self.percentageComplete, fieldNumber: 1) } if !self.images.isEmpty { try visitor.visitRepeatedMessageField(value: self.images, fieldNumber: 2) } try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: SdGenerateImagesBatchProgressUpdate, rhs: SdGenerateImagesBatchProgressUpdate) -> Bool { if lhs.percentageComplete != rhs.percentageComplete {return false} if lhs.images != rhs.images {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } } extension SdGenerateImagesBatchCompletedUpdate: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".GenerateImagesBatchCompletedUpdate" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "images"), 2: .same(proto: "seed"), ] public mutating func decodeMessage(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.decodeRepeatedMessageField(value: &self.images) }() case 2: try { try decoder.decodeSingularUInt32Field(value: &self.seed) }() default: break } } } public func traverse(visitor: inout V) throws { if !self.images.isEmpty { try visitor.visitRepeatedMessageField(value: self.images, fieldNumber: 1) } if self.seed != 0 { try visitor.visitSingularUInt32Field(value: self.seed, fieldNumber: 2) } try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: SdGenerateImagesBatchCompletedUpdate, rhs: SdGenerateImagesBatchCompletedUpdate) -> Bool { if lhs.images != rhs.images {return false} if lhs.seed != rhs.seed {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } } extension SdGenerateImagesStreamUpdate: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".GenerateImagesStreamUpdate" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "current_batch"), 2: .standard(proto: "batch_progress"), 3: .standard(proto: "batch_completed"), 4: .standard(proto: "overall_percentage_complete"), ] public mutating func decodeMessage(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.decodeSingularUInt32Field(value: &self.currentBatch) }() case 2: try { var v: SdGenerateImagesBatchProgressUpdate? var hadOneofValue = false if let current = self.update { hadOneofValue = true if case .batchProgress(let m) = current {v = m} } try decoder.decodeSingularMessageField(value: &v) if let v = v { if hadOneofValue {try decoder.handleConflictingOneOf()} self.update = .batchProgress(v) } }() case 3: try { var v: SdGenerateImagesBatchCompletedUpdate? var hadOneofValue = false if let current = self.update { hadOneofValue = true if case .batchCompleted(let m) = current {v = m} } try decoder.decodeSingularMessageField(value: &v) if let v = v { if hadOneofValue {try decoder.handleConflictingOneOf()} self.update = .batchCompleted(v) } }() case 4: try { try decoder.decodeSingularFloatField(value: &self.overallPercentageComplete) }() default: break } } } public func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 if self.currentBatch != 0 { try visitor.visitSingularUInt32Field(value: self.currentBatch, fieldNumber: 1) } switch self.update { case .batchProgress?: try { guard case .batchProgress(let v)? = self.update else { preconditionFailure() } try visitor.visitSingularMessageField(value: v, fieldNumber: 2) }() case .batchCompleted?: try { guard case .batchCompleted(let v)? = self.update else { preconditionFailure() } try visitor.visitSingularMessageField(value: v, fieldNumber: 3) }() case nil: break } if self.overallPercentageComplete != 0 { try visitor.visitSingularFloatField(value: self.overallPercentageComplete, fieldNumber: 4) } try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: SdGenerateImagesStreamUpdate, rhs: SdGenerateImagesStreamUpdate) -> Bool { if lhs.currentBatch != rhs.currentBatch {return false} if lhs.update != rhs.update {return false} if lhs.overallPercentageComplete != rhs.overallPercentageComplete {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } } extension SdTokenizeRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".TokenizeRequest" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "model_name"), 2: .same(proto: "input"), ] public mutating func decodeMessage(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.modelName) }() case 2: try { try decoder.decodeSingularStringField(value: &self.input) }() default: break } } } public func traverse(visitor: inout V) throws { if !self.modelName.isEmpty { try visitor.visitSingularStringField(value: self.modelName, fieldNumber: 1) } if !self.input.isEmpty { try visitor.visitSingularStringField(value: self.input, fieldNumber: 2) } try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: SdTokenizeRequest, rhs: SdTokenizeRequest) -> Bool { if lhs.modelName != rhs.modelName {return false} if lhs.input != rhs.input {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } } extension SdTokenizeResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".TokenizeResponse" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "tokens"), 2: .standard(proto: "token_ids"), ] public mutating func decodeMessage(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.decodeRepeatedStringField(value: &self.tokens) }() case 2: try { try decoder.decodeRepeatedUInt64Field(value: &self.tokenIds) }() default: break } } } public func traverse(visitor: inout V) throws { if !self.tokens.isEmpty { try visitor.visitRepeatedStringField(value: self.tokens, fieldNumber: 1) } if !self.tokenIds.isEmpty { try visitor.visitPackedUInt64Field(value: self.tokenIds, fieldNumber: 2) } try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: SdTokenizeResponse, rhs: SdTokenizeResponse) -> Bool { if lhs.tokens != rhs.tokens {return false} if lhs.tokenIds != rhs.tokenIds {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } }