Skip to content

Commit 8a05e34

Browse files
authored
Merge branch 'master' into fix-2638
2 parents 2007bc0 + a0163da commit 8a05e34

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+235
-171
lines changed

.github/workflows/image-pr.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,12 @@ jobs:
128128
runs-on: 'ubuntu-latest'
129129
base-image: "ubuntu:22.04"
130130
makeflags: "--jobs=4 --output-sync=target"
131+
- build-type: 'vulkan'
132+
platforms: 'linux/amd64'
133+
tag-latest: 'false'
134+
tag-suffix: '-vulkan-ffmpeg-core'
135+
ffmpeg: 'true'
136+
image-type: 'core'
137+
runs-on: 'ubuntu-latest'
138+
base-image: "ubuntu:22.04"
139+
makeflags: "--jobs=4 --output-sync=target"

.github/workflows/image.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
strategy:
4040
# Pushing with all jobs in parallel
4141
# eats the bandwidth of all the nodes
42-
# max-parallel: ${{ github.event_name != 'pull_request' && 4 || 8 }}
42+
max-parallel: ${{ github.event_name != 'pull_request' && 6 || 12 }}
4343
matrix:
4444
include:
4545
# Extra images
@@ -315,3 +315,12 @@ jobs:
315315
runs-on: 'arc-runner-set'
316316
base-image: "ubuntu:22.04"
317317
makeflags: "--jobs=4 --output-sync=target"
318+
- build-type: 'vulkan'
319+
platforms: 'linux/amd64,linux/arm64'
320+
tag-latest: 'false'
321+
tag-suffix: '-vulkan-ffmpeg-core'
322+
ffmpeg: 'true'
323+
image-type: 'core'
324+
runs-on: 'arc-runner-set'
325+
base-image: "ubuntu:22.04"
326+
makeflags: "--jobs=4 --output-sync=target"

Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,22 @@ ARG CUDA_MINOR_VERSION=5
103103

104104
ENV BUILD_TYPE=${BUILD_TYPE}
105105

106+
# Vulkan requirements
107+
RUN <<EOT bash
108+
if [ "${BUILD_TYPE}" = "vulkan" ]; then
109+
apt-get update && \
110+
apt-get install -y --no-install-recommends \
111+
software-properties-common pciutils wget gpg-agent && \
112+
wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | apt-key add - && \
113+
wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list https://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list && \
114+
apt-get update && \
115+
apt-get install -y \
116+
vulkan-sdk && \
117+
apt-get clean && \
118+
rm -rf /var/lib/apt/lists/*
119+
fi
120+
EOT
121+
106122
# CuBLAS requirements
107123
RUN <<EOT bash
108124
if [ "${BUILD_TYPE}" = "cublas" ]; then

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ BINARY_NAME=local-ai
55

66
# llama.cpp versions
77
GOLLAMA_STABLE_VERSION?=2b57a8ae43e4699d3dc5d1496a1ccd42922993be
8-
CPPLLAMA_VERSION?=557b653dc9ed91e8c313e87500e0050c775f81b6
8+
CPPLLAMA_VERSION?=e112b610a1a75cb7fa8351e1a933e2e7a755a5ce
99

1010
# gpt4all version
1111
GPT4ALL_REPO?=https://github.com/nomic-ai/gpt4all
@@ -103,6 +103,10 @@ ifeq ($(BUILD_TYPE),cublas)
103103
CGO_LDFLAGS_WHISPER+=-L$(CUDA_LIBPATH)/stubs/ -lcuda -lcufft
104104
endif
105105

106+
ifeq ($(BUILD_TYPE),vulkan)
107+
CMAKE_ARGS+=-DLLAMA_VULKAN=1
108+
endif
109+
106110
ifeq ($(BUILD_TYPE),hipblas)
107111
ROCM_HOME ?= /opt/rocm
108112
ROCM_PATH ?= /opt/rocm

backend/backend.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ message TranscriptRequest {
230230
string dst = 2;
231231
string language = 3;
232232
uint32 threads = 4;
233+
bool translate = 5;
233234
}
234235

235236
message TranscriptResult {

backend/go/llm/rwkv/rwkv.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func (llm *LLM) Load(opts *pb.ModelOptions) error {
3131
model := rwkv.LoadFiles(opts.ModelFile, tokenizerPath, uint32(opts.GetThreads()))
3232

3333
if model == nil {
34-
return fmt.Errorf("could not load model")
34+
return fmt.Errorf("rwkv could not load model")
3535
}
3636
llm.rwkv = model
3737
return nil

backend/go/transcribe/transcript.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func audioToWav(src, dst string) error {
2929
return nil
3030
}
3131

32-
func Transcript(model whisper.Model, audiopath, language string, threads uint) (schema.TranscriptionResult, error) {
32+
func Transcript(model whisper.Model, audiopath, language string, translate bool, threads uint) (schema.TranscriptionResult, error) {
3333
res := schema.TranscriptionResult{}
3434

3535
dir, err := os.MkdirTemp("", "whisper")
@@ -75,6 +75,10 @@ func Transcript(model whisper.Model, audiopath, language string, threads uint) (
7575
context.SetLanguage("auto")
7676
}
7777

78+
if translate {
79+
context.SetTranslate(true)
80+
}
81+
7882
if err := context.Process(data, nil, nil); err != nil {
7983
return res, err
8084
}

backend/go/transcribe/whisper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ func (sd *Whisper) Load(opts *pb.ModelOptions) error {
2222
}
2323

2424
func (sd *Whisper) AudioTranscription(opts *pb.TranscriptRequest) (schema.TranscriptionResult, error) {
25-
return Transcript(sd.whisper, opts.Dst, opts.Language, uint(opts.Threads))
25+
return Transcript(sd.whisper, opts.Dst, opts.Language, opts.Translate, uint(opts.Threads))
2626
}

core/backend/llm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"github.com/mudler/LocalAI/core/config"
1313
"github.com/mudler/LocalAI/core/schema"
1414

15-
"github.com/mudler/LocalAI/pkg/gallery"
15+
"github.com/mudler/LocalAI/core/gallery"
1616
"github.com/mudler/LocalAI/pkg/grpc"
1717
"github.com/mudler/LocalAI/pkg/grpc/proto"
1818
model "github.com/mudler/LocalAI/pkg/model"

core/backend/transcript.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
model "github.com/mudler/LocalAI/pkg/model"
1212
)
1313

14-
func ModelTranscription(audio, language string, ml *model.ModelLoader, backendConfig config.BackendConfig, appConfig *config.ApplicationConfig) (*schema.TranscriptionResult, error) {
14+
func ModelTranscription(audio, language string, translate bool, ml *model.ModelLoader, backendConfig config.BackendConfig, appConfig *config.ApplicationConfig) (*schema.TranscriptionResult, error) {
1515

1616
opts := modelOpts(backendConfig, appConfig, []model.Option{
1717
model.WithBackendString(model.WhisperBackend),
@@ -31,8 +31,9 @@ func ModelTranscription(audio, language string, ml *model.ModelLoader, backendCo
3131
}
3232

3333
return whisperModel.AudioTranscription(context.Background(), &proto.TranscriptRequest{
34-
Dst: audio,
35-
Language: language,
36-
Threads: uint32(*backendConfig.Threads),
34+
Dst: audio,
35+
Language: language,
36+
Translate: translate,
37+
Threads: uint32(*backendConfig.Threads),
3738
})
3839
}

0 commit comments

Comments
 (0)