gallery

package
v1.40.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: MIT Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InstallModel added in v1.20.0

func InstallModel(basePath, nameOverride string, config *Config, configOverrides map[string]interface{}, downloadStatus func(string, string, string, float64)) error

func InstallModelFromGallery added in v1.20.0

func InstallModelFromGallery(galleries []Gallery, name string, basePath string, req GalleryModel, downloadStatus func(string, string, string, float64)) error

Installs a model from the gallery (galleryname@modelname)

func InstallModelFromGalleryByName added in v1.22.0

func InstallModelFromGalleryByName(galleries []Gallery, name string, basePath string, req GalleryModel, downloadStatus func(string, string, string, float64)) error

InstallModelFromGalleryByName loads a model from the gallery by specifying only the name (first match wins)

Types

type Config

type Config struct {
	Description     string           `yaml:"description"`
	License         string           `yaml:"license"`
	URLs            []string         `yaml:"urls"`
	Name            string           `yaml:"name"`
	ConfigFile      string           `yaml:"config_file"`
	Files           []File           `yaml:"files"`
	PromptTemplates []PromptTemplate `yaml:"prompt_templates"`
}

description: |

foo

license: ""

urls: - -

name: "bar"

config_file: |

# Note, name will be injected. or generated by the alias wanted by the user
threads: 14

files:

  • filename: "" sha: "" uri: ""

prompt_templates:

  • name: "" content: ""

Config is the model configuration which contains all the model details This configuration is read from the gallery endpoint and is used to download and install the model

func GetGalleryConfigFromURL added in v1.20.0

func GetGalleryConfigFromURL(url string) (Config, error)

func ReadConfigFile

func ReadConfigFile(filePath string) (*Config, error)

type File

type File struct {
	Filename string `yaml:"filename" json:"filename"`
	SHA256   string `yaml:"sha256" json:"sha256"`
	URI      string `yaml:"uri" json:"uri"`
}
type Gallery struct {
	URL  string `json:"url" yaml:"url"`
	Name string `json:"name" yaml:"name"`
}

type GalleryModel added in v1.20.0

type GalleryModel struct {
	URL         string   `json:"url,omitempty" yaml:"url,omitempty"`
	Name        string   `json:"name,omitempty" yaml:"name,omitempty"`
	Description string   `json:"description,omitempty"  yaml:"description,omitempty"`
	License     string   `json:"license,omitempty"  yaml:"license,omitempty"`
	URLs        []string `json:"urls,omitempty" yaml:"urls,omitempty"`
	Icon        string   `json:"icon,omitempty" yaml:"icon,omitempty"`
	Tags        []string `json:"tags,omitempty" yaml:"tags,omitempty"`
	// config_file is read in the situation where URL is blank - and therefore this is a base config.
	ConfigFile map[string]interface{} `json:"config_file,omitempty" yaml:"config_file,omitempty"`
	// Overrides are used to override the configuration of the model located at URL
	Overrides map[string]interface{} `json:"overrides,omitempty" yaml:"overrides,omitempty"`
	// AdditionalFiles are used to add additional files to the model
	AdditionalFiles []File `json:"files,omitempty" yaml:"files,omitempty"`
	// Gallery is a reference to the gallery which contains the model
	Gallery Gallery `json:"gallery,omitempty" yaml:"gallery,omitempty"`
	// Installed is used to indicate if the model is installed or not
	Installed bool `json:"installed,omitempty" yaml:"installed,omitempty"`
}

GalleryModel is the struct used to represent a model in the gallery returned by the endpoint. It is used to install the model by resolving the URL and downloading the files. The other fields are used to override the configuration of the model.

func AvailableGalleryModels added in v1.20.0

func AvailableGalleryModels(galleries []Gallery, basePath string) ([]*GalleryModel, error)

List available models Models galleries are a list of yaml files that are hosted on a remote server (for example github). Each yaml file contains a list of models that can be downloaded and optionally overrides to define a new model setting.

func FindGallery added in v1.22.0

func FindGallery(models []*GalleryModel, name string) (*GalleryModel, error)

type PromptTemplate

type PromptTemplate struct {
	Name    string `yaml:"name"`
	Content string `yaml:"content"`
}

Jump to

Keyboard shortcuts

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