Skip to content

Commit 688f150

Browse files
authored
fix: symlink libphonemize in the container (#831)
2 parents dde12b4 + 00ccb8d commit 688f150

File tree

4 files changed

+35
-16
lines changed

4 files changed

+35
-16
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ jobs:
4343
mkdir -p "lib/Linux-$(uname -m)/piper_phonemize" && \
4444
curl -L "https://github.com/rhasspy/piper-phonemize/releases/download/v1.0.0/libpiper_phonemize-amd64.tar.gz" | \
4545
tar -C "lib/Linux-$(uname -m)/piper_phonemize" -xzvf - && ls -liah /build/lib/Linux-$(uname -m)/piper_phonemize/ && \
46-
sudo cp -rfv /build/lib/Linux-$(uname -m)/piper_phonemize/lib/. /lib64/ && \
4746
sudo cp -rfv /build/lib/Linux-$(uname -m)/piper_phonemize/lib/. /usr/lib/ && \
47+
sudo ln -s /usr/lib/libpiper_phonemize.so /usr/lib/libpiper_phonemize.so.1 && \
4848
sudo cp -rfv /build/lib/Linux-$(uname -m)/piper_phonemize/include/. /usr/include/
4949
- name: Test
5050
run: |

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ RUN curl -L "https://github.com/gabime/spdlog/archive/refs/tags/v${SPDLOG_VERSIO
6363
mkdir -p "lib/Linux-$(uname -m)/piper_phonemize" && \
6464
curl -L "https://github.com/rhasspy/piper-phonemize/releases/download/v${PIPER_PHONEMIZE_VERSION}/libpiper_phonemize-${TARGETARCH:-$(go env GOARCH)}${TARGETVARIANT}.tar.gz" | \
6565
tar -C "lib/Linux-$(uname -m)/piper_phonemize" -xzvf - && ls -liah /build/lib/Linux-$(uname -m)/piper_phonemize/ && \
66-
cp -rfv /build/lib/Linux-$(uname -m)/piper_phonemize/lib/. /lib64/ && \
6766
cp -rfv /build/lib/Linux-$(uname -m)/piper_phonemize/lib/. /usr/lib/ && \
67+
ln -s /usr/lib/libpiper_phonemize.so /usr/lib/libpiper_phonemize.so.1 && \
6868
cp -rfv /build/lib/Linux-$(uname -m)/piper_phonemize/include/. /usr/include/
6969
# \
7070
# ; fi

api/api_test.go

+9-10
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ import (
3030
)
3131

3232
type modelApplyRequest struct {
33-
ID string `json:"id"`
34-
URL string `json:"url"`
35-
Name string `json:"name"`
36-
Overrides map[string]string `json:"overrides"`
33+
ID string `json:"id"`
34+
URL string `json:"url"`
35+
Name string `json:"name"`
36+
Overrides map[string]interface{} `json:"overrides"`
3737
}
3838

3939
func getModelStatus(url string) (response map[string]interface{}) {
@@ -243,7 +243,7 @@ var _ = Describe("API test", func() {
243243
response := postModelApplyRequest("http://127.0.0.1:9090/models/apply", modelApplyRequest{
244244
URL: "https://raw.githubusercontent.com/go-skynet/model-gallery/main/bert-embeddings.yaml",
245245
Name: "bert",
246-
Overrides: map[string]string{
246+
Overrides: map[string]interface{}{
247247
"backend": "llama",
248248
},
249249
})
@@ -269,7 +269,7 @@ var _ = Describe("API test", func() {
269269
response := postModelApplyRequest("http://127.0.0.1:9090/models/apply", modelApplyRequest{
270270
URL: "https://raw.githubusercontent.com/go-skynet/model-gallery/main/bert-embeddings.yaml",
271271
Name: "bert",
272-
Overrides: map[string]string{},
272+
Overrides: map[string]interface{}{},
273273
})
274274

275275
Expect(response["uuid"]).ToNot(BeEmpty(), fmt.Sprint(response))
@@ -297,7 +297,7 @@ var _ = Describe("API test", func() {
297297
response := postModelApplyRequest("http://127.0.0.1:9090/models/apply", modelApplyRequest{
298298
URL: "github:go-skynet/model-gallery/openllama_3b.yaml",
299299
Name: "openllama_3b",
300-
Overrides: map[string]string{"backend": "llama"},
300+
Overrides: map[string]interface{}{"backend": "llama", "mmap": true, "f16": true, "context_size": 128},
301301
})
302302

303303
Expect(response["uuid"]).ToNot(BeEmpty(), fmt.Sprint(response))
@@ -366,9 +366,8 @@ var _ = Describe("API test", func() {
366366
}
367367

368368
response := postModelApplyRequest("http://127.0.0.1:9090/models/apply", modelApplyRequest{
369-
URL: "github:go-skynet/model-gallery/gpt4all-j.yaml",
370-
Name: "gpt4all-j",
371-
Overrides: map[string]string{},
369+
URL: "github:go-skynet/model-gallery/gpt4all-j.yaml",
370+
Name: "gpt4all-j",
372371
})
373372

374373
Expect(response["uuid"]).ToNot(BeEmpty(), fmt.Sprint(response))

pkg/grpc/llm/llama/llama.go

+24-4
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,20 @@ type LLM struct {
1717
}
1818

1919
func (llm *LLM) Load(opts *pb.ModelOptions) error {
20+
21+
ropeFreqBase := float32(10000)
22+
ropeFreqScale := float32(1)
23+
24+
if opts.RopeFreqBase != 0 {
25+
ropeFreqBase = opts.RopeFreqBase
26+
}
27+
if opts.RopeFreqScale != 0 {
28+
ropeFreqScale = opts.RopeFreqScale
29+
}
30+
2031
llamaOpts := []llama.ModelOption{
21-
llama.WithRopeFreqBase(opts.RopeFreqBase),
22-
llama.WithRopeFreqScale(opts.RopeFreqScale),
32+
llama.WithRopeFreqBase(ropeFreqBase),
33+
llama.WithRopeFreqScale(ropeFreqScale),
2334
}
2435

2536
if opts.ContextSize != 0 {
@@ -58,15 +69,24 @@ func (llm *LLM) Load(opts *pb.ModelOptions) error {
5869
}
5970

6071
func buildPredictOptions(opts *pb.PredictOptions) []llama.PredictOption {
72+
ropeFreqBase := float32(10000)
73+
ropeFreqScale := float32(1)
74+
75+
if opts.RopeFreqBase != 0 {
76+
ropeFreqBase = opts.RopeFreqBase
77+
}
78+
if opts.RopeFreqScale != 0 {
79+
ropeFreqScale = opts.RopeFreqScale
80+
}
6181
predictOptions := []llama.PredictOption{
6282
llama.SetTemperature(opts.Temperature),
6383
llama.SetTopP(opts.TopP),
6484
llama.SetTopK(int(opts.TopK)),
6585
llama.SetTokens(int(opts.Tokens)),
6686
llama.SetThreads(int(opts.Threads)),
6787
llama.WithGrammar(opts.Grammar),
68-
llama.SetRopeFreqBase(opts.RopeFreqBase),
69-
llama.SetRopeFreqScale(opts.RopeFreqScale),
88+
llama.SetRopeFreqBase(ropeFreqBase),
89+
llama.SetRopeFreqScale(ropeFreqScale),
7090
llama.SetNegativePromptScale(opts.NegativePromptScale),
7191
llama.SetNegativePrompt(opts.NegativePrompt),
7292
}

0 commit comments

Comments
 (0)