Documentation
¶
Index ¶
- Constants
- func AllowedDTypes() []string
- func Convert(modelDir string, progress ProgressFunc, dtype string) (string, error)
- func ConvertPython(modelDir string, progress ProgressFunc, dtype string) (string, error)
- func FindGGUFForDType(modelDir, dtype string) (string, bool, error)
- func FindMMProjForDType(modelDir, dtype string) (string, bool, error)
- func HasConvertibleHFWeights(modelDir string) bool
- func HasGGUF(modelDir string) (string, bool)
- func HasPyTorchWeights(modelDir string) bool
- func HasSafeTensors(modelDir string) bool
- func IsSupportedHFArchitecture(hfArch string) bool
- func NeedsConversion(modelDir string) bool
- func NeedsConversionForDType(modelDir, dtype string) (bool, error)
- func NormalizeDType(value string) (string, error)
- func NormalizeRuntimeDType(value string) (string, error)
- func PythonConverterAvailable() bool
- func ResolveDType(value string) (string, error)
- func SupportedHFArchitecture(hfArch string) (string, bool)
- type ArchConverter
- type GGMLType
- type ProgressFunc
Constants ¶
const BundledConverterLLamacppRef = "b9158"
BundledConverterLLamacppRef documents the llama.cpp release tag the bundled script was taken from.
Variables ¶
This section is empty.
Functions ¶
func AllowedDTypes ¶
func AllowedDTypes() []string
AllowedDTypes returns the converter output dtypes accepted by csghub-lite.
func Convert ¶
func Convert(modelDir string, progress ProgressFunc, dtype string) (string, error)
Convert converts HuggingFace model files in modelDir to a GGUF file. It runs the llama.cpp convert_hf_to_gguf.py bundled in the binary (or from CSGHUB_LITE_CONVERTER_URL when set); see convert_python.go.
func ConvertPython ¶
func ConvertPython(modelDir string, progress ProgressFunc, dtype string) (string, error)
ConvertPython uses the official llama.cpp convert_hf_to_gguf.py to convert a HuggingFace model directory to GGUF format. Returns the path to the generated GGUF file. Requires python3 with torch, safetensors, and transformers.
func FindGGUFForDType ¶
FindGGUFForDType returns an existing GGUF path that matches the requested dtype. When dtype is empty or auto, it returns the highest precision GGUF chosen by model.FindModelFile.
func FindMMProjForDType ¶
FindMMProjForDType returns an existing mmproj GGUF path that matches the requested dtype. When dtype is empty or auto, it returns the highest precision mmproj GGUF if present.
func HasConvertibleHFWeights ¶
func HasPyTorchWeights ¶
HasPyTorchWeights reports whether modelDir contains legacy PyTorch .bin weights that llama.cpp's HuggingFace converter can read.
func HasSafeTensors ¶
HasSafeTensors reports whether modelDir contains SafeTensors files.
func IsSupportedHFArchitecture ¶
IsSupportedHFArchitecture reports whether csghub-lite can convert the HuggingFace architecture to GGUF via the bundled llama.cpp converter.
func NeedsConversion ¶
NeedsConversion checks if the model directory contains HuggingFace weights but no GGUF files.
func NeedsConversionForDType ¶
NeedsConversionForDType reports whether SafeTensors conversion is needed for the requested output dtype. When dtype is unset, it preserves the legacy behavior of accepting any existing GGUF.
func NormalizeDType ¶
NormalizeDType returns a lower-case converter dtype or "" when unset.
func NormalizeRuntimeDType ¶ added in v0.9.6
NormalizeRuntimeDType returns a lower-case converter dtype or GGUF quant label, or "" when unset.
func PythonConverterAvailable ¶
func PythonConverterAvailable() bool
PythonConverterAvailable returns true if python3 and the required dependencies are available for running the official converter.
func ResolveDType ¶
ResolveDType returns the effective converter dtype, falling back to the project default when the flag is unset.
func SupportedHFArchitecture ¶
SupportedHFArchitecture maps a HuggingFace architecture name to the llama.cpp GGUF runtime architecture it converts into.
Types ¶
type ArchConverter ¶
type ArchConverter interface {
Arch() string
WriteKV(w *ggufWriter, cfg *modelConfig)
ConvertTensors(w *ggufWriter, sources []tensorSource, cfg *modelConfig, progress ProgressFunc) error
}
ArchConverter handles architecture-specific GGUF conversion logic.
type GGMLType ¶
type GGMLType uint32
GGML tensor data types.
func (GGMLType) ElementSize ¶
Bytes per element for each GGML type.
type ProgressFunc ¶
ProgressFunc reports conversion progress.