Skip to content

Commit 7127029

Browse files
authored
Merge branch 'master' into feat-hf-api-scan
2 parents 700c631 + 8d046de commit 7127029

File tree

11 files changed

+61
-37
lines changed

11 files changed

+61
-37
lines changed

.github/workflows/image-pr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
makeflags: "--jobs=3 --output-sync=target"
4747
- build-type: 'cublas'
4848
cuda-major-version: "12"
49-
cuda-minor-version: "5"
49+
cuda-minor-version: "4"
5050
platforms: 'linux/amd64'
5151
tag-latest: 'false'
5252
tag-suffix: '-cublas-cuda12-ffmpeg'
@@ -119,7 +119,7 @@ jobs:
119119
makeflags: "--jobs=3 --output-sync=target"
120120
- build-type: 'cublas'
121121
cuda-major-version: "12"
122-
cuda-minor-version: "5"
122+
cuda-minor-version: "4"
123123
platforms: 'linux/amd64'
124124
tag-latest: 'false'
125125
tag-suffix: '-cublas-cuda12-ffmpeg-core'

.github/workflows/image.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
makeflags: "--jobs=3 --output-sync=target"
6565
- build-type: 'cublas'
6666
cuda-major-version: "11"
67-
cuda-minor-version: "8"
67+
cuda-minor-version: "7"
6868
platforms: 'linux/amd64'
6969
tag-latest: 'false'
7070
tag-suffix: '-cublas-cuda11'
@@ -75,7 +75,7 @@ jobs:
7575
makeflags: "--jobs=3 --output-sync=target"
7676
- build-type: 'cublas'
7777
cuda-major-version: "12"
78-
cuda-minor-version: "5"
78+
cuda-minor-version: "4"
7979
platforms: 'linux/amd64'
8080
tag-latest: 'false'
8181
tag-suffix: '-cublas-cuda12'
@@ -86,7 +86,7 @@ jobs:
8686
makeflags: "--jobs=3 --output-sync=target"
8787
- build-type: 'cublas'
8888
cuda-major-version: "11"
89-
cuda-minor-version: "8"
89+
cuda-minor-version: "7"
9090
platforms: 'linux/amd64'
9191
tag-latest: 'auto'
9292
tag-suffix: '-cublas-cuda11-ffmpeg'
@@ -100,7 +100,7 @@ jobs:
100100
makeflags: "--jobs=3 --output-sync=target"
101101
- build-type: 'cublas'
102102
cuda-major-version: "12"
103-
cuda-minor-version: "5"
103+
cuda-minor-version: "4"
104104
platforms: 'linux/amd64'
105105
tag-latest: 'auto'
106106
tag-suffix: '-cublas-cuda12-ffmpeg'
@@ -274,7 +274,7 @@ jobs:
274274
makeflags: "--jobs=4 --output-sync=target"
275275
- build-type: 'cublas'
276276
cuda-major-version: "11"
277-
cuda-minor-version: "8"
277+
cuda-minor-version: "7"
278278
platforms: 'linux/amd64'
279279
tag-latest: 'false'
280280
tag-suffix: '-cublas-cuda11-core'
@@ -285,7 +285,7 @@ jobs:
285285
makeflags: "--jobs=4 --output-sync=target"
286286
- build-type: 'cublas'
287287
cuda-major-version: "12"
288-
cuda-minor-version: "5"
288+
cuda-minor-version: "4"
289289
platforms: 'linux/amd64'
290290
tag-latest: 'false'
291291
tag-suffix: '-cublas-cuda12-core'
@@ -296,7 +296,7 @@ jobs:
296296
makeflags: "--jobs=4 --output-sync=target"
297297
- build-type: 'cublas'
298298
cuda-major-version: "11"
299-
cuda-minor-version: "8"
299+
cuda-minor-version: "7"
300300
platforms: 'linux/amd64'
301301
tag-latest: 'false'
302302
tag-suffix: '-cublas-cuda11-ffmpeg-core'
@@ -307,7 +307,7 @@ jobs:
307307
makeflags: "--jobs=4 --output-sync=target"
308308
- build-type: 'cublas'
309309
cuda-major-version: "12"
310-
cuda-minor-version: "5"
310+
cuda-minor-version: "4"
311311
platforms: 'linux/amd64'
312312
tag-latest: 'false'
313313
tag-suffix: '-cublas-cuda12-ffmpeg-core'

.github/workflows/image_build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ on:
2323
type: string
2424
cuda-minor-version:
2525
description: 'CUDA minor version'
26-
default: "5"
26+
default: "4"
2727
type: string
2828
platforms:
2929
description: 'Platforms'

.github/workflows/release.yaml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
sudo apt-get update
4141
sudo apt-get install -y cuda-cross-aarch64 cuda-nvcc-cross-aarch64-${CUDA_VERSION} libcublas-cross-aarch64-${CUDA_VERSION}
4242
env:
43-
CUDA_VERSION: 12-5
43+
CUDA_VERSION: 12-4
4444
- name: Cache grpc
4545
id: cache-grpc
4646
uses: actions/cache@v4
@@ -78,15 +78,6 @@ jobs:
7878
echo "set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)" >> $CMAKE_CROSS_TOOLCHAIN
7979
GRPC_DIR=$PWD/grpc
8080
81-
# http://google.github.io/googletest/quickstart-cmake.html
82-
# Seems otherwise cross-arch fails to find it
83-
echo "include(FetchContent)" >> $GRPC_DIR/CMakeLists.txt
84-
echo "FetchContent_Declare(" >> $GRPC_DIR/CMakeLists.txt
85-
echo " googletest" >> $GRPC_DIR/CMakeLists.txt
86-
echo " URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip" >> $GRPC_DIR/CMakeLists.txt
87-
echo ")" >> $GRPC_DIR/CMakeLists.txt
88-
echo "FetchContent_MakeAvailable(googletest)" >> $GRPC_DIR/CMakeLists.txt
89-
9081
cd grpc && cd cmake/build && sudo make --jobs 5 --output-sync=target install && \
9182
GRPC_CROSS_BUILD_DIR=$GRPC_DIR/cmake/cross_build && \
9283
mkdir -p $GRPC_CROSS_BUILD_DIR && \

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ FROM requirements-${IMAGE_TYPE} AS requirements-drivers
9999

100100
ARG BUILD_TYPE
101101
ARG CUDA_MAJOR_VERSION=12
102-
ARG CUDA_MINOR_VERSION=5
102+
ARG CUDA_MINOR_VERSION=4
103103

104104
ENV BUILD_TYPE=${BUILD_TYPE}
105105

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ prepare-e2e:
425425
mkdir -p $(TEST_DIR)
426426
cp -rfv $(abspath ./tests/e2e-fixtures)/gpu.yaml $(TEST_DIR)/gpu.yaml
427427
test -e $(TEST_DIR)/ggllm-test-model.bin || wget -q https://huggingface.co/TheBloke/CodeLlama-7B-Instruct-GGUF/resolve/main/codellama-7b-instruct.Q2_K.gguf -O $(TEST_DIR)/ggllm-test-model.bin
428-
docker build --build-arg GRPC_BACKENDS="$(GRPC_BACKENDS)" --build-arg IMAGE_TYPE=core --build-arg BUILD_TYPE=$(BUILD_TYPE) --build-arg CUDA_MAJOR_VERSION=12 --build-arg CUDA_MINOR_VERSION=5 --build-arg FFMPEG=true -t localai-tests .
428+
docker build --build-arg GRPC_BACKENDS="$(GRPC_BACKENDS)" --build-arg IMAGE_TYPE=core --build-arg BUILD_TYPE=$(BUILD_TYPE) --build-arg CUDA_MAJOR_VERSION=12 --build-arg CUDA_MINOR_VERSION=4 --build-arg FFMPEG=true -t localai-tests .
429429

430430
run-e2e-image:
431431
ls -liah $(abspath ./tests/e2e-fixtures)
@@ -701,6 +701,7 @@ backend/cpp/llama/llama.cpp:
701701
INSTALLED_PACKAGES=$(CURDIR)/backend/cpp/grpc/installed_packages
702702
INSTALLED_LIB_CMAKE=$(INSTALLED_PACKAGES)/lib/cmake
703703
ADDED_CMAKE_ARGS=-Dabsl_DIR=${INSTALLED_LIB_CMAKE}/absl \
704+
-DABSL_BUILD_TESTING=OFF \
704705
-DProtobuf_DIR=${INSTALLED_LIB_CMAKE}/protobuf \
705706
-Dutf8_range_DIR=${INSTALLED_LIB_CMAKE}/utf8_range \
706707
-DgRPC_DIR=${INSTALLED_LIB_CMAKE}/grpc \

core/http/endpoints/openai/files.go

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,10 @@ func getFileFromRequest(c *fiber.Ctx) (*File, error) {
123123
return nil, fmt.Errorf("unable to find file id %s", id)
124124
}
125125

126-
// GetFilesEndpoint https://platform.openai.com/docs/api-reference/files/retrieve
126+
// GetFilesEndpoint is the OpenAI API endpoint to get files https://platform.openai.com/docs/api-reference/files/retrieve
127+
// @Summary Returns information about a specific file.
128+
// @Success 200 {object} File "Response"
129+
// @Router /v1/files/{file_id} [get]
127130
func GetFilesEndpoint(cm *config.BackendConfigLoader, appConfig *config.ApplicationConfig) func(c *fiber.Ctx) error {
128131
return func(c *fiber.Ctx) error {
129132
file, err := getFileFromRequest(c)
@@ -135,13 +138,17 @@ func GetFilesEndpoint(cm *config.BackendConfigLoader, appConfig *config.Applicat
135138
}
136139
}
137140

138-
// DeleteFilesEndpoint https://platform.openai.com/docs/api-reference/files/delete
141+
type DeleteStatus struct {
142+
Id string
143+
Object string
144+
Deleted bool
145+
}
146+
147+
// DeleteFilesEndpoint is the OpenAI API endpoint to delete files https://platform.openai.com/docs/api-reference/files/delete
148+
// @Summary Delete a file.
149+
// @Success 200 {object} DeleteStatus "Response"
150+
// @Router /v1/files/{file_id} [delete]
139151
func DeleteFilesEndpoint(cm *config.BackendConfigLoader, appConfig *config.ApplicationConfig) func(c *fiber.Ctx) error {
140-
type DeleteStatus struct {
141-
Id string
142-
Object string
143-
Deleted bool
144-
}
145152

146153
return func(c *fiber.Ctx) error {
147154
file, err := getFileFromRequest(c)
@@ -174,7 +181,11 @@ func DeleteFilesEndpoint(cm *config.BackendConfigLoader, appConfig *config.Appli
174181
}
175182
}
176183

177-
// GetFilesContentsEndpoint https://platform.openai.com/docs/api-reference/files/retrieve-contents
184+
// GetFilesContentsEndpoint is the OpenAI API endpoint to get files content https://platform.openai.com/docs/api-reference/files/retrieve-contents
185+
// @Summary Returns information about a specific file.
186+
// @Success 200 {string} binary "file"
187+
// @Router /v1/files/{file_id}/content [get]
188+
// GetFilesContentsEndpoint
178189
func GetFilesContentsEndpoint(cm *config.BackendConfigLoader, appConfig *config.ApplicationConfig) func(c *fiber.Ctx) error {
179190
return func(c *fiber.Ctx) error {
180191
file, err := getFileFromRequest(c)

core/http/endpoints/openai/list.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import (
66
"github.com/mudler/LocalAI/core/services"
77
)
88

9+
// ListModelsEndpoint is the OpenAI Models API endpoint https://platform.openai.com/docs/api-reference/models
10+
// @Summary List and describe the various models available in the API.
11+
// @Success 200 {object} schema.ModelsDataResponse "Response"
12+
// @Router /v1/models [get]
913
func ListModelsEndpoint(lms *services.ListModelsService) func(ctx *fiber.Ctx) error {
1014
return func(c *fiber.Ctx) error {
1115
// If blank, no filter is applied.
@@ -18,10 +22,7 @@ func ListModelsEndpoint(lms *services.ListModelsService) func(ctx *fiber.Ctx) er
1822
if err != nil {
1923
return err
2024
}
21-
return c.JSON(struct {
22-
Object string `json:"object"`
23-
Data []schema.OpenAIModel `json:"data"`
24-
}{
25+
return c.JSON(schema.ModelsDataResponse{
2526
Object: "list",
2627
Data: dataModels,
2728
})

core/p2p/p2p.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,11 +348,15 @@ func newNodeOpts(token string) ([]node.Option, error) {
348348
llger := logger.New(log.LevelFatal)
349349
defaultInterval := 10 * time.Second
350350

351+
// TODO: move this up, expose more config options when creating a node
352+
noDHT := os.Getenv("LOCALAI_P2P_DISABLE_DHT") == "true"
353+
noLimits := os.Getenv("LOCALAI_P2P_DISABLE_LIMITS") == "true"
354+
351355
loglevel := "info"
352356

353357
c := config.Config{
354358
Limit: config.ResourceLimit{
355-
Enable: true,
359+
Enable: !noLimits,
356360
MaxConns: 100,
357361
},
358362
NetworkToken: token,
@@ -372,7 +376,7 @@ func newNodeOpts(token string) ([]node.Option, error) {
372376
RateLimitInterval: defaultInterval,
373377
},
374378
Discovery: config.Discovery{
375-
DHT: true,
379+
DHT: noDHT,
376380
MDNS: true,
377381
Interval: 30 * time.Second,
378382
},

core/schema/openai.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,8 @@ type OpenAIRequest struct {
155155
// AutoGPTQ
156156
ModelBaseName string `json:"model_base_name" yaml:"model_base_name"`
157157
}
158+
159+
type ModelsDataResponse struct {
160+
Object string `json:"object"`
161+
Data []OpenAIModel `json:"data"`
162+
}

0 commit comments

Comments
 (0)