bind

package
v0.0.0-...-c9557dd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const LogBufferSize = 1024 // from sd.cpp

Variables

This section is empty.

Functions

func CloseLibrary

func CloseLibrary(handle uintptr) error

func OpenLibrary

func OpenLibrary() (ptr uintptr, filename string, err error)

Types

type CLogCallback

type CLogCallback func(level int, text string)

type CStableDiffusionCtx

type CStableDiffusionCtx struct {
	Path string
	CTX  unsafe.Pointer
}

type CStableDiffusionImpl

type CStableDiffusionImpl struct {
	SDSetLogCallback        func(callback func(level int, text *byte, data unsafe.Pointer) unsafe.Pointer, data int)
	SDSetResultCallback     func(ctx unsafe.Pointer, callback func(num uint64, imageData *byte, in *opts.Generation), in *opts.Generation)
	SDSetResultStepCallback func(ctx unsafe.Pointer, callback func(num uint64, step uint64, imageData *byte, in *opts.Generation), in *opts.Generation)

	Text2Image func(
		sdCTX unsafe.Pointer,
		prompt, negPrompt string,
		clipSkip int,
		cfgScale, guidance float32,
		width, height int,
		sampleMethod int,
		sampleSteps int,
		seed int64,
		batchCount int,
		controlCond unsafe.Pointer,
		controlStrength, styleStrength float32,
		normalizeInput bool,
		inputIDImagesPath string,
	)
	// contains filtered or unexported fields
}

func NewCStableDiffusion

func NewCStableDiffusion() (*CStableDiffusionImpl, error)

func (*CStableDiffusionImpl) Close

func (c *CStableDiffusionImpl) Close()

func (*CStableDiffusionImpl) FreeSDContext

func (c *CStableDiffusionImpl) FreeSDContext(ctx *CStableDiffusionCtx)

func (*CStableDiffusionImpl) NewSDContext

func (*CStableDiffusionImpl) SetLogCallBack

func (c *CStableDiffusionImpl) SetLogCallBack()

type CUpScalerCtx

type CUpScalerCtx struct {
	// contains filtered or unexported fields
}

type Image

type Image struct {
	Width   uint32
	Height  uint32
	Channel uint32
	Data    []byte
}

func ImageToBytes

func ImageToBytes(decode image.Image) Image

type NewSDContextGoParams

type NewSDContextGoParams struct {
	ModelPath      *byte
	FluxModelPath  *byte
	ClipLPath      *byte
	T5xxlPath      *byte
	VaePath        *byte
	TaesdPath      *byte
	ControlNetPath *byte
	LoraModelDir   *byte
	EmbedDir       *byte
	IDEmbedDir     *byte

	VaeDecodeOnly         bool
	FreeParamsImmediately bool
	KeepClipOnCPU         bool
	KeepControlNetCPU     bool
	KeepVAEOnCPU          bool
	VaeTiling             bool
	ShowDebug             bool

	NThreads uint8
	WType    uint8
	RngType  uint8
	Schedule uint8
}

type NewSDContextParams

type NewSDContextParams struct {
	ModelPath     string
	LoraModelDir  string
	VaePath       string
	NThreads      uint8
	WType         opts.WType
	RngType       opts.RNGType
	Schedule      opts.Schedule
	FluxModelPath string
	ClipLPath     string
	T5xxlPath     string

	// newSDContextParamsSet
	TAESDPath             string
	ControlNetPath        string
	EmbedDir              string
	IDEmbedDir            string
	VaeDecodeOnly         bool
	VaeTiling             bool
	FreeParamsImmediately bool
	KeepClipOnCpu         bool
	KeepControlNetCpu     bool
	KeepVaeOnCpu          bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL