api_config

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: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AutoGPTQ added in v1.24.1

type AutoGPTQ struct {
	ModelBaseName    string `yaml:"model_base_name"`
	Device           string `yaml:"device"`
	Triton           bool   `yaml:"triton"`
	UseFastTokenizer bool   `yaml:"use_fast_tokenizer"`
}

type Config

type Config struct {
	PredictionOptions `yaml:"parameters"`
	Name              string `yaml:"name"`

	F16            bool              `yaml:"f16"`
	Threads        int               `yaml:"threads"`
	Debug          bool              `yaml:"debug"`
	Roles          map[string]string `yaml:"roles"`
	Embeddings     bool              `yaml:"embeddings"`
	Backend        string            `yaml:"backend"`
	TemplateConfig TemplateConfig    `yaml:"template"`

	PromptStrings, InputStrings []string `yaml:"-"`
	InputToken                  [][]int  `yaml:"-"`

	FunctionsConfig Functions `yaml:"function"`

	FeatureFlag FeatureFlag `yaml:"feature_flags"` // Feature Flag registry. We move fast, and features may break on a per model/backend basis. Registry for (usually temporary) flags that indicate aborting something early.
	// LLM configs (GPT4ALL, Llama.cpp, ...)
	LLMConfig `yaml:",inline"`

	// AutoGPTQ specifics
	AutoGPTQ AutoGPTQ `yaml:"autogptq"`

	// Diffusers
	Diffusers Diffusers `yaml:"diffusers"`

	Step int `yaml:"step"`

	// GRPC Options
	GRPC GRPC `yaml:"grpc"`

	// Vall-e-x
	VallE VallE `yaml:"vall-e"`
	// contains filtered or unexported fields
}

func DefaultConfig

func DefaultConfig(modelFile string) *Config

func ReadConfig

func ReadConfig(file string) (*Config, error)

func ReadConfigFile

func ReadConfigFile(file string) ([]*Config, error)

func (*Config) FunctionToCall

func (c *Config) FunctionToCall() string

func (*Config) SetFunctionCallNameString

func (c *Config) SetFunctionCallNameString(s string)

func (*Config) SetFunctionCallString

func (c *Config) SetFunctionCallString(s string)

func (*Config) ShouldCallSpecificFunction

func (c *Config) ShouldCallSpecificFunction() bool

func (*Config) ShouldUseFunctions

func (c *Config) ShouldUseFunctions() bool

type ConfigLoader

type ConfigLoader struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewConfigLoader

func NewConfigLoader() *ConfigLoader

func (*ConfigLoader) GetAllConfigs added in v1.23.1

func (cm *ConfigLoader) GetAllConfigs() []Config

func (*ConfigLoader) GetConfig

func (cm *ConfigLoader) GetConfig(m string) (Config, bool)

func (*ConfigLoader) ListConfigs

func (cm *ConfigLoader) ListConfigs() []string

func (*ConfigLoader) LoadConfig

func (cm *ConfigLoader) LoadConfig(file string) error

func (*ConfigLoader) LoadConfigFile

func (cm *ConfigLoader) LoadConfigFile(file string) error

func (*ConfigLoader) LoadConfigs

func (cm *ConfigLoader) LoadConfigs(path string) error

type Diffusers added in v1.24.1

type Diffusers struct {
	PipelineType     string  `yaml:"pipeline_type"`
	SchedulerType    string  `yaml:"scheduler_type"`
	CUDA             bool    `yaml:"cuda"`
	EnableParameters string  `yaml:"enable_parameters"` // A list of comma separated parameters to specify
	CFGScale         float32 `yaml:"cfg_scale"`         // Classifier-Free Guidance Scale
	IMG2IMG          bool    `yaml:"img2img"`           // Image to Image Diffuser
	ClipSkip         int     `yaml:"clip_skip"`         // Skip every N frames
	ClipModel        string  `yaml:"clip_model"`        // Clip model to use
	ClipSubFolder    string  `yaml:"clip_subfolder"`    // Subfolder to use for clip model
}

type FeatureFlag added in v1.25.0

type FeatureFlag map[string]*bool

func (FeatureFlag) Enabled added in v1.25.0

func (ff FeatureFlag) Enabled(s string) bool

type Functions

type Functions struct {
	DisableNoAction         bool   `yaml:"disable_no_action"`
	NoActionFunctionName    string `yaml:"no_action_function_name"`
	NoActionDescriptionName string `yaml:"no_action_description_name"`
}

type GRPC added in v1.25.0

type GRPC struct {
	Attempts          int `yaml:"attempts"`
	AttemptsSleepTime int `yaml:"attempts_sleep_time"`
}

type LLMConfig added in v1.24.1

type LLMConfig struct {
	SystemPrompt    string   `yaml:"system_prompt"`
	TensorSplit     string   `yaml:"tensor_split"`
	MainGPU         string   `yaml:"main_gpu"`
	RMSNormEps      float32  `yaml:"rms_norm_eps"`
	NGQA            int32    `yaml:"ngqa"`
	PromptCachePath string   `yaml:"prompt_cache_path"`
	PromptCacheAll  bool     `yaml:"prompt_cache_all"`
	PromptCacheRO   bool     `yaml:"prompt_cache_ro"`
	MirostatETA     float64  `yaml:"mirostat_eta"`
	MirostatTAU     float64  `yaml:"mirostat_tau"`
	Mirostat        int      `yaml:"mirostat"`
	NGPULayers      int      `yaml:"gpu_layers"`
	MMap            bool     `yaml:"mmap"`
	MMlock          bool     `yaml:"mmlock"`
	LowVRAM         bool     `yaml:"low_vram"`
	Grammar         string   `yaml:"grammar"`
	StopWords       []string `yaml:"stopwords"`
	Cutstrings      []string `yaml:"cutstrings"`
	TrimSpace       []string `yaml:"trimspace"`
	ContextSize     int      `yaml:"context_size"`
	NUMA            bool     `yaml:"numa"`
	LoraAdapter     string   `yaml:"lora_adapter"`
	LoraBase        string   `yaml:"lora_base"`
	NoMulMatQ       bool     `yaml:"no_mulmatq"`
	DraftModel      string   `yaml:"draft_model"`
	NDraft          int32    `yaml:"n_draft"`
	Quantization    string   `yaml:"quantization"`
}

type PredictionOptions

type PredictionOptions struct {

	// Also part of the OpenAI official spec
	Model string `json:"model" yaml:"model"`

	// Also part of the OpenAI official spec
	Language string `json:"language"`

	// Also part of the OpenAI official spec. use it for returning multiple results
	N int `json:"n"`

	// Common options between all the API calls, part of the OpenAI spec
	TopP        float64 `json:"top_p" yaml:"top_p"`
	TopK        int     `json:"top_k" yaml:"top_k"`
	Temperature float64 `json:"temperature" yaml:"temperature"`
	Maxtokens   int     `json:"max_tokens" yaml:"max_tokens"`
	Echo        bool    `json:"echo"`

	// Custom parameters - not present in the OpenAI API
	Batch         int     `json:"batch" yaml:"batch"`
	F16           bool    `json:"f16" yaml:"f16"`
	IgnoreEOS     bool    `json:"ignore_eos" yaml:"ignore_eos"`
	RepeatPenalty float64 `json:"repeat_penalty" yaml:"repeat_penalty"`
	Keep          int     `json:"n_keep" yaml:"n_keep"`

	MirostatETA float64 `json:"mirostat_eta" yaml:"mirostat_eta"`
	MirostatTAU float64 `json:"mirostat_tau" yaml:"mirostat_tau"`
	Mirostat    int     `json:"mirostat" yaml:"mirostat"`

	FrequencyPenalty float64 `json:"frequency_penalty" yaml:"frequency_penalty"`
	TFZ              float64 `json:"tfz" yaml:"tfz"`

	TypicalP float64 `json:"typical_p" yaml:"typical_p"`
	Seed     int     `json:"seed" yaml:"seed"`

	NegativePrompt      string  `json:"negative_prompt" yaml:"negative_prompt"`
	RopeFreqBase        float32 `json:"rope_freq_base" yaml:"rope_freq_base"`
	RopeFreqScale       float32 `json:"rope_freq_scale" yaml:"rope_freq_scale"`
	NegativePromptScale float32 `json:"negative_prompt_scale" yaml:"negative_prompt_scale"`
	// AutoGPTQ
	UseFastTokenizer bool `json:"use_fast_tokenizer" yaml:"use_fast_tokenizer"`

	// Diffusers
	ClipSkip int `json:"clip_skip" yaml:"clip_skip"`

	// RWKV (?)
	Tokenizer string `json:"tokenizer" yaml:"tokenizer"`
}

type TemplateConfig

type TemplateConfig struct {
	Chat        string `yaml:"chat"`
	ChatMessage string `yaml:"chat_message"`
	Completion  string `yaml:"completion"`
	Edit        string `yaml:"edit"`
	Functions   string `yaml:"function"`
}

type VallE added in v1.30.0

type VallE struct {
	AudioPath string `yaml:"audio_path"`
}

Jump to

Keyboard shortcuts

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