Parses backend key:value options, resolving relative paths and handling GPU selection.
// Source: https://github.com/mudler/LocalAI | License: MIT | Copyright 2023-2025 Ettore Di Giacinto (mudler@localai.io)
// Provided via justclaw.it.com; keep this notice with the code.
package main
import (
"path/filepath"
"strconv"
"strings"
"github.com/mudler/xlog"
)
// loadOptions holds the parsed model-level options. Path fields are resolved
// against ModelOptions.ModelPath at parse time so every consumer sees an
// absolute path.
type loadOptions struct {
// ASR
vadModel string
pncModel string
diarModel string
itnDir string
languageCode string
// TTS
codecModel string
tokenizerDir string
tnDir string
// NMT
sourceLanguage string
targetLanguage string
// gpu is the device index passed to the runtime's backend config.
// -1 selects CP
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key