Documentation
¶
Index ¶
- Constants
- Variables
- type CStableDiffusion
- type CStableDiffusionImpl
- func (c *CStableDiffusionImpl) StableDiffusionFree(ctx *StableDiffusionCtx)
- func (c *CStableDiffusionImpl) StableDiffusionFreeBuffer(buffer uintptr)
- func (c *CStableDiffusionImpl) StableDiffusionFreeFullParams(params *StableDiffusionFullParams)
- func (c *CStableDiffusionImpl) StableDiffusionFullDefaultParamsRef() *StableDiffusionFullParams
- func (c *CStableDiffusionImpl) StableDiffusionFullParamsSetBatchCount(params *StableDiffusionFullParams, batchCount int)
- func (c *CStableDiffusionImpl) StableDiffusionFullParamsSetCfgScale(params *StableDiffusionFullParams, cfgScale float32)
- func (c *CStableDiffusionImpl) StableDiffusionFullParamsSetHeight(params *StableDiffusionFullParams, height int)
- func (c *CStableDiffusionImpl) StableDiffusionFullParamsSetNegativePrompt(params *StableDiffusionFullParams, negativePrompt string)
- func (c *CStableDiffusionImpl) StableDiffusionFullParamsSetSampleMethod(params *StableDiffusionFullParams, sampleMethod SampleMethod)
- func (c *CStableDiffusionImpl) StableDiffusionFullParamsSetSampleSteps(params *StableDiffusionFullParams, sampleSteps int)
- func (c *CStableDiffusionImpl) StableDiffusionFullParamsSetSeed(params *StableDiffusionFullParams, seed int64)
- func (c *CStableDiffusionImpl) StableDiffusionFullParamsSetStrength(params *StableDiffusionFullParams, strength float32)
- func (c *CStableDiffusionImpl) StableDiffusionFullParamsSetWidth(params *StableDiffusionFullParams, width int)
- func (c *CStableDiffusionImpl) StableDiffusionGetSystemInfo() string
- func (c *CStableDiffusionImpl) StableDiffusionImagePredictImage(ctx *StableDiffusionCtx, params *StableDiffusionFullParams, initImage []byte, ...) []byte
- func (c *CStableDiffusionImpl) StableDiffusionInit(nThreads int, vaeDecodeOnly bool, taesdPath string, freeParamsImmediately bool, ...) *StableDiffusionCtx
- func (c *CStableDiffusionImpl) StableDiffusionLoadFromFile(ctx *StableDiffusionCtx, filePath string, vaePath string, wtype GgmlType, ...)
- func (c *CStableDiffusionImpl) StableDiffusionPredictImage(ctx *StableDiffusionCtx, params *StableDiffusionFullParams, prompt string) []byte
- func (c *CStableDiffusionImpl) StableDiffusionSetLogLevel(level SDLogLevel)
- type GgmlType
- type OutputsImageType
- type RNGType
- type SDLogLevel
- type SampleMethod
- type Schedule
- type StableDiffusionCtx
- type StableDiffusionFullParams
- type StableDiffusionModel
- func (sd *StableDiffusionModel) Close() error
- func (sd *StableDiffusionModel) ImagePredict(reader io.Reader, prompt string, writer io.Writer) error
- func (sd *StableDiffusionModel) LoadFromFile(path string) error
- func (sd *StableDiffusionModel) Predict(prompt string, writer []io.Writer) error
- func (sd *StableDiffusionModel) SetOptions(options StableDiffusionOptions)
- type StableDiffusionOptions
Constants ¶
View Source
const ( DEBUG SDLogLevel = "DEBUG" INFO = "INFO" WARN = "WARN" ERROR = "ERROR" )
View Source
const ( EULER_A SampleMethod = "EULER_A" EULER = "EULER" HEUN = "HEUN" DPM2 = "DPM2" DPMPP2S_A = "DPMPP2S_A" DPMPP2M = "DPMPP2M" DPMPP2Mv2 = "DPMPP2Mv2" LCM = "LCM" N_SAMPLE_METHODS = "N_SAMPLE_METHODS" )
View Source
const ( DEFAULT Schedule = "DEFAULT" DISCRETE = "DISCRETE" KARRAS = "KARRAS" N_SCHEDULES = "N_SCHEDULES" )
View Source
const ( T_DEFAULT GgmlType = "DEFAULT" F32 = "F32" F16 = "F16" Q4_0 = "Q4_0" Q4_1 = "Q4_1" Q5_0 = "Q5_0" Q5_1 = "Q5_1" Q8_0 = "Q8_0" )
Variables ¶
View Source
var DefaultStableDiffusionOptions = StableDiffusionOptions{ Threads: -1, VaeDecodeOnly: true, FreeParamsImmediately: true, LoraModelDir: "", RngType: CUDA_RNG, WType: T_DEFAULT, Schedule: DEFAULT, NegativePrompt: "out of frame, lowers, text, error, cropped, worst quality, low quality, jpeg artifacts, ugly, duplicate, morbid, mutilated, out of frame, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, blurry, dehydrated, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, gross proportions, malformed limbs, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck, username, watermark, signature", CfgScale: 7.0, Width: 500, Height: 500, SampleMethod: EULER_A, SampleSteps: 20, Strength: 0.4, Seed: 42, BatchCount: 1, OutputsImageType: PNG, }
Functions ¶
This section is empty.
Types ¶
type CStableDiffusion ¶
type CStableDiffusion interface {
StableDiffusionFullDefaultParamsRef() *StableDiffusionFullParams
StableDiffusionFullParamsSetNegativePrompt(params *StableDiffusionFullParams, negativePrompt string)
StableDiffusionFullParamsSetCfgScale(params *StableDiffusionFullParams, cfgScale float32)
StableDiffusionFullParamsSetWidth(params *StableDiffusionFullParams, width int)
StableDiffusionFullParamsSetHeight(params *StableDiffusionFullParams, height int)
StableDiffusionFullParamsSetSampleMethod(params *StableDiffusionFullParams, sampleMethod SampleMethod)
StableDiffusionFullParamsSetSampleSteps(params *StableDiffusionFullParams, sampleSteps int)
StableDiffusionFullParamsSetSeed(params *StableDiffusionFullParams, seed int64)
StableDiffusionFullParamsSetBatchCount(params *StableDiffusionFullParams, batchCount int)
StableDiffusionFullParamsSetStrength(params *StableDiffusionFullParams, strength float32)
StableDiffusionInit(nThreads int, vaeDecodeOnly bool, taesdPath string, freeParamsImmediately bool, loraModelDir string, rngType RNGType) *StableDiffusionCtx
StableDiffusionLoadFromFile(ctx *StableDiffusionCtx, filePath string, vaePath string, wtype GgmlType, schedule Schedule)
StableDiffusionPredictImage(ctx *StableDiffusionCtx, params *StableDiffusionFullParams, prompt string) []byte
StableDiffusionImagePredictImage(ctx *StableDiffusionCtx, params *StableDiffusionFullParams, initImage []byte, prompt string) []byte
StableDiffusionSetLogLevel(level SDLogLevel)
StableDiffusionGetSystemInfo() string
StableDiffusionFree(ctx *StableDiffusionCtx)
StableDiffusionFreeBuffer(buffer uintptr)
StableDiffusionFreeFullParams(params *StableDiffusionFullParams)
}
func NewCStableDiffusion ¶
func NewCStableDiffusion(libraryPath string) (CStableDiffusion, error)
type CStableDiffusionImpl ¶
type CStableDiffusionImpl struct {
// contains filtered or unexported fields
}
func (*CStableDiffusionImpl) StableDiffusionFree ¶
func (c *CStableDiffusionImpl) StableDiffusionFree(ctx *StableDiffusionCtx)
func (*CStableDiffusionImpl) StableDiffusionFreeBuffer ¶
func (c *CStableDiffusionImpl) StableDiffusionFreeBuffer(buffer uintptr)
func (*CStableDiffusionImpl) StableDiffusionFreeFullParams ¶
func (c *CStableDiffusionImpl) StableDiffusionFreeFullParams(params *StableDiffusionFullParams)
func (*CStableDiffusionImpl) StableDiffusionFullDefaultParamsRef ¶
func (c *CStableDiffusionImpl) StableDiffusionFullDefaultParamsRef() *StableDiffusionFullParams
func (*CStableDiffusionImpl) StableDiffusionFullParamsSetBatchCount ¶
func (c *CStableDiffusionImpl) StableDiffusionFullParamsSetBatchCount(params *StableDiffusionFullParams, batchCount int)
func (*CStableDiffusionImpl) StableDiffusionFullParamsSetCfgScale ¶
func (c *CStableDiffusionImpl) StableDiffusionFullParamsSetCfgScale(params *StableDiffusionFullParams, cfgScale float32)
func (*CStableDiffusionImpl) StableDiffusionFullParamsSetHeight ¶
func (c *CStableDiffusionImpl) StableDiffusionFullParamsSetHeight(params *StableDiffusionFullParams, height int)
func (*CStableDiffusionImpl) StableDiffusionFullParamsSetNegativePrompt ¶
func (c *CStableDiffusionImpl) StableDiffusionFullParamsSetNegativePrompt(params *StableDiffusionFullParams, negativePrompt string)
func (*CStableDiffusionImpl) StableDiffusionFullParamsSetSampleMethod ¶
func (c *CStableDiffusionImpl) StableDiffusionFullParamsSetSampleMethod(params *StableDiffusionFullParams, sampleMethod SampleMethod)
func (*CStableDiffusionImpl) StableDiffusionFullParamsSetSampleSteps ¶
func (c *CStableDiffusionImpl) StableDiffusionFullParamsSetSampleSteps(params *StableDiffusionFullParams, sampleSteps int)
func (*CStableDiffusionImpl) StableDiffusionFullParamsSetSeed ¶
func (c *CStableDiffusionImpl) StableDiffusionFullParamsSetSeed(params *StableDiffusionFullParams, seed int64)
func (*CStableDiffusionImpl) StableDiffusionFullParamsSetStrength ¶
func (c *CStableDiffusionImpl) StableDiffusionFullParamsSetStrength(params *StableDiffusionFullParams, strength float32)
func (*CStableDiffusionImpl) StableDiffusionFullParamsSetWidth ¶
func (c *CStableDiffusionImpl) StableDiffusionFullParamsSetWidth(params *StableDiffusionFullParams, width int)
func (*CStableDiffusionImpl) StableDiffusionGetSystemInfo ¶
func (c *CStableDiffusionImpl) StableDiffusionGetSystemInfo() string
func (*CStableDiffusionImpl) StableDiffusionImagePredictImage ¶
func (c *CStableDiffusionImpl) StableDiffusionImagePredictImage(ctx *StableDiffusionCtx, params *StableDiffusionFullParams, initImage []byte, prompt string) []byte
func (*CStableDiffusionImpl) StableDiffusionInit ¶
func (c *CStableDiffusionImpl) StableDiffusionInit(nThreads int, vaeDecodeOnly bool, taesdPath string, freeParamsImmediately bool, loraModelDir string, rngType RNGType) *StableDiffusionCtx
func (*CStableDiffusionImpl) StableDiffusionLoadFromFile ¶
func (c *CStableDiffusionImpl) StableDiffusionLoadFromFile(ctx *StableDiffusionCtx, filePath string, vaePath string, wtype GgmlType, schedule Schedule)
func (*CStableDiffusionImpl) StableDiffusionPredictImage ¶
func (c *CStableDiffusionImpl) StableDiffusionPredictImage(ctx *StableDiffusionCtx, params *StableDiffusionFullParams, prompt string) []byte
func (*CStableDiffusionImpl) StableDiffusionSetLogLevel ¶
func (c *CStableDiffusionImpl) StableDiffusionSetLogLevel(level SDLogLevel)
type OutputsImageType ¶
type OutputsImageType string
const ( PNG OutputsImageType = "PNG" JPEG = "JPEG" )
type RNGType ¶
type RNGType string
const ( STD_DEFAULT_RNG RNGType = "STD_DEFAULT_RNG" CUDA_RNG = "CUDA_RNG" )
type SDLogLevel ¶
type SDLogLevel string
type SampleMethod ¶
type SampleMethod string
type StableDiffusionCtx ¶
type StableDiffusionCtx struct {
// contains filtered or unexported fields
}
type StableDiffusionFullParams ¶
type StableDiffusionFullParams struct {
// contains filtered or unexported fields
}
type StableDiffusionModel ¶
type StableDiffusionModel struct {
// contains filtered or unexported fields
}
func NewStableDiffusionAutoModel ¶
func NewStableDiffusionAutoModel(options StableDiffusionOptions) (*StableDiffusionModel, error)
func NewStableDiffusionModel ¶
func NewStableDiffusionModel(dylibPath string, options StableDiffusionOptions) (*StableDiffusionModel, error)
func (*StableDiffusionModel) Close ¶
func (sd *StableDiffusionModel) Close() error
func (*StableDiffusionModel) ImagePredict ¶
func (*StableDiffusionModel) LoadFromFile ¶
func (sd *StableDiffusionModel) LoadFromFile(path string) error
func (*StableDiffusionModel) Predict ¶
func (sd *StableDiffusionModel) Predict(prompt string, writer []io.Writer) error
func (*StableDiffusionModel) SetOptions ¶
func (sd *StableDiffusionModel) SetOptions(options StableDiffusionOptions)
type StableDiffusionOptions ¶
type StableDiffusionOptions struct {
Threads int
VaeDecodeOnly bool
TaesdPath string
FreeParamsImmediately bool
LoraModelDir string
RngType RNGType
VaePath string
WType GgmlType
Schedule Schedule
NegativePrompt string
CfgScale float32
Width int
Height int
SampleMethod SampleMethod
SampleSteps int
Strength float32
Seed int64
BatchCount int
GpuEnable bool
OutputsImageType OutputsImageType
}
Click to show internal directories.
Click to hide internal directories.