Documentation
¶
Index ¶
- func ConvertAdapter(fsys fs.FS, ws io.WriteSeeker, baseKV llm.KV) error
- func ConvertModel(fsys fs.FS, ws io.WriteSeeker) error
- func NewZipReader(r *zip.Reader, p string, limit int64) fs.FS
- type AdapterConverter
- type AdapterParameters
- type ModelConverter
- type ModelParameters
- type SpecialVocabulary
- type Tensor
- type Tokenizer
- type Vocabulary
- type ZipReader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertAdapter ¶ added in v0.3.7
func ConvertModel ¶ added in v0.3.7
func ConvertModel(fsys fs.FS, ws io.WriteSeeker) error
Convert writes an Ollama compatible model to the provided io.WriteSeeker based on configurations and files it finds in the input path. Supported input model formats include safetensors. Supported input tokenizers files include tokenizer.json (preferred) and tokenizer.model.
Types ¶
type AdapterConverter ¶ added in v0.3.7
type AdapterConverter interface {
// KV maps parameters to LLM key-values
KV(llm.KV) llm.KV
// Tensors maps input tensors to LLM tensors. Adapter specific modifications can be done here.
Tensors([]Tensor) []llm.Tensor
// Replacements returns a list of string pairs to replace in tensor names.
// See [strings.Replacer](https://pkg.go.dev/strings#Replacer) for details
Replacements() []string
// contains filtered or unexported methods
}
type AdapterParameters ¶ added in v0.3.7
type AdapterParameters struct {
Alpha uint32 `json:"lora_alpha"`
LoraLayers uint32 `json:"lora_layers"`
LoraParameters struct {
Rank uint32 `json:"rank"`
Alpha float32 `json:"alpha"`
Scale float32 `json:"scale"`
} `json:"lora_parameters"`
}
func (AdapterParameters) KV ¶ added in v0.3.7
func (p AdapterParameters) KV() llm.KV
type ModelConverter ¶ added in v0.3.7
type ModelConverter interface {
// KV maps parameters to LLM key-values
KV(*Tokenizer) llm.KV
// Tensors maps input tensors to LLM tensors. Model specific modifications can be done here.
Tensors([]Tensor) []llm.Tensor
// Replacements returns a list of string pairs to replace in tensor names.
// See [strings.Replacer](https://pkg.go.dev/strings#Replacer) for details
Replacements() []string
// contains filtered or unexported methods
}
type ModelParameters ¶ added in v0.3.7
type SpecialVocabulary ¶ added in v0.3.3
func (SpecialVocabulary) Key ¶ added in v0.3.3
func (sv SpecialVocabulary) Key() string
type Tokenizer ¶ added in v0.1.39
type Tokenizer struct {
*Vocabulary
SpecialVocabulary []*SpecialVocabulary
Merges []string
Pre string
Template string
}
type Vocabulary ¶ added in v0.3.3
Source Files
¶
Click to show internal directories.
Click to hide internal directories.