Documentation
¶
Index ¶
Constants ¶
const (
// ModelSubdir is the subdirectory within a bundle where model files are stored
ModelSubdir = "model"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bundle ¶
type Bundle struct {
// contains filtered or unexported fields
}
Bundle represents a runtime bundle containing a model and runtime config
func Unpack ¶
Unpack creates and return a Bundle by unpacking files and config from model into dir. It auto-detects the packaging version:
- V0.2 (layer-per-file with annotations): Uses UnpackFromLayers for full path preservation
- V0.1 (legacy): Uses the original unpacking logic based on GGUFPaths(), SafetensorsPaths(), etc.
func UnpackFromLayers ¶ added in v1.0.14
func UnpackFromLayers(dir string, model types.ModelArtifact) (*Bundle, error)
UnpackFromLayers unpacks a model that was packaged using the layer-per-file approach. Each file is stored as an individual layer with its filepath preserved in annotations. This is the approach used by builder.FromDirectory and preserves nested directory structure.
Unlike the standard Unpack function which uses model.GGUFPaths(), model.SafetensorsPaths(), etc., this function iterates directly over layers and uses their filepath annotations.
func (*Bundle) ChatTemplatePath ¶
ChatTemplatePath return the path to a Jinja chat template file or "" if none is present.
func (*Bundle) DDUFPath ¶ added in v1.0.12
DDUFPath returns the path to the DDUF file (Diffusers Unified Format) or "" if none is present.
func (*Bundle) GGUFPath ¶
GGUFPath return the path to model GGUF file. If the model is sharded this will be the path to the first shard, containing metadata headers.
func (*Bundle) MMPROJPath ¶
MMPROJPath returns the path to a multi-modal projector file or "" if none is present.
func (*Bundle) RuntimeConfig ¶
func (b *Bundle) RuntimeConfig() types.ModelConfig
RuntimeConfig returns config that should be respected by the backend at runtime. Can return either Docker format (*types.Config) or ModelPack format (*modelpack.Model).
func (*Bundle) SafetensorsPath ¶
SafetensorsPath returns the path to model safetensors file. If the model is sharded this will be the path to the first shard.