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

579 lines
23 KiB
Swift

// DO NOT EDIT.
// swift-format-ignore-file
//
// Generated by the Swift generator plugin for the protocol buffer compiler.
// Source: image_generation.proto
//
// For information on using the generated types, please see the documentation:
// https://github.com/apple/swift-protobuf/
///*
/// 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
// 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 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)}
}
///*
/// The percentage of completion for the entire submitted job.
public var overallPercentageComplete: Float = 0
///*
/// The id of the spawned job.
public var jobID: UInt64 = 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() {}
}
#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"
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<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.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<V: SwiftProtobuf.Visitor>(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<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.decodeRepeatedMessageField(value: &self.images) }()
case 2: try { try decoder.decodeRepeatedUInt32Field(value: &self.seeds) }()
default: break
}
}
}
public func traverse<V: SwiftProtobuf.Visitor>(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<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.decodeSingularFloatField(value: &self.percentageComplete) }()
case 2: try { try decoder.decodeRepeatedMessageField(value: &self.images) }()
default: break
}
}
}
public func traverse<V: SwiftProtobuf.Visitor>(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<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.decodeRepeatedMessageField(value: &self.images) }()
case 2: try { try decoder.decodeSingularUInt32Field(value: &self.seed) }()
default: break
}
}
}
public func traverse<V: SwiftProtobuf.Visitor>(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"),
5: .standard(proto: "job_id"),
]
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.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) }()
case 5: try { try decoder.decodeSingularUInt64Field(value: &self.jobID) }()
default: break
}
}
}
public func traverse<V: SwiftProtobuf.Visitor>(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)
}
if self.jobID != 0 {
try visitor.visitSingularUInt64Field(value: self.jobID, fieldNumber: 5)
}
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.jobID != rhs.jobID {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}