mirror of
https://github.com/mudler/LocalAI.git
synced 2025-05-09 12:03:15 +00:00
dependencies(grpcio): bump to fix CI issues (#2362)
feat(grpcio): bump to fix CI issues Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
parent
a58ff00ab1
commit
1a3dedece0
2
.github/workflows/generate_grpc_cache.yaml
vendored
2
.github/workflows/generate_grpc_cache.yaml
vendored
@ -84,7 +84,7 @@ jobs:
|
|||||||
build-args: |
|
build-args: |
|
||||||
GRPC_BASE_IMAGE=${{ matrix.grpc-base-image }}
|
GRPC_BASE_IMAGE=${{ matrix.grpc-base-image }}
|
||||||
GRPC_MAKEFLAGS=--jobs=4 --output-sync=target
|
GRPC_MAKEFLAGS=--jobs=4 --output-sync=target
|
||||||
GRPC_VERSION=v1.63.0
|
GRPC_VERSION=v1.64.0
|
||||||
context: .
|
context: .
|
||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
cache-to: type=gha,ignore-error=true
|
cache-to: type=gha,ignore-error=true
|
||||||
|
2
.github/workflows/image_build.yml
vendored
2
.github/workflows/image_build.yml
vendored
@ -218,7 +218,7 @@ jobs:
|
|||||||
BASE_IMAGE=${{ inputs.base-image }}
|
BASE_IMAGE=${{ inputs.base-image }}
|
||||||
GRPC_BASE_IMAGE=${{ inputs.grpc-base-image || inputs.base-image }}
|
GRPC_BASE_IMAGE=${{ inputs.grpc-base-image || inputs.base-image }}
|
||||||
GRPC_MAKEFLAGS=--jobs=4 --output-sync=target
|
GRPC_MAKEFLAGS=--jobs=4 --output-sync=target
|
||||||
GRPC_VERSION=v1.63.0
|
GRPC_VERSION=v1.64.0
|
||||||
MAKEFLAGS=${{ inputs.makeflags }}
|
MAKEFLAGS=${{ inputs.makeflags }}
|
||||||
context: .
|
context: .
|
||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
|
2
.github/workflows/release.yaml
vendored
2
.github/workflows/release.yaml
vendored
@ -5,7 +5,7 @@ on:
|
|||||||
- pull_request
|
- pull_request
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GRPC_VERSION: v1.63.0
|
GRPC_VERSION: v1.64.0
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
24
.github/workflows/test-extra.yml
vendored
24
.github/workflows/test-extra.yml
vendored
@ -29,7 +29,7 @@ jobs:
|
|||||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
sudo apt-get install -y ca-certificates cmake curl patch python3-pip
|
sudo apt-get install -y ca-certificates cmake curl patch python3-pip
|
||||||
sudo apt-get install -y libopencv-dev
|
sudo apt-get install -y libopencv-dev
|
||||||
pip install --user grpcio-tools==1.63.0
|
pip install --user grpcio-tools==1.64.0
|
||||||
|
|
||||||
- name: Test transformers
|
- name: Test transformers
|
||||||
run: |
|
run: |
|
||||||
@ -51,7 +51,7 @@ jobs:
|
|||||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
sudo apt-get install -y ca-certificates cmake curl patch python3-pip
|
sudo apt-get install -y ca-certificates cmake curl patch python3-pip
|
||||||
sudo apt-get install -y libopencv-dev
|
sudo apt-get install -y libopencv-dev
|
||||||
pip install --user grpcio-tools==1.63.0
|
pip install --user grpcio-tools==1.64.0
|
||||||
|
|
||||||
- name: Test sentencetransformers
|
- name: Test sentencetransformers
|
||||||
run: |
|
run: |
|
||||||
@ -74,7 +74,7 @@ jobs:
|
|||||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
sudo apt-get install -y ca-certificates cmake curl patch python3-pip
|
sudo apt-get install -y ca-certificates cmake curl patch python3-pip
|
||||||
sudo apt-get install -y libopencv-dev
|
sudo apt-get install -y libopencv-dev
|
||||||
pip install --user grpcio-tools==1.63.0
|
pip install --user grpcio-tools==1.64.0
|
||||||
|
|
||||||
- name: Test rerankers
|
- name: Test rerankers
|
||||||
run: |
|
run: |
|
||||||
@ -96,7 +96,7 @@ jobs:
|
|||||||
sudo apt-get install -y libopencv-dev
|
sudo apt-get install -y libopencv-dev
|
||||||
# Install UV
|
# Install UV
|
||||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
pip install --user grpcio-tools==1.63.0
|
pip install --user grpcio-tools==1.64.0
|
||||||
- name: Test diffusers
|
- name: Test diffusers
|
||||||
run: |
|
run: |
|
||||||
make --jobs=5 --output-sync=target -C backend/python/diffusers
|
make --jobs=5 --output-sync=target -C backend/python/diffusers
|
||||||
@ -117,7 +117,7 @@ jobs:
|
|||||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
sudo apt-get install -y ca-certificates cmake curl patch python3-pip
|
sudo apt-get install -y ca-certificates cmake curl patch python3-pip
|
||||||
sudo apt-get install -y libopencv-dev
|
sudo apt-get install -y libopencv-dev
|
||||||
pip install --user grpcio-tools==1.63.0
|
pip install --user grpcio-tools==1.64.0
|
||||||
|
|
||||||
- name: Test parler-tts
|
- name: Test parler-tts
|
||||||
run: |
|
run: |
|
||||||
@ -139,7 +139,7 @@ jobs:
|
|||||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
sudo apt-get install -y ca-certificates cmake curl patch python3-pip
|
sudo apt-get install -y ca-certificates cmake curl patch python3-pip
|
||||||
sudo apt-get install -y libopencv-dev
|
sudo apt-get install -y libopencv-dev
|
||||||
pip install --user grpcio-tools==1.63.0
|
pip install --user grpcio-tools==1.64.0
|
||||||
|
|
||||||
- name: Test openvoice
|
- name: Test openvoice
|
||||||
run: |
|
run: |
|
||||||
@ -161,7 +161,7 @@ jobs:
|
|||||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
sudo apt-get install -y ca-certificates cmake curl patch python3-pip
|
sudo apt-get install -y ca-certificates cmake curl patch python3-pip
|
||||||
sudo apt-get install -y libopencv-dev
|
sudo apt-get install -y libopencv-dev
|
||||||
pip install --user grpcio-tools==1.63.0
|
pip install --user grpcio-tools==1.64.0
|
||||||
|
|
||||||
- name: Test transformers-musicgen
|
- name: Test transformers-musicgen
|
||||||
run: |
|
run: |
|
||||||
@ -185,7 +185,7 @@ jobs:
|
|||||||
# curl -LsSf https://astral.sh/uv/install.sh | sh
|
# curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
# sudo apt-get install -y ca-certificates cmake curl patch python3-pip
|
# sudo apt-get install -y ca-certificates cmake curl patch python3-pip
|
||||||
# sudo apt-get install -y libopencv-dev
|
# sudo apt-get install -y libopencv-dev
|
||||||
# pip install --user grpcio-tools==1.63.0
|
# pip install --user grpcio-tools==1.64.0
|
||||||
|
|
||||||
# - name: Test petals
|
# - name: Test petals
|
||||||
# run: |
|
# run: |
|
||||||
@ -249,7 +249,7 @@ jobs:
|
|||||||
# curl -LsSf https://astral.sh/uv/install.sh | sh
|
# curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
# sudo apt-get install -y ca-certificates cmake curl patch python3-pip
|
# sudo apt-get install -y ca-certificates cmake curl patch python3-pip
|
||||||
# sudo apt-get install -y libopencv-dev
|
# sudo apt-get install -y libopencv-dev
|
||||||
# pip install --user grpcio-tools==1.63.0
|
# pip install --user grpcio-tools==1.64.0
|
||||||
|
|
||||||
# - name: Test bark
|
# - name: Test bark
|
||||||
# run: |
|
# run: |
|
||||||
@ -274,7 +274,7 @@ jobs:
|
|||||||
# curl -LsSf https://astral.sh/uv/install.sh | sh
|
# curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
# sudo apt-get install -y ca-certificates cmake curl patch python3-pip
|
# sudo apt-get install -y ca-certificates cmake curl patch python3-pip
|
||||||
# sudo apt-get install -y libopencv-dev
|
# sudo apt-get install -y libopencv-dev
|
||||||
# pip install --user grpcio-tools==1.63.0
|
# pip install --user grpcio-tools==1.64.0
|
||||||
# - name: Test vllm
|
# - name: Test vllm
|
||||||
# run: |
|
# run: |
|
||||||
# make --jobs=5 --output-sync=target -C backend/python/vllm
|
# make --jobs=5 --output-sync=target -C backend/python/vllm
|
||||||
@ -294,7 +294,7 @@ jobs:
|
|||||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
sudo apt-get install -y ca-certificates cmake curl patch python3-pip
|
sudo apt-get install -y ca-certificates cmake curl patch python3-pip
|
||||||
sudo apt-get install -y libopencv-dev
|
sudo apt-get install -y libopencv-dev
|
||||||
pip install --user grpcio-tools==1.63.0
|
pip install --user grpcio-tools==1.64.0
|
||||||
- name: Test vall-e-x
|
- name: Test vall-e-x
|
||||||
run: |
|
run: |
|
||||||
make --jobs=5 --output-sync=target -C backend/python/vall-e-x
|
make --jobs=5 --output-sync=target -C backend/python/vall-e-x
|
||||||
@ -314,7 +314,7 @@ jobs:
|
|||||||
sudo apt-get install -y ca-certificates cmake curl patch espeak espeak-ng python3-pip
|
sudo apt-get install -y ca-certificates cmake curl patch espeak espeak-ng python3-pip
|
||||||
# Install UV
|
# Install UV
|
||||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
pip install --user grpcio-tools==1.63.0
|
pip install --user grpcio-tools==1.64.0
|
||||||
- name: Test coqui
|
- name: Test coqui
|
||||||
run: |
|
run: |
|
||||||
make --jobs=5 --output-sync=target -C backend/python/coqui
|
make --jobs=5 --output-sync=target -C backend/python/coqui
|
||||||
|
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
@ -10,7 +10,7 @@ on:
|
|||||||
- '*'
|
- '*'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GRPC_VERSION: v1.63.0
|
GRPC_VERSION: v1.64.0
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ci-tests-${{ github.head_ref || github.ref }}-${{ github.repository }}
|
group: ci-tests-${{ github.head_ref || github.ref }}-${{ github.repository }}
|
||||||
@ -213,7 +213,7 @@ jobs:
|
|||||||
- name: Dependencies
|
- name: Dependencies
|
||||||
run: |
|
run: |
|
||||||
brew install protobuf grpc make protoc-gen-go protoc-gen-go-grpc
|
brew install protobuf grpc make protoc-gen-go protoc-gen-go-grpc
|
||||||
pip install --user grpcio-tools==1.63.0
|
pip install --user grpcio-tools==1.64.0
|
||||||
- name: Test
|
- name: Test
|
||||||
run: |
|
run: |
|
||||||
export C_INCLUDE_PATH=/usr/local/include
|
export C_INCLUDE_PATH=/usr/local/include
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
accelerate
|
accelerate
|
||||||
auto-gptq==0.7.1
|
auto-gptq==0.7.1
|
||||||
grpcio==1.63.0
|
grpcio==1.64.0
|
||||||
protobuf
|
protobuf
|
||||||
torch
|
torch
|
||||||
certifi
|
certifi
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
accelerate
|
accelerate
|
||||||
bark==0.1.5
|
bark==0.1.5
|
||||||
grpcio==1.63.0
|
grpcio==1.64.0
|
||||||
protobuf
|
protobuf
|
||||||
certifi
|
certifi
|
||||||
transformers
|
transformers
|
@ -1,2 +1,2 @@
|
|||||||
grpcio==1.63.0
|
grpcio==1.64.0
|
||||||
protobuf
|
protobuf
|
@ -1,6 +1,6 @@
|
|||||||
accelerate
|
accelerate
|
||||||
TTS==0.22.0
|
TTS==0.22.0
|
||||||
grpcio==1.63.0
|
grpcio==1.64.0
|
||||||
protobuf
|
protobuf
|
||||||
certifi
|
certifi
|
||||||
transformers
|
transformers
|
@ -1,7 +1,7 @@
|
|||||||
accelerate
|
accelerate
|
||||||
compel
|
compel
|
||||||
diffusers
|
diffusers
|
||||||
grpcio==1.63.0
|
grpcio==1.64.0
|
||||||
opencv-python
|
opencv-python
|
||||||
pillow
|
pillow
|
||||||
protobuf
|
protobuf
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
grpcio==1.63.0
|
grpcio==1.64.0
|
||||||
protobuf
|
protobuf
|
||||||
torch
|
torch
|
||||||
transformers
|
transformers
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
accelerate
|
accelerate
|
||||||
grpcio==1.63.0
|
grpcio==1.64.0
|
||||||
protobuf
|
protobuf
|
||||||
certifi
|
certifi
|
||||||
torch
|
torch
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
causal-conv1d==1.2.0.post2
|
causal-conv1d==1.2.0.post2
|
||||||
mamba-ssm==1.2.0.post1
|
mamba-ssm==1.2.0.post1
|
||||||
grpcio==1.63.0
|
grpcio==1.64.0
|
||||||
protobuf
|
protobuf
|
||||||
certifi
|
certifi
|
||||||
transformers
|
transformers
|
@ -2,7 +2,7 @@
|
|||||||
intel-extension-for-pytorch
|
intel-extension-for-pytorch
|
||||||
torch
|
torch
|
||||||
optimum[openvino]
|
optimum[openvino]
|
||||||
grpcio==1.63.0
|
grpcio==1.64.0
|
||||||
protobuf
|
protobuf
|
||||||
librosa==0.9.1
|
librosa==0.9.1
|
||||||
faster-whisper==0.9.0
|
faster-whisper==0.9.0
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
grpcio==1.63.0
|
grpcio==1.64.0
|
||||||
protobuf
|
protobuf
|
||||||
librosa==0.9.1
|
librosa==0.9.1
|
||||||
faster-whisper==0.9.0
|
faster-whisper==0.9.0
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
accelerate
|
accelerate
|
||||||
grpcio==1.63.0
|
grpcio==1.64.0
|
||||||
protobuf
|
protobuf
|
||||||
torch
|
torch
|
||||||
git+https://github.com/huggingface/parler-tts.git@10016fb0300c0dc31a0fb70e26f3affee7b62f16
|
git+https://github.com/huggingface/parler-tts.git@10016fb0300c0dc31a0fb70e26f3affee7b62f16
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
accelerate
|
accelerate
|
||||||
rerankers[transformers]
|
rerankers[transformers]
|
||||||
grpcio==1.63.0
|
grpcio==1.64.0
|
||||||
protobuf
|
protobuf
|
||||||
certifi
|
certifi
|
||||||
transformers
|
transformers
|
@ -1,6 +1,6 @@
|
|||||||
accelerate
|
accelerate
|
||||||
sentence-transformers==2.5.1
|
sentence-transformers==2.5.1
|
||||||
transformers
|
transformers
|
||||||
grpcio==1.63.0
|
grpcio==1.64.0
|
||||||
protobuf
|
protobuf
|
||||||
certifi
|
certifi
|
@ -1,6 +1,6 @@
|
|||||||
accelerate
|
accelerate
|
||||||
transformers
|
transformers
|
||||||
grpcio==1.63.0
|
grpcio==1.64.0
|
||||||
protobuf
|
protobuf
|
||||||
torch
|
torch
|
||||||
scipy==1.13.0
|
scipy==1.13.0
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
accelerate
|
accelerate
|
||||||
transformers
|
transformers
|
||||||
grpcio==1.63.0
|
grpcio==1.64.0
|
||||||
protobuf
|
protobuf
|
||||||
torch
|
torch
|
||||||
certifi
|
certifi
|
@ -1,4 +1,4 @@
|
|||||||
accelerate
|
accelerate
|
||||||
grpcio==1.63.0
|
grpcio==1.64.0
|
||||||
protobuf
|
protobuf
|
||||||
certifi
|
certifi
|
@ -1,6 +1,6 @@
|
|||||||
accelerate
|
accelerate
|
||||||
vllm
|
vllm
|
||||||
grpcio==1.63.0
|
grpcio==1.64.0
|
||||||
protobuf
|
protobuf
|
||||||
certifi
|
certifi
|
||||||
transformers
|
transformers
|
||||||
|
@ -2,6 +2,8 @@ package config
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
"regexp"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/go-skynet/LocalAI/core/schema"
|
"github.com/go-skynet/LocalAI/core/schema"
|
||||||
"github.com/go-skynet/LocalAI/pkg/downloader"
|
"github.com/go-skynet/LocalAI/pkg/downloader"
|
||||||
@ -356,3 +358,25 @@ func (cfg *BackendConfig) SetDefaults(opts ...ConfigLoaderOption) {
|
|||||||
cfg.Debug = &trueV
|
cfg.Debug = &trueV
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *BackendConfig) Validate() bool {
|
||||||
|
// Simple validation to make sure the model can be correctly loaded
|
||||||
|
for _, n := range []string{c.Backend, c.Model} {
|
||||||
|
if strings.HasPrefix(n, string(os.PathSeparator)) ||
|
||||||
|
strings.Contains(n, "..") {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if c.Name == "" {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if c.Backend != "" {
|
||||||
|
// a regex that checks that is a string name with no special characters, except '-' and '_'
|
||||||
|
re := regexp.MustCompile(`^[a-zA-Z0-9-_]+$`)
|
||||||
|
return re.MatchString(c.Backend)
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
@ -143,7 +143,9 @@ func (cm *BackendConfigLoader) LoadBackendConfigFile(file string, opts ...Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, cc := range c {
|
for _, cc := range c {
|
||||||
cm.configs[cc.Name] = *cc
|
if cc.Validate() {
|
||||||
|
cm.configs[cc.Name] = *cc
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -156,7 +158,12 @@ func (cl *BackendConfigLoader) LoadBackendConfig(file string, opts ...ConfigLoad
|
|||||||
return fmt.Errorf("cannot read config file: %w", err)
|
return fmt.Errorf("cannot read config file: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
cl.configs[c.Name] = *c
|
if c.Validate() {
|
||||||
|
cl.configs[c.Name] = *c
|
||||||
|
} else {
|
||||||
|
return fmt.Errorf("config is not valid")
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -297,7 +304,7 @@ func (cm *BackendConfigLoader) LoadBackendConfigsFromPath(path string, opts ...C
|
|||||||
defer cm.Unlock()
|
defer cm.Unlock()
|
||||||
entries, err := os.ReadDir(path)
|
entries, err := os.ReadDir(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("cannot read directory '%s': %w", path, err)
|
||||||
}
|
}
|
||||||
files := make([]fs.FileInfo, 0, len(entries))
|
files := make([]fs.FileInfo, 0, len(entries))
|
||||||
for _, entry := range entries {
|
for _, entry := range entries {
|
||||||
@ -314,8 +321,14 @@ func (cm *BackendConfigLoader) LoadBackendConfigsFromPath(path string, opts ...C
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
c, err := ReadBackendConfig(filepath.Join(path, file.Name()), opts...)
|
c, err := ReadBackendConfig(filepath.Join(path, file.Name()), opts...)
|
||||||
if err == nil {
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msgf("cannot read config file: %s", file.Name())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if c.Validate() {
|
||||||
cm.configs[c.Name] = *c
|
cm.configs[c.Name] = *c
|
||||||
|
} else {
|
||||||
|
log.Error().Err(err).Msgf("config is not valid")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
65
core/config/backend_config_test.go
Normal file
65
core/config/backend_config_test.go
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
package config_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"io"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
. "github.com/go-skynet/LocalAI/core/config"
|
||||||
|
|
||||||
|
. "github.com/onsi/ginkgo/v2"
|
||||||
|
. "github.com/onsi/gomega"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ = Describe("Test cases for config related functions", func() {
|
||||||
|
Context("Test Read configuration functions", func() {
|
||||||
|
It("Test Validate", func() {
|
||||||
|
tmp, err := os.CreateTemp("", "config.yaml")
|
||||||
|
Expect(err).To(BeNil())
|
||||||
|
defer os.Remove(tmp.Name())
|
||||||
|
_, err = tmp.WriteString(
|
||||||
|
`backend: "foo-bar"
|
||||||
|
parameters:
|
||||||
|
model: "foo-bar"`)
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
config, err := ReadBackendConfig(tmp.Name())
|
||||||
|
Expect(err).To(BeNil())
|
||||||
|
Expect(config).ToNot(BeNil())
|
||||||
|
Expect(config.Validate()).To(BeFalse())
|
||||||
|
})
|
||||||
|
It("Test Validate", func() {
|
||||||
|
tmp, err := os.CreateTemp("", "config.yaml")
|
||||||
|
Expect(err).To(BeNil())
|
||||||
|
defer os.Remove(tmp.Name())
|
||||||
|
_, err = tmp.WriteString(
|
||||||
|
`name: bar-baz
|
||||||
|
backend: "foo-bar"
|
||||||
|
parameters:
|
||||||
|
model: "foo-bar"`)
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
config, err := ReadBackendConfig(tmp.Name())
|
||||||
|
Expect(err).To(BeNil())
|
||||||
|
Expect(config).ToNot(BeNil())
|
||||||
|
// two configs in config.yaml
|
||||||
|
Expect(config.Name).To(Equal("bar-baz"))
|
||||||
|
Expect(config.Validate()).To(BeTrue())
|
||||||
|
|
||||||
|
// download https://raw.githubusercontent.com/mudler/LocalAI/master/embedded/models/hermes-2-pro-mistral.yaml
|
||||||
|
httpClient := http.Client{}
|
||||||
|
resp, err := httpClient.Get("https://raw.githubusercontent.com/mudler/LocalAI/master/embedded/models/hermes-2-pro-mistral.yaml")
|
||||||
|
Expect(err).To(BeNil())
|
||||||
|
defer resp.Body.Close()
|
||||||
|
tmp, err = os.CreateTemp("", "config.yaml")
|
||||||
|
Expect(err).To(BeNil())
|
||||||
|
defer os.Remove(tmp.Name())
|
||||||
|
_, err = io.Copy(tmp, resp.Body)
|
||||||
|
Expect(err).To(BeNil())
|
||||||
|
config, err = ReadBackendConfig(tmp.Name())
|
||||||
|
Expect(err).To(BeNil())
|
||||||
|
Expect(config).ToNot(BeNil())
|
||||||
|
// two configs in config.yaml
|
||||||
|
Expect(config.Name).To(Equal("hermes-2-pro-mistral"))
|
||||||
|
Expect(config.Validate()).To(BeTrue())
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
13
core/config/config_suite_test.go
Normal file
13
core/config/config_suite_test.go
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package config_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
. "github.com/onsi/ginkgo/v2"
|
||||||
|
. "github.com/onsi/gomega"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfig(t *testing.T) {
|
||||||
|
RegisterFailHandler(Fail)
|
||||||
|
RunSpecs(t, "Config test suite")
|
||||||
|
}
|
@ -28,16 +28,11 @@ var _ = Describe("Test cases for config related functions", func() {
|
|||||||
|
|
||||||
It("Test LoadConfigs", func() {
|
It("Test LoadConfigs", func() {
|
||||||
cm := NewBackendConfigLoader()
|
cm := NewBackendConfigLoader()
|
||||||
opts := NewApplicationConfig()
|
err := cm.LoadBackendConfigsFromPath(os.Getenv("MODELS_PATH"))
|
||||||
err := cm.LoadBackendConfigsFromPath(opts.ModelPath)
|
|
||||||
Expect(err).To(BeNil())
|
Expect(err).To(BeNil())
|
||||||
Expect(cm.ListBackendConfigs()).ToNot(BeNil())
|
Expect(cm.ListBackendConfigs()).ToNot(BeNil())
|
||||||
|
|
||||||
// config should includes gpt4all models's api.config
|
Expect(cm.ListBackendConfigs()).To(ContainElements("code-search-ada-code-001"))
|
||||||
Expect(cm.ListBackendConfigs()).To(ContainElements("gpt4all"))
|
|
||||||
|
|
||||||
// config should includes gpt2 models's api.config
|
|
||||||
Expect(cm.ListBackendConfigs()).To(ContainElements("gpt4all-2"))
|
|
||||||
|
|
||||||
// config should includes text-embedding-ada-002 models's api.config
|
// config should includes text-embedding-ada-002 models's api.config
|
||||||
Expect(cm.ListBackendConfigs()).To(ContainElements("text-embedding-ada-002"))
|
Expect(cm.ListBackendConfigs()).To(ContainElements("text-embedding-ada-002"))
|
||||||
|
@ -30,8 +30,10 @@ func (ml *ModelLoader) StopAllExcept(s string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ml *ModelLoader) deleteProcess(s string) error {
|
func (ml *ModelLoader) deleteProcess(s string) error {
|
||||||
if err := ml.grpcProcesses[s].Stop(); err != nil {
|
if _, exists := ml.grpcProcesses[s]; exists {
|
||||||
return err
|
if err := ml.grpcProcesses[s].Stop(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
delete(ml.grpcProcesses, s)
|
delete(ml.grpcProcesses, s)
|
||||||
delete(ml.models, s)
|
delete(ml.models, s)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user