Documentation ¶
Index ¶
- Constants
- func Free[T any](p *T)
- func FreeSlice[T any](p []T)
- func Free_sd_ctx(p *Ctx)
- func MaybeFreeCond(ctx *Ctx)
- func MaybeFreeDiff(ctx *Ctx)
- func MaybeFreeFirst(ctx *Ctx)
- func SD_get_system_info() string
- func SD_image_to_tensor(out *Tensor, img *image.NRGBA)
- func SD_tensor_to_image(input *Tensor) *image.NRGBA
- type Ctx
- type GGMLBackend
- type GGMLContext
- type GGMLInitParams
- type GGMLType
- type RNG_type_t
- type SD_image_t
- type SD_type_t
- type Sample_method_t
- type Schedule_t
- type Tensor
- func DecodeFirstStage(ctx *Ctx, gctx *GGMLContext, t *Tensor) *Tensor
- func GetLearnedCondition(ctx *Ctx, gctx *GGMLContext, prompt string, clipSkip int, width, height int) (c, cvec *Tensor)
- func GetLearnedConditionNeg(ctx *Ctx, gctx *GGMLContext, prompt string, clipSkip int, width, height int) (c, cvec *Tensor)
- func NewTensor1D(ctx *GGMLContext, typ GGMLType, ne0 int) *Tensor
- func NewTensor2D(ctx *GGMLContext, typ GGMLType, ne0, ne1 int) *Tensor
- func NewTensor3D(ctx *GGMLContext, typ GGMLType, ne0, ne1, ne2 int) *Tensor
- func NewTensor4D(ctx *GGMLContext, typ GGMLType, ne0, ne1, ne2, ne3 int) *Tensor
- func Sample(ctx *Ctx, gctx *GGMLContext, xt, noise *Tensor, ...) *Tensor
- func (t *Tensor) C() *C.struct_ggml_tensor
- func (t *Tensor) Get1DF32(l int) float32
- func (t *Tensor) Get2DF32(l, k int) float32
- func (t *Tensor) Get3DF32(l, k, j int) float32
- func (t *Tensor) Get4DF32(l, k, j, i int) float32
- func (t *Tensor) Set1DF32(val float32, l int)
- func (t *Tensor) Set2DF32(val float32, l, k int)
- func (t *Tensor) Set3DF32(val float32, l, k, j int)
- func (t *Tensor) Set4DF32(val float32, l, k, j, i int)
- func (t *Tensor) Type() GGMLType
Constants ¶
View Source
const ( GGMLTypeF16 = GGMLType(C.GGML_TYPE_F16) GGMLTypeF32 = GGMLType(C.GGML_TYPE_F32) GGMLTypeDefault = GGMLType(C.GGML_TYPE_COUNT) )
View Source
const ( SD_TYPE_F32 = C.SD_TYPE_F32 SD_TYPE_F16 = C.SD_TYPE_F16 SD_TYPE_Q4_0 = C.SD_TYPE_Q4_0 SD_TYPE_Q4_1 = C.SD_TYPE_Q4_1 SD_TYPE_Q5_0 = C.SD_TYPE_Q5_0 SD_TYPE_Q5_1 = C.SD_TYPE_Q5_1 SD_TYPE_Q8_0 = C.SD_TYPE_Q8_0 SD_TYPE_Q8_1 = C.SD_TYPE_Q8_1 SD_TYPE_Q2_K = C.SD_TYPE_Q2_K SD_TYPE_Q3_K = C.SD_TYPE_Q3_K SD_TYPE_Q4_K = C.SD_TYPE_Q4_K SD_TYPE_Q5_K = C.SD_TYPE_Q5_K SD_TYPE_Q6_K = C.SD_TYPE_Q6_K SD_TYPE_Q8_K = C.SD_TYPE_Q8_K SD_TYPE_IQ2_XXS = C.SD_TYPE_IQ2_XXS SD_TYPE_I8 = C.SD_TYPE_I8 SD_TYPE_I16 = C.SD_TYPE_I16 SD_TYPE_I32 = C.SD_TYPE_I32 SD_TYPE_COUNT = C.SD_TYPE_COUNT )
View Source
const ( STD_DEFAULT_RNG = C.STD_DEFAULT_RNG CUDA_RNG = C.CUDA_RNG )
View Source
const ( DEFAULT = C.DEFAULT DISCRETE = C.DISCRETE KARRAS = C.KARRAS N_SCHEDULES = C.N_SCHEDULES )
Variables ¶
This section is empty.
Functions ¶
func Free_sd_ctx ¶
func Free_sd_ctx(p *Ctx)
func MaybeFreeCond ¶
func MaybeFreeCond(ctx *Ctx)
func MaybeFreeDiff ¶
func MaybeFreeDiff(ctx *Ctx)
func MaybeFreeFirst ¶
func MaybeFreeFirst(ctx *Ctx)
func SD_get_system_info ¶
func SD_get_system_info() string
func SD_image_to_tensor ¶
func SD_tensor_to_image ¶
Types ¶
type Ctx ¶
func New_sd_ctx ¶
func New_sd_ctx( modelPath, vaePath, taesdPath, ctrlNetPath, loraPath, embedDir string, vaeDecOnly, vaeTiling, freeParamsImmediately bool, threads int, typ SD_type_t, rnd RNG_type_t, sched Schedule_t, keepCtrlCPU bool, ) *Ctx
type GGMLBackend ¶
type GGMLBackend interface {
IsCPU() bool
}
func GGMLNewCPU ¶
func GGMLNewCPU() GGMLBackend
type GGMLContext ¶
type GGMLContext C.struct_ggml_context
func GGMLInit ¶
func GGMLInit(params GGMLInitParams) (*GGMLContext, error)
func (*GGMLContext) C ¶
func (ctx *GGMLContext) C() *C.struct_ggml_context
func (*GGMLContext) Free ¶
func (ctx *GGMLContext) Free()
type GGMLInitParams ¶
type RNG_type_t ¶
type RNG_type_t = C.enum_rng_type_t
type SD_image_t ¶
type SD_image_t C.sd_image_t
func Txt2Img ¶
func Txt2Img( ctx *Ctx, prompt, negative string, clipSkip int, cfgScale float32, w, h int, sample Sample_method_t, steps int, seed int64, batchCount int, controlCond *SD_image_t, controlStrength float32, ) []SD_image_t
func (*SD_image_t) Channels ¶
func (img *SD_image_t) Channels() int
func (*SD_image_t) Data ¶
func (img *SD_image_t) Data() []byte
func (*SD_image_t) Size ¶
func (img *SD_image_t) Size() (w, h int)
type SD_type_t ¶
type SD_type_t = C.enum_sd_type_t
type Sample_method_t ¶
type Sample_method_t = C.enum_sample_method_t
type Schedule_t ¶
type Schedule_t = C.enum_schedule_t
type Tensor ¶
type Tensor struct {
// contains filtered or unexported fields
}
Tensor is a n-dimensional tensor.
func DecodeFirstStage ¶
func DecodeFirstStage(ctx *Ctx, gctx *GGMLContext, t *Tensor) *Tensor
func GetLearnedCondition ¶
func GetLearnedConditionNeg ¶
func NewTensor1D ¶
func NewTensor1D(ctx *GGMLContext, typ GGMLType, ne0 int) *Tensor
func NewTensor2D ¶
func NewTensor2D(ctx *GGMLContext, typ GGMLType, ne0, ne1 int) *Tensor
func NewTensor3D ¶
func NewTensor3D(ctx *GGMLContext, typ GGMLType, ne0, ne1, ne2 int) *Tensor
func NewTensor4D ¶
func NewTensor4D(ctx *GGMLContext, typ GGMLType, ne0, ne1, ne2, ne3 int) *Tensor
func Sample ¶
func Sample( ctx *Ctx, gctx *GGMLContext, xt, noise *Tensor, c, cvec, uc, ucvec, hint *Tensor, seed int64, method Sample_method_t, steps int, cfgScale, controlStrength float32, ) *Tensor
func (*Tensor) C ¶
func (t *Tensor) C() *C.struct_ggml_tensor
Click to show internal directories.
Click to hide internal directories.