Documentation ¶
Index ¶
- func MockApiServer(t *testing.T, model string) *httptest.Server
- func MockGenServer(t *testing.T, model string) *httptest.Server
- func StartGen(ctx context.Context, gen *generator.ApiRequest, url string) error
- type AcceptedResponse
- type AcceptedResponseBody
- type AlwaysonScripts
- type DownloadInfo
- type GenerateRequest
- type GenerationModel
- type GrpcArgs
- type ModelDownloadInfo
- type ModelDownloadRequest
- type ModelOptions
- type ModelVersionDetails
- type ModelVersionFile
- type ModelVersionInfo
- type ModelVersionResponse
- type WebuiRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MockApiServer ¶
Mock api server, model is the model to return for the requested model
func MockGenServer ¶
Mock generation server, model is the currently loaded model
Types ¶
type AcceptedResponse ¶
type AcceptedResponse struct {
Body AcceptedResponseBody
}
func PostGenerate ¶
func PostGenerate(ctx context.Context, input *GenerateRequest) (*AcceptedResponse, error)
type AcceptedResponseBody ¶
func BatchAndQueue ¶
func BatchAndQueue(ctx context.Context, g *generator.ApiRequest) (*AcceptedResponseBody, error)
batchAndQueue creates a batch of generations based off the request and adds them to the queue
type AlwaysonScripts ¶
type AlwaysonScripts struct { //add controlnet later GrpcClient GrpcArgs `json:"grpc_client" validate:"required"` }
type DownloadInfo ¶
type DownloadInfo struct { Name string `json:"name" validate:"required"` // The name of the file without the extension Filename string `json:"filename" validate:"required"` // The name of the file with the extension Extension string `json:"ext" validate:"required"` // The extension type of the file DownloadUrl string `json:"downloadUrl" validate:"required,url"` // The url to download the file Type string `json:"type" validate:"oneof=ckpt lora vae"` // The type of the file, should be one of the following: ckpt, lora, lyco }
func (*DownloadInfo) GetLogTags ¶
func (ref *DownloadInfo) GetLogTags() string
func (*DownloadInfo) LogWithTags ¶
func (ref *DownloadInfo) LogWithTags(ctx context.Context, msg ...string)
type GenerateRequest ¶
type GenerateRequest struct { Body struct { generator.ApiRequest } }
type GenerationModel ¶
type GenerationModel struct { generator.IngestArgs Info *generator.WebuiResponse `json:"info,omitempty" validate:"omitempty"` GroupId string `json:"group_id" validate:"omitempty"` Checkpoint *ModelVersionDetails `json:"checkpoint" validate:"required"` HrCheckpoint *ModelVersionDetails `json:"hr_checkpoint" validate:"omitempty"` Loras []ModelVersionDetails `json:"lora_models" validate:"omitempty"` HrLoras []ModelVersionDetails `json:"hr_models" validate:"omitempty"` }
func ApiRequestToGenerationModel ¶
func ApiRequestToGenerationModel(ctx context.Context, req *generator.ApiRequest) (*GenerationModel, error)
func (*GenerationModel) DownloadAndUpdatePrompts ¶
func (gen *GenerationModel) DownloadAndUpdatePrompts(ctx context.Context, url string) error
func (*GenerationModel) GetLogTags ¶
func (req *GenerationModel) GetLogTags() string
func (*GenerationModel) LogWithTags ¶
func (req *GenerationModel) LogWithTags(ctx context.Context, msg ...string)
type GrpcArgs ¶
type GrpcArgs struct {
Args []generator.IngestArgs `json:"args" validate:"required"`
}
type ModelDownloadInfo ¶
type ModelDownloadInfo struct { DownloadUrl string `json:"download_url" validate:"required,url"` Id string `json:"id" validate:"required,uuid"` // The name of the file without the extension Name string `json:"name" validate:"required"` VersionId string `json:"version_id" validate:"required,uuid"` FileType string `json:"file_type" validate:"oneof=Model PrunedModel Negative VAE TrainingData"` }
type ModelDownloadRequest ¶
type ModelDownloadRequest struct { DownloadUrl string `json:"downloadUrl" validate:"required,url"` Filename string `json:"filename" validate:"required"` Type string `json:"type" validate:"oneof=ckpt lora lyco"` }
Wrapper class to send to extras/model/download
func (*ModelDownloadRequest) Validate ¶
func (req *ModelDownloadRequest) Validate() error
type ModelOptions ¶
type ModelOptions struct {
SdModelCheckpoint string `json:"sd_model_checkpoint"`
}
for setting the model
type ModelVersionDetails ¶
type ModelVersionDetails struct { ModelVersionResponse Multiplier float32 `json:"multiplier" validate:"omitempty"` // Only used for Lora models Vae *DownloadInfo `json:"vae" validate:"omitempty"` // VAE file reference Model *DownloadInfo `json:"model" validate:"required"` // Model file reference }
func LoraToModelDetails ¶
func LoraToModelDetails(ctx context.Context, lora generator.LoraVersionReference, modelType string) (*ModelVersionDetails, error)
Overload for loras
func ToModelDetails ¶
func ToModelDetails(ctx context.Context, model *generator.ModelVersionReference, modelType string) (*ModelVersionDetails, error)
Converts a ModelVersionReference to a ModelVersionDetails by fetching the relevant information from the API
func (*ModelVersionDetails) DownloadModels ¶
func (gen *ModelVersionDetails) DownloadModels(ctx context.Context, url, logPrefix string, checkVae bool) error
Download the model and check the related vae
func (*ModelVersionDetails) GetLogTags ¶
func (ref *ModelVersionDetails) GetLogTags() string
func (*ModelVersionDetails) LogWithTags ¶
func (req *ModelVersionDetails) LogWithTags(ctx context.Context, msg ...string)
type ModelVersionFile ¶
type ModelVersionInfo ¶
type ModelVersionInfo struct { BaseModel string `json:"base_model"` Description string `json:"description"` DownloadUrl string `json:"download_url" validate:"required,url"` Id string `json:"id" validate:"required,uuid"` ModelId string `json:"model_id" validate:"required,uuid"` Name string `json:"name" validate:"required"` TrainedWords []string `json:"trained_words" validate:"omitempty"` }
func (*ModelVersionInfo) GetLogTags ¶
func (ref *ModelVersionInfo) GetLogTags() string
type ModelVersionResponse ¶
type ModelVersionResponse struct { Files []ModelDownloadInfo `json:"files" validate:"required"` Info ModelVersionInfo `json:"info" validate:"required"` }
The response from /model/version/details/{uuid}
type WebuiRequest ¶
type WebuiRequest struct { SdModelCheckpoint string `json:"sd_model_checkpoint" validate:"required"` // String representation of ModelVersionReference to send to webui SendImage bool `json:"send_image" validate:"omitempty"` // should always be false AlwaysonScripts AlwaysonScripts `json:"alwayson_scripts" validate:"omitempty"` // additonal values, unstructured json, probably need real models for this }
sent to automatic1111 webui
func (*WebuiRequest) GetLogTags ¶
func (msg *WebuiRequest) GetLogTags() string
TODO: add prompt/negative prompt length
func (*WebuiRequest) LogWithTags ¶
func (req *WebuiRequest) LogWithTags(ctx context.Context, msg ...string)
func (*WebuiRequest) Validate ¶
func (req *WebuiRequest) Validate() error
Click to show internal directories.
Click to hide internal directories.