Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertModel ¶
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 ¶
type AdapterConverter interface {
// KV maps parameters to LLM key-values
KV(ggml.KV) ggml.KV
// Tensors maps input tensors to LLM tensors. Adapter specific modifications can be done here.
Tensors([]Tensor) []*ggml.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
}
type AdapterParameters ¶
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 ¶
func (p AdapterParameters) KV() ggml.KV
type ModelConverter ¶
type ModelConverter interface {
// KV maps parameters to LLM key-values
KV(*Tokenizer) ggml.KV
// Tensors maps input tensors to LLM tensors. Model specific modifications can be done here.
Tensors([]Tensor) []*ggml.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 ¶
type SpecialVocabulary ¶
type SpecialVocabulary struct {
Type string
ID int
Content string
AddToken bool
// IDs is populated by generation_config.json
IDs []int32
}
func (SpecialVocabulary) Key ¶
func (sv SpecialVocabulary) Key() string
type Tokenizer ¶
type Tokenizer struct {
*Vocabulary
SpecialVocabulary []*SpecialVocabulary
Merges []string
Pre string
Template string
}
Source Files
¶
- convert.go
- convert_bert.go
- convert_commandr.go
- convert_gemma.go
- convert_gemma2.go
- convert_gemma2_adapter.go
- convert_gemma3.go
- convert_gemma3n.go
- convert_gptoss.go
- convert_llama.go
- convert_llama4.go
- convert_llama_adapter.go
- convert_mistral.go
- convert_mixtral.go
- convert_mllama.go
- convert_phi3.go
- convert_qwen2.go
- convert_qwen25vl.go
- reader.go
- reader_safetensors.go
- reader_torch.go
- tensor.go
- tokenizer.go
- tokenizer_spm.go
Click to show internal directories.
Click to hide internal directories.