mirror of
https://github.com/mudler/LocalAI.git
synced 2026-06-19 06:09:07 -04:00
* feat(backend): add depth-anything (Depth Anything 3) C++/ggml backend + gallery Mirrors the locate-anything-cpp backend to register a new depth-anything backend that wraps the Depth Anything 3 ggml port (depth-anything.cpp) via purego (cgo-less, no Python at inference). - backend/go/depth-anything-cpp/: gRPC backend (Load + Predict + GenerateImage), purego binding to the da_capi_* C ABI, CMake/Makefile/run/package/test scripts building depth-anything.cpp's DA_SHARED static .so per CPU variant. - backend/index.yaml: depth-anything backend meta + all hardware-variant capability entries (cpu/cuda12/cuda13/intel-sycl-f32+f16/vulkan/nvidia-l4t). - gallery/index.yaml: 8 Depth Anything 3 GGUF models (base q4_k/q8_0/f16/f32, small, large, giant, mono-large). - .github/backend-matrix.yml: one build entry per hardware variant. Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * feat(depth): typed Depth RPC + REST endpoint exposing full DA3 data Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * fix(depth): pin depth-anything.cpp to e0b6814 (ABI 3 dense C-API) The Depth RPC handler calls da_capi_depth_dense / da_capi_points (C-API ABI 3); pin the native build to the commit that exports them. Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * fix(depth): pin depth-anything.cpp to v0.1.0 release (b515c31) Repoint the native version from the now-orphaned e0b6814 to the b515c31 release commit, kept alive by the upstream v0.1.0 tag. C-API is unchanged (da_capi_abi_version == 3). Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * fix(depth): wire depth-anything-cpp into build, CI bump, and importer The backend dir, gallery index, and CI build-matrix were present but the backend was never wired into the integration points that adding-backends.md requires: - root Makefile: add to .NOTPARALLEL, the test-extra chain, a BACKEND_* definition, the docker-build target eval, and docker-build-backends (mirrors parakeet-cpp; the backend's own Makefile already documented that its `test` target is driven by test-extra). - bump_deps.yaml: register the DEPTHANYTHING_VERSION pin so the daily auto-bump bot tracks mudler/depth-anything.cpp master (it cannot see an unregistered Makefile pin). - import form: add a preference-only KnownBackend entry so depth-anything is selectable at /import-model (mirrors sam3-cpp; no reliable GGUF auto-detect signal, so pref-only per the doc's default). changed-backends.js needs no entry: the generic golang suffix branch already resolves backend/go/depth-anything-cpp/. Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * feat(depth): auto-detect importer for depth-anything GGUFs Replace the preference-only entry with a real auto-detect importer (mirrors parakeet-cpp / locate-anything): - DepthAnythingImporter matches a .gguf whose name carries a depth-anything token (depth-anything-<size>-<quant>.gguf), so /import-model recognises mudler/depth-anything.cpp-gguf repos and direct GGUF URLs without an explicit backend preference. preferences.backend= "depth-anything" still forces it. - Registered before LlamaCPPImporter so its GGUF bundles aren't claimed by the generic .gguf importer; the narrow name match means it cannot claim arbitrary llama GGUFs or the upstream safetensors PyTorch repos. - Multi-quant repos pick the smallest quant by default (q4_k -> ... -> f32, depth stays >0.998 corr even at q4_k); quantizations preference overrides. - Drops the now-redundant knownPrefOnlyBackends entry (importer-backed backends are not listed there, matching parakeet-cpp). - Table-driven Ginkgo test covers detection, negative cases (llama GGUF, upstream safetensors), default/override/fallback quant pick, and direct URL import. 10/10 specs pass. Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * fix(depth): check conn.Close error in grpc Depth client (errcheck) The new Depth() client method used a bare `defer conn.Close()`. golangci-lint runs with new-from-merge-base, so although the 39 sibling methods use the same bare form (grandfathered), the newly added line trips errcheck. Drop the result explicitly to satisfy the linter. Signed-off-by: Ettore Di Giacinto <mudler@localai.io> Assisted-by: Claude:claude-opus-4-8 * fix(depth): bump depth-anything.cpp to v0.1.1 (embeddable CMake) v0.1.0 (b515c31) used ${CMAKE_SOURCE_DIR} for its include dirs, which points at the parent project when built via add_subdirectory() as this backend does, so the container build failed with missing stb_image.h / da_gguf_keys.h. v0.1.1 (2d42897) switches to project-relative paths. Signed-off-by: Ettore Di Giacinto <mudler@localai.io> Assisted-by: Claude:claude-opus-4-8 * fix(depth): resolve gosec findings in the backend wrapper The code-scanning gate flagged three new failure-level alerts in godepthanythingcpp.go (gosec runs with -no-fail; GitHub gates on new alerts): - G301: export dirs were created with 0o755. Tighten to 0o750 (no world access needed for backend-written export output). - G304: writeDepthPNG creates req.GetDst(). That path is chosen by the LocalAI core as the intended output destination (same pattern every image backend uses), not attacker input, so annotate with #nosec G304 and document why. The remaining G103 "audit unsafe" notes on the unsafe.Slice C-buffer copies are warning-level (the same purego interop whisper/parakeet use) and do not gate the check, per the supertonic exclusion precedent in secscan.yaml. Signed-off-by: Ettore Di Giacinto <mudler@localai.io> Assisted-by: Claude:claude-opus-4-8 * fix(depth): bump depth-anything.cpp to v0.1.2 (CUDA cross-build arch) v0.1.1 forced CMAKE_CUDA_ARCHITECTURES=native, which breaks the GPU-less l4t/cublas CI builds (nvcc "Unsupported gpu architecture 'compute_'" on CMake 3.22). v0.1.2 (442eea4) drops the override and lets ggml pick its default cross-build arch list. Signed-off-by: Ettore Di Giacinto <mudler@localai.io> Assisted-by: Claude:claude-opus-4-8 --------- Signed-off-by: Ettore Di Giacinto <mudler@localai.io> Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
93 lines
3.4 KiB
Go
93 lines
3.4 KiB
Go
package meta
|
|
|
|
// Dynamic autocomplete provider constants (runtime lookup required).
|
|
const (
|
|
ProviderBackends = "backends"
|
|
ProviderModels = "models"
|
|
ProviderModelsChat = "models:chat"
|
|
ProviderModelsTTS = "models:tts"
|
|
ProviderModelsTranscript = "models:transcript"
|
|
ProviderModelsVAD = "models:vad"
|
|
ProviderModelsScore = "models:score"
|
|
)
|
|
|
|
// Static option lists embedded directly in field metadata.
|
|
|
|
var QuantizationOptions = []FieldOption{
|
|
{Value: "q4_0", Label: "Q4_0"},
|
|
{Value: "q4_1", Label: "Q4_1"},
|
|
{Value: "q5_0", Label: "Q5_0"},
|
|
{Value: "q5_1", Label: "Q5_1"},
|
|
{Value: "q8_0", Label: "Q8_0"},
|
|
{Value: "q2_K", Label: "Q2_K"},
|
|
{Value: "q3_K_S", Label: "Q3_K_S"},
|
|
{Value: "q3_K_M", Label: "Q3_K_M"},
|
|
{Value: "q3_K_L", Label: "Q3_K_L"},
|
|
{Value: "q4_K_S", Label: "Q4_K_S"},
|
|
{Value: "q4_K_M", Label: "Q4_K_M"},
|
|
{Value: "q5_K_S", Label: "Q5_K_S"},
|
|
{Value: "q5_K_M", Label: "Q5_K_M"},
|
|
{Value: "q6_K", Label: "Q6_K"},
|
|
}
|
|
|
|
var CacheTypeOptions = []FieldOption{
|
|
{Value: "f16", Label: "F16"},
|
|
{Value: "f32", Label: "F32"},
|
|
{Value: "q8_0", Label: "Q8_0"},
|
|
{Value: "q4_0", Label: "Q4_0"},
|
|
{Value: "q4_1", Label: "Q4_1"},
|
|
{Value: "q5_0", Label: "Q5_0"},
|
|
{Value: "q5_1", Label: "Q5_1"},
|
|
}
|
|
|
|
var DiffusersPipelineOptions = []FieldOption{
|
|
{Value: "StableDiffusionPipeline", Label: "StableDiffusionPipeline"},
|
|
{Value: "StableDiffusionImg2ImgPipeline", Label: "StableDiffusionImg2ImgPipeline"},
|
|
{Value: "StableDiffusionXLPipeline", Label: "StableDiffusionXLPipeline"},
|
|
{Value: "StableDiffusionXLImg2ImgPipeline", Label: "StableDiffusionXLImg2ImgPipeline"},
|
|
{Value: "StableDiffusionDepth2ImgPipeline", Label: "StableDiffusionDepth2ImgPipeline"},
|
|
{Value: "DiffusionPipeline", Label: "DiffusionPipeline"},
|
|
{Value: "StableVideoDiffusionPipeline", Label: "StableVideoDiffusionPipeline"},
|
|
}
|
|
|
|
// UsecaseOptions must stay in sync with GetAllModelConfigUsecases in
|
|
// core/config/model_config.go — a value missing here is silently
|
|
// inaccessible from the model editor, which is how `score` (the router
|
|
// classifier usecase) hid for an entire release.
|
|
var UsecaseOptions = []FieldOption{
|
|
{Value: "chat", Label: "Chat"},
|
|
{Value: "completion", Label: "Completion"},
|
|
{Value: "edit", Label: "Edit"},
|
|
{Value: "embeddings", Label: "Embeddings"},
|
|
{Value: "rerank", Label: "Rerank"},
|
|
{Value: "score", Label: "Score (Router Classifier)"},
|
|
{Value: "image", Label: "Image"},
|
|
{Value: "vision", Label: "Vision"},
|
|
{Value: "detection", Label: "Detection"},
|
|
{Value: "depth", Label: "Depth"},
|
|
{Value: "face_recognition", Label: "Face Recognition"},
|
|
{Value: "transcript", Label: "Transcript"},
|
|
{Value: "diarization", Label: "Diarization"},
|
|
{Value: "speaker_recognition", Label: "Speaker Recognition"},
|
|
{Value: "tts", Label: "TTS"},
|
|
{Value: "sound_generation", Label: "Sound Generation"},
|
|
{Value: "audio_transform", Label: "Audio Transform"},
|
|
{Value: "realtime_audio", Label: "Realtime Audio"},
|
|
{Value: "tokenize", Label: "Tokenize"},
|
|
{Value: "vad", Label: "VAD"},
|
|
{Value: "video", Label: "Video"},
|
|
}
|
|
|
|
var DiffusersSchedulerOptions = []FieldOption{
|
|
{Value: "ddim", Label: "DDIM"},
|
|
{Value: "ddpm", Label: "DDPM"},
|
|
{Value: "pndm", Label: "PNDM"},
|
|
{Value: "lms", Label: "LMS"},
|
|
{Value: "euler", Label: "Euler"},
|
|
{Value: "euler_a", Label: "Euler A"},
|
|
{Value: "dpm_multistep", Label: "DPM Multistep"},
|
|
{Value: "dpm_singlestep", Label: "DPM Singlestep"},
|
|
{Value: "heun", Label: "Heun"},
|
|
{Value: "unipc", Label: "UniPC"},
|
|
}
|