mirror of
https://github.com/mudler/LocalAI.git
synced 2024-12-19 20:57:54 +00:00
test/fix: OSX Test Repair (#1843)
* test with gguf instead of ggml. Updates testPrompt to match? Adds debugging line to Dockerfile that I've found helpful recently. * fix testPrompt slightly * Sad Experiment: Test GH runner without metal? * break apart CGO_LDFLAGS * switch runner * upstream llama.cpp disables Metal on Github CI! * missed a dir from clean-tests * CGO_LDFLAGS * tmate failure + NO_ACCELERATE * whisper.cpp has a metal fix * do the exact opposite of the name of this branch, but keep it around for unrelated fixes? * add back newlines * add tmate to linux for testing * update fixtures * timeout for tmate
This commit is contained in:
parent
a046dcac5e
commit
ed5734ae25
12
.github/workflows/test.yml
vendored
12
.github/workflows/test.yml
vendored
@ -105,9 +105,13 @@ jobs:
|
|||||||
- name: Test
|
- name: Test
|
||||||
run: |
|
run: |
|
||||||
GO_TAGS="stablediffusion tts" make test
|
GO_TAGS="stablediffusion tts" make test
|
||||||
|
- name: Setup tmate session if tests fail
|
||||||
|
if: ${{ failure() }}
|
||||||
|
uses: mxschmitt/action-tmate@v3
|
||||||
|
timeout-minutes: 5
|
||||||
|
|
||||||
tests-apple:
|
tests-apple:
|
||||||
runs-on: macOS-latest
|
runs-on: macOS-14
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
go-version: ['1.21.x']
|
go-version: ['1.21.x']
|
||||||
@ -130,4 +134,8 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
export C_INCLUDE_PATH=/usr/local/include
|
export C_INCLUDE_PATH=/usr/local/include
|
||||||
export CPLUS_INCLUDE_PATH=/usr/local/include
|
export CPLUS_INCLUDE_PATH=/usr/local/include
|
||||||
CMAKE_ARGS="-DLLAMA_F16C=OFF -DLLAMA_AVX512=OFF -DLLAMA_AVX2=OFF -DLLAMA_FMA=OFF" make test
|
BUILD_TYPE="GITHUB_CI_HAS_BROKEN_METAL" CMAKE_ARGS="-DLLAMA_F16C=OFF -DLLAMA_AVX512=OFF -DLLAMA_AVX2=OFF -DLLAMA_FMA=OFF" make test
|
||||||
|
- name: Setup tmate session if tests fail
|
||||||
|
if: ${{ failure() }}
|
||||||
|
uses: mxschmitt/action-tmate@v3
|
||||||
|
timeout-minutes: 5
|
@ -108,6 +108,7 @@ WORKDIR /build
|
|||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
COPY .git .
|
COPY .git .
|
||||||
|
RUN echo "GO_TAGS: $GO_TAGS"
|
||||||
RUN make prepare
|
RUN make prepare
|
||||||
|
|
||||||
# If we are building with clblas support, we need the libraries for the builds
|
# If we are building with clblas support, we need the libraries for the builds
|
||||||
|
19
Makefile
19
Makefile
@ -70,7 +70,7 @@ UNAME_S := $(shell uname -s)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(OS),Darwin)
|
ifeq ($(OS),Darwin)
|
||||||
CGO_LDFLAGS += -lcblas -framework Accelerate
|
|
||||||
ifeq ($(OSX_SIGNING_IDENTITY),)
|
ifeq ($(OSX_SIGNING_IDENTITY),)
|
||||||
OSX_SIGNING_IDENTITY := $(shell security find-identity -v -p codesigning | grep '"' | head -n 1 | sed -E 's/.*"(.*)"/\1/')
|
OSX_SIGNING_IDENTITY := $(shell security find-identity -v -p codesigning | grep '"' | head -n 1 | sed -E 's/.*"(.*)"/\1/')
|
||||||
endif
|
endif
|
||||||
@ -81,6 +81,12 @@ ifeq ($(OS),Darwin)
|
|||||||
# disable metal if on Darwin and any other value is explicitly passed.
|
# disable metal if on Darwin and any other value is explicitly passed.
|
||||||
else ifneq ($(BUILD_TYPE),metal)
|
else ifneq ($(BUILD_TYPE),metal)
|
||||||
CMAKE_ARGS+=-DLLAMA_METAL=OFF
|
CMAKE_ARGS+=-DLLAMA_METAL=OFF
|
||||||
|
export LLAMA_NO_ACCELERATE=1
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(BUILD_TYPE),metal)
|
||||||
|
# -lcblas removed: it seems to always be listed as a duplicate flag.
|
||||||
|
CGO_LDFLAGS += -framework Accelerate
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -286,6 +292,11 @@ clean: ## Remove build related file
|
|||||||
$(MAKE) -C backend/cpp/llama clean
|
$(MAKE) -C backend/cpp/llama clean
|
||||||
$(MAKE) dropreplace
|
$(MAKE) dropreplace
|
||||||
|
|
||||||
|
clean-tests:
|
||||||
|
rm -rf test-models
|
||||||
|
rm -rf test-dir
|
||||||
|
rm -rf core/http/backend-assets
|
||||||
|
|
||||||
## Build:
|
## Build:
|
||||||
build: prepare backend-assets grpcs ## Build the project
|
build: prepare backend-assets grpcs ## Build the project
|
||||||
$(info ${GREEN}I local-ai build info:${RESET})
|
$(info ${GREEN}I local-ai build info:${RESET})
|
||||||
@ -305,10 +316,10 @@ osx-signed: build
|
|||||||
run: prepare ## run local-ai
|
run: prepare ## run local-ai
|
||||||
CGO_LDFLAGS="$(CGO_LDFLAGS)" $(GOCMD) run ./
|
CGO_LDFLAGS="$(CGO_LDFLAGS)" $(GOCMD) run ./
|
||||||
|
|
||||||
test-models/testmodel:
|
test-models/testmodel.ggml:
|
||||||
mkdir test-models
|
mkdir test-models
|
||||||
mkdir test-dir
|
mkdir test-dir
|
||||||
wget -q https://huggingface.co/TheBloke/orca_mini_3B-GGML/resolve/main/orca-mini-3b.ggmlv3.q4_0.bin -O test-models/testmodel
|
wget -q https://huggingface.co/TheBloke/orca_mini_3B-GGML/resolve/main/orca-mini-3b.ggmlv3.q4_0.bin -O test-models/testmodel.ggml
|
||||||
wget -q https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-base.en.bin -O test-models/whisper-en
|
wget -q https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-base.en.bin -O test-models/whisper-en
|
||||||
wget -q https://huggingface.co/mudler/all-MiniLM-L6-v2/resolve/main/ggml-model-q4_0.bin -O test-models/bert
|
wget -q https://huggingface.co/mudler/all-MiniLM-L6-v2/resolve/main/ggml-model-q4_0.bin -O test-models/bert
|
||||||
wget -q https://cdn.openai.com/whisper/draft-20220913a/micro-machines.wav -O test-dir/audio.wav
|
wget -q https://cdn.openai.com/whisper/draft-20220913a/micro-machines.wav -O test-dir/audio.wav
|
||||||
@ -320,7 +331,7 @@ prepare-test: grpcs
|
|||||||
cp -rf backend-assets core/http
|
cp -rf backend-assets core/http
|
||||||
cp tests/models_fixtures/* test-models
|
cp tests/models_fixtures/* test-models
|
||||||
|
|
||||||
test: prepare test-models/testmodel grpcs
|
test: prepare test-models/testmodel.ggml grpcs
|
||||||
@echo 'Running tests'
|
@echo 'Running tests'
|
||||||
export GO_TAGS="tts stablediffusion"
|
export GO_TAGS="tts stablediffusion"
|
||||||
$(MAKE) prepare-test
|
$(MAKE) prepare-test
|
||||||
|
@ -19,6 +19,11 @@ else ifeq ($(BUILD_TYPE),clblas)
|
|||||||
else ifeq ($(BUILD_TYPE),hipblas)
|
else ifeq ($(BUILD_TYPE),hipblas)
|
||||||
CMAKE_ARGS+=-DLLAMA_HIPBLAS=ON
|
CMAKE_ARGS+=-DLLAMA_HIPBLAS=ON
|
||||||
# If it's OSX, DO NOT embed the metal library - -DLLAMA_METAL_EMBED_LIBRARY=ON requires further investigation
|
# If it's OSX, DO NOT embed the metal library - -DLLAMA_METAL_EMBED_LIBRARY=ON requires further investigation
|
||||||
|
# But if it's OSX without metal, disable it here
|
||||||
|
else ifeq ($(OS),darwin)
|
||||||
|
ifneq ($(BUILD_TYPE),metal)
|
||||||
|
CMAKE_ARGS+=-DLLAMA_METAL=OFF
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(BUILD_TYPE),sycl_f16)
|
ifeq ($(BUILD_TYPE),sycl_f16)
|
||||||
|
@ -666,15 +666,15 @@ var _ = Describe("API test", func() {
|
|||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(len(models.Models)).To(Equal(6)) // If "config.yaml" should be included, this should be 8?
|
Expect(len(models.Models)).To(Equal(6)) // If "config.yaml" should be included, this should be 8?
|
||||||
})
|
})
|
||||||
It("can generate completions", func() {
|
It("can generate completions via ggml", func() {
|
||||||
resp, err := client.CreateCompletion(context.TODO(), openai.CompletionRequest{Model: "testmodel", Prompt: testPrompt})
|
resp, err := client.CreateCompletion(context.TODO(), openai.CompletionRequest{Model: "testmodel.ggml", Prompt: testPrompt})
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(len(resp.Choices)).To(Equal(1))
|
Expect(len(resp.Choices)).To(Equal(1))
|
||||||
Expect(resp.Choices[0].Text).ToNot(BeEmpty())
|
Expect(resp.Choices[0].Text).ToNot(BeEmpty())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("can generate chat completions ", func() {
|
It("can generate chat completions via ggml", func() {
|
||||||
resp, err := client.CreateChatCompletion(context.TODO(), openai.ChatCompletionRequest{Model: "testmodel", Messages: []openai.ChatCompletionMessage{openai.ChatCompletionMessage{Role: "user", Content: testPrompt}}})
|
resp, err := client.CreateChatCompletion(context.TODO(), openai.ChatCompletionRequest{Model: "testmodel.ggml", Messages: []openai.ChatCompletionMessage{openai.ChatCompletionMessage{Role: "user", Content: testPrompt}}})
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(len(resp.Choices)).To(Equal(1))
|
Expect(len(resp.Choices)).To(Equal(1))
|
||||||
Expect(resp.Choices[0].Message.Content).ToNot(BeEmpty())
|
Expect(resp.Choices[0].Message.Content).ToNot(BeEmpty())
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
- name: list1
|
- name: list1
|
||||||
parameters:
|
parameters:
|
||||||
model: testmodel
|
model: testmodel.ggml
|
||||||
top_p: 80
|
top_p: 80
|
||||||
top_k: 0.9
|
top_k: 0.9
|
||||||
temperature: 0.1
|
temperature: 0.1
|
||||||
@ -19,7 +19,7 @@
|
|||||||
top_p: 80
|
top_p: 80
|
||||||
top_k: 0.9
|
top_k: 0.9
|
||||||
temperature: 0.1
|
temperature: 0.1
|
||||||
model: testmodel
|
model: testmodel.ggml
|
||||||
context_size: 200
|
context_size: 200
|
||||||
stopwords:
|
stopwords:
|
||||||
- "HUMAN:"
|
- "HUMAN:"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: gpt4all
|
name: gpt4all
|
||||||
parameters:
|
parameters:
|
||||||
model: testmodel
|
model: testmodel.ggml
|
||||||
top_p: 80
|
top_p: 80
|
||||||
top_k: 0.9
|
top_k: 0.9
|
||||||
temperature: 0.1
|
temperature: 0.1
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: gpt4all-2
|
name: gpt4all-2
|
||||||
parameters:
|
parameters:
|
||||||
model: testmodel
|
model: testmodel.ggml
|
||||||
top_p: 80
|
top_p: 80
|
||||||
top_k: 0.9
|
top_k: 0.9
|
||||||
temperature: 0.1
|
temperature: 0.1
|
||||||
|
Loading…
Reference in New Issue
Block a user