Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRAFT: Big Refactor [prep for mqtt] #1427

Closed
wants to merge 103 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
e4491bc
rf stage 1: needs merge
dave-gray101 Dec 5, 2023
cfa8833
merge
dave-gray101 Dec 5, 2023
3e464e8
mega refactor: Clean up ongoing circular reference problems, Startup …
dave-gray101 Dec 7, 2023
a48cec0
automatic regen
dave-gray101 Dec 7, 2023
9c1191c
grpc test
dave-gray101 Dec 7, 2023
cecb6f0
stash step
dave-gray101 Dec 10, 2023
a29b112
merge - sketchy
dave-gray101 Dec 10, 2023
3dcc844
manual fix for image
dave-gray101 Dec 10, 2023
d380dec
try a CMake voodoo for protobuf problems?
dave-gray101 Dec 10, 2023
036a4e1
fix
dave-gray101 Dec 10, 2023
88a61f0
make fix
dave-gray101 Dec 10, 2023
77832bf
cmake experiment
dave-gray101 Dec 11, 2023
fbd838d
makefile brace experiments
dave-gray101 Dec 11, 2023
86227a1
force protogen to try and defeat version mismatch
dave-gray101 Dec 12, 2023
fe82a08
try conditionals
dave-gray101 Dec 12, 2023
0455b6b
bump grpc version?
dave-gray101 Dec 12, 2023
0ec0ef9
go mod tidy
dave-gray101 Dec 12, 2023
2c9ac57
messed up the .gitignore, lost the original versions of ./endpoints/l…
dave-gray101 Dec 12, 2023
2f888dc
Merge branch 'master' into rf-config-directory
dave-gray101 Dec 12, 2023
9090eee
minor fix
dave-gray101 Dec 12, 2023
5644538
remove servers folder, it didn't add anything. push pre services fold…
dave-gray101 Dec 12, 2023
04ca560
Merge branch 'master' into rf-config-directory
dave-gray101 Dec 12, 2023
3dd638d
config service belongs in services, add some dev docs about the refactor
dave-gray101 Dec 12, 2023
f9edb3b
Merge branch 'master' into rf-config-directory
dave-gray101 Dec 12, 2023
b280b12
minor docs formatting fixes
dave-gray101 Dec 12, 2023
bea7b28
remove .git from dockerignore as an experiment
dave-gray101 Dec 12, 2023
128523f
experiment: skip .git copy?
dave-gray101 Dec 12, 2023
bb4c90c
attempt to capture version
dave-gray101 Dec 12, 2023
117950b
fix1
dave-gray101 Dec 12, 2023
c65f478
fix3
dave-gray101 Dec 12, 2023
d0396b5
fix4
dave-gray101 Dec 12, 2023
d9a5587
dump path during gRPC build to see where the CI OSX is getting the ol…
dave-gray101 Dec 13, 2023
5616d6b
take 2 path dump
dave-gray101 Dec 13, 2023
ef7af33
Merge branch 'master' into rf-config-directory
dave-gray101 Dec 13, 2023
70fc5cf
-j2 ?
dave-gray101 Dec 13, 2023
829b21f
Merge branch 'rf-config-directory' of ghgray101:/dave-gray101/LocalAI…
dave-gray101 Dec 13, 2023
f3cc043
RAW merge, manual fix in next commit, will not build
dave-gray101 Dec 13, 2023
46c5296
merge api
dave-gray101 Dec 13, 2023
8d8a768
make protogen?
dave-gray101 Dec 13, 2023
6ea4110
protoc
dave-gray101 Dec 14, 2023
4eabd62
seperate?
dave-gray101 Dec 14, 2023
5fb9ba9
add prelim build container script to account for the new --build-arg …
dave-gray101 Dec 14, 2023
31a73ed
yaml tabfix
dave-gray101 Dec 14, 2023
cd49dbc
test/docs fix
dave-gray101 Dec 14, 2023
e645bc0
try j12
dave-gray101 Dec 15, 2023
1fa47c9
cmake test
dave-gray101 Dec 15, 2023
a33e239
test
dave-gray101 Dec 15, 2023
a361895
remove some old experiments, add logs to cmake
dave-gray101 Dec 15, 2023
8d51f7b
Merge branch 'master' into rf-config-directory
dave-gray101 Dec 15, 2023
8a99fe2
RAW merge, won't build
dave-gray101 Dec 16, 2023
2abb82b
merge fix
dave-gray101 Dec 16, 2023
f3795b1
experimental ls
dave-gray101 Dec 16, 2023
b8d6eac
make the ls easier to read
dave-gray101 Dec 16, 2023
d3804c7
swap ls for exit code data next
dave-gray101 Dec 16, 2023
b626adb
tweak
dave-gray101 Dec 17, 2023
e51f192
1
dave-gray101 Dec 17, 2023
a74ff1f
-l and sw_vers
dave-gray101 Dec 17, 2023
22e2b18
try bumping osx runner version, 12 is old
dave-gray101 Dec 17, 2023
0bf16d0
TEMP exit 0 experiment
dave-gray101 Dec 17, 2023
84a5fc0
cleanup
dave-gray101 Dec 17, 2023
1741f0e
adjust osx env
dave-gray101 Dec 17, 2023
4a94f26
fix
dave-gray101 Dec 17, 2023
96423be
()
dave-gray101 Dec 17, 2023
ebf772e
swap path order
dave-gray101 Dec 17, 2023
99d6698
env var test 1
dave-gray101 Dec 17, 2023
f34c066
increase logging for trace purposes
dave-gray101 Dec 17, 2023
0c64eb3
Merge branch 'master' into rf-config-directory
dave-gray101 Dec 17, 2023
a2b75a2
log
dave-gray101 Dec 17, 2023
7eaa240
make changes
dave-gray101 Dec 17, 2023
f41764b
make cmake change
dave-gray101 Dec 17, 2023
3f82e2e
spacing
dave-gray101 Dec 18, 2023
b12d012
-
dave-gray101 Dec 18, 2023
fe50d95
cmake test
dave-gray101 Dec 18, 2023
8f81486
cmake test1
dave-gray101 Dec 18, 2023
eb69c3c
merge?
dave-gray101 Dec 18, 2023
e577b85
start manual merging, not finished, pulling more changes
dave-gray101 Dec 21, 2023
c19246d
Merge branch 'master' into rf-config-directory
dave-gray101 Dec 21, 2023
b7eb950
re-remove api.go
dave-gray101 Dec 23, 2023
bf52a8f
Merge branch 'master' into rf-config-directory
dave-gray101 Dec 23, 2023
39000d0
merge away api endpoints, finally
dave-gray101 Dec 23, 2023
d5065f9
minor grpc++ fix?
dave-gray101 Dec 23, 2023
04ff41a
_GRPC_GRPCPP
dave-gray101 Dec 23, 2023
61296d3
cmake
dave-gray101 Dec 23, 2023
f6a8042
assignment type in Makefile
dave-gray101 Dec 23, 2023
cf35ad5
assignment type in CMake
dave-gray101 Dec 23, 2023
1f7e86e
fix
dave-gray101 Dec 23, 2023
85b7033
ARGS retest
dave-gray101 Dec 23, 2023
a5f305a
Merge branch 'master' into rf-config-directory
dave-gray101 Dec 24, 2023
6f332b9
minor
dave-gray101 Dec 24, 2023
c18f448
merge
dave-gray101 Dec 24, 2023
5f7a902
gmt
dave-gray101 Dec 24, 2023
4a91d68
Merge branch 'master' into rf-config-directory
dave-gray101 Dec 26, 2023
c7ef633
experimental uglify
dave-gray101 Dec 26, 2023
8c846ee
cmake msg
dave-gray101 Dec 26, 2023
59ce7a3
Makefile - adjust _ env stuff
dave-gray101 Dec 26, 2023
5876b74
exp: cmake_print_variables?
dave-gray101 Dec 26, 2023
22318ad
remove ,
dave-gray101 Dec 26, 2023
b1bba52
help find the dump easier
dave-gray101 Dec 26, 2023
56c6bdd
merge
dave-gray101 Dec 26, 2023
dab7810
exp
dave-gray101 Dec 26, 2023
0aac130
Merge branch 'master' into rf-config-directory
dave-gray101 Dec 27, 2023
caca5f5
Update Makefile
dave-gray101 Dec 27, 2023
3758727
Makefile file
dave-gray101 Dec 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/image_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ jobs:
flavor: |
latest=${{ inputs.tag-latest }}
suffix=${{ inputs.tag-suffix }}

- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
Expand All @@ -125,7 +124,11 @@ jobs:
registry: quay.io
username: ${{ secrets.dockerUsername }}
password: ${{ secrets.dockerPassword }}

env:
VERSION: "dev"
- name: Capture $VERSION from git tag
run: |
echo "VERSION=$(git describe --always --tags || echo 'dev')" >> "$GITHUB_ENV"
- name: Build and push
uses: docker/build-push-action@v5
with:
Expand All @@ -136,6 +139,8 @@ jobs:
CUDA_MINOR_VERSION=${{ inputs.cuda-minor-version }}
FFMPEG=${{ inputs.ffmpeg }}
IMAGE_TYPE=${{ inputs.image-type }}
COMMIT_HASH=${{ github.sha }}
VERSION=${{ env.VERSION }}
context: .
file: ./Dockerfile
platforms: ${{ inputs.platforms }}
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
GO_TAGS="stablediffusion tts" make test

tests-apple:
runs-on: macOS-latest
runs-on: macOS-13
strategy:
matrix:
go-version: ['1.21.x']
Expand All @@ -112,11 +112,14 @@ jobs:
# You can test your matrix by printing the current Go version
- name: Display Go version
run: go version
- name: Display OSX version info
run: system_profiler SPSoftwareDataType SPHardwareDataType
- name: Dependencies
run: |
brew install protobuf grpc
- name: Build
run: |
CMAKE_ARGS="-DLLAMA_F16C=OFF -DLLAMA_AVX512=OFF -DLLAMA_AVX2=OFF -DLLAMA_FMA=OFF" make -j12 build
- name: Test
run: |
export C_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
CMAKE_ARGS="-DLLAMA_F16C=OFF -DLLAMA_AVX512=OFF -DLLAMA_AVX2=OFF -DLLAMA_FMA=OFF" make -j12 test
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ LocalAI
local-ai
# prevent above rules from omitting the helm chart
!charts/*
# prevent above rules from omitting the api/localai folder
!api/localai
# prevent above rules from omitting the core/**/localai folder
!core/**/localai

# Ignore models
models/*
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ FROM requirements-${IMAGE_TYPE} as builder
ARG GO_TAGS="stablediffusion tts"
ARG GRPC_BACKENDS
ARG BUILD_GRPC=true
ARG VERSION
ARG COMMIT_HASH
ENV GRPC_BACKENDS=${GRPC_BACKENDS}
ENV GO_TAGS=${GO_TAGS}
ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility
Expand All @@ -88,7 +90,7 @@ ENV NVIDIA_VISIBLE_DEVICES=all
WORKDIR /build

COPY . .
COPY .git .
# COPY .git .
RUN make prepare

# stablediffusion does not tolerate a newer version of abseil, build it first
Expand Down
24 changes: 16 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ TEST_DIR=/tmp/test
RANDOM := $(shell bash -c 'echo $$RANDOM')

VERSION?=$(shell git describe --always --tags || echo "dev" )
COMMIT_HASH?=$(shell git rev-parse HEAD)
# go tool nm ./local-ai | grep Commit
LD_FLAGS?=
override LD_FLAGS += -X "github.com/go-skynet/LocalAI/internal.Version=$(VERSION)"
override LD_FLAGS += -X "github.com/go-skynet/LocalAI/internal.Commit=$(shell git rev-parse HEAD)"
override LD_FLAGS += -X "github.com/go-skynet/LocalAI/internal.Commit=$(COMMIT_HASH)"

OPTIONAL_TARGETS?=

Expand All @@ -73,7 +74,11 @@ UNAME_S := $(shell uname -s)
endif

ifeq ($(OS),Darwin)
export BUILD_GRPC_FOR_BACKEND_LLAMA=true
export C_INCLUDE_PATH +=/opt/homebrew/include:/usr/local/include
export CPLUS_INCLUDE_PATH +=/opt/homebrew/include:/usr/local/include
CGO_LDFLAGS += -lcblas -framework Accelerate

ifeq ($(OSX_SIGNING_IDENTITY),)
OSX_SIGNING_IDENTITY := $(shell security find-identity -v -p codesigning | grep '"' | head -n 1 | sed -E 's/.*"(.*)"/\1/')
endif
Expand All @@ -85,6 +90,7 @@ ifeq ($(OS),Darwin)
else ifneq ($(BUILD_TYPE),metal)
CMAKE_ARGS+=-DLLAMA_METAL=OFF
endif

endif

ifeq ($(BUILD_TYPE),openblas)
Expand Down Expand Up @@ -467,19 +473,21 @@ ADDED_CMAKE_ARGS=-Dabsl_DIR=${INSTALLED_LIB_CMAKE}/absl \

backend/cpp/llama/grpc-server:
ifdef BUILD_GRPC_FOR_BACKEND_LLAMA
@echo "=== Building gRPC for llama backend... ==="
backend/cpp/grpc/script/build_grpc.sh ${INSTALLED_PACKAGES}
export _PROTOBUF_PROTOC=${INSTALLED_PACKAGES}/bin/proto && \
export _GRPC_CPP_PLUGIN_EXECUTABLE=${INSTALLED_PACKAGES}/bin/grpc_cpp_plugin && \
export PATH=${PATH}:${INSTALLED_PACKAGES}/bin && \
CMAKE_ARGS="${CMAKE_ARGS} ${ADDED_CMAKE_ARGS}" LLAMA_VERSION=$(CPPLLAMA_VERSION) $(MAKE) -C backend/cpp/llama grpc-server
@echo "=== gRPC Built! making backend/cpp/llama/grpc-server! ==="
PATH=${INSTALLED_PACKAGES}/bin:${PATH} \
CMAKE_ARGS="${CMAKE_ARGS} ${ADDED_CMAKE_ARGS} -D_PROTOBUF_PROTOC='${INSTALLED_PACKAGES}/bin/protoc' -D_GRPC_CPP_PLUGIN_EXECUTABLE='${INSTALLED_PACKAGES}/bin/grpc_cpp_plugin'" LLAMA_VERSION=$(CPPLLAMA_VERSION) $(MAKE) -C backend/cpp/llama grpc-server
else
echo "BUILD_GRPC_FOR_BACKEND_LLAMA is not defined."
LLAMA_VERSION=$(CPPLLAMA_VERSION) $(MAKE) -C backend/cpp/llama grpc-server
@echo "BUILD_GRPC_FOR_BACKEND_LLAMA is not defined, making backend/cpp/llama grpc-server"
LLAMA_VERSION=$(CPPLLAMA_VERSION) $(MAKE) -C backend/cpp/llama grpc-server
endif

## BACKEND CPP LLAMA END

##
backend-assets/grpc/llama-cpp: backend-assets/grpc backend/cpp/llama/grpc-server
@echo "=== backend-assets/grpc/llama-cpp ==="
cp -rfv backend/cpp/llama/grpc-server backend-assets/grpc/llama-cpp
# TODO: every binary should have its own folder instead, so can have different metal implementations
ifeq ($(BUILD_TYPE),metal)
Expand Down
Loading
Loading