Skip to content

Commit

Permalink
Merge branch 'master' into test-authv2
Browse files Browse the repository at this point in the history
  • Loading branch information
mudler authored Sep 17, 2024
2 parents c8d9d3c + eee1fb2 commit e04ad74
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 24 deletions.
2 changes: 1 addition & 1 deletion backend/python/openvoice/requirements-intel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ unidecode==1.3.7
whisper-timestamped==1.15.4
openai
python-dotenv
pypinyin==0.50.0
pypinyin==0.53.0
cn2an==0.5.22
jieba==0.42.1
gradio==4.38.1
Expand Down
2 changes: 1 addition & 1 deletion backend/python/sentencetransformers/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def LoadModel(self, request, context):
"""
model_name = request.Model
try:
self.model = SentenceTransformer(model_name)
self.model = SentenceTransformer(model_name, trust_remote_code=request.TrustRemoteCode)
except Exception as err:
return backend_pb2.Result(success=False, message=f"Unexpected {err=}, {type(err)=}")

Expand Down
4 changes: 3 additions & 1 deletion backend/python/sentencetransformers/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
grpcio==1.66.1
protobuf
certifi
certifi
datasets
einops
2 changes: 1 addition & 1 deletion backend/python/transformers/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
grpcio==1.66.1
protobuf
certifi
setuptools==75.1.0 # https://github.com/mudler/LocalAI/issues/2406
setuptools==69.5.1 # https://github.com/mudler/LocalAI/issues/2406
2 changes: 1 addition & 1 deletion examples/functions/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
langchain==0.3.0
openai==1.44.0
openai==1.45.1
2 changes: 1 addition & 1 deletion examples/langchain-chroma/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
langchain==0.2.16
langchain==0.3.0
openai==1.45.1
chromadb==0.5.5
llama-index==0.11.7
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ debugpy==1.8.2
frozenlist==1.4.1
greenlet==3.1.0
idna==3.8
langchain==0.2.16
langchain==0.3.0
langchain-community==0.2.16
marshmallow==3.22.0
marshmallow-enum==1.5.1
multidict==6.0.5
mypy-extensions==1.0.0
numexpr==2.10.1
numpy==2.1.1
openai==1.44.0
openai==1.45.1
openapi-schema-pydantic==1.2.4
packaging>=23.2
pydantic==2.8.2
Expand Down
2 changes: 1 addition & 1 deletion gallery/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1281,7 +1281,7 @@
- !!merge <<: *mistral03
name: "mn-12b-lyra-v4-iq-imatrix"
icon: https://cdn-uploads.huggingface.co/production/uploads/65d4cf2693a0a3744a27536c/dVoru83WOpwVjMlgZ_xhA.png
#chatml
# chatml
url: "github:mudler/LocalAI/gallery/chatml.yaml@master"
urls:
- https://huggingface.co/Lewdiculous/MN-12B-Lyra-v4-GGUF-IQ-Imatrix
Expand Down
24 changes: 17 additions & 7 deletions pkg/model/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ var knownModelsNameSuffixToSkip []string = []string{
".tar.gz",
}

const retryTimeout = time.Duration(2 * time.Minute)

func (ml *ModelLoader) ListFilesInModelPath() ([]string, error) {
files, err := os.ReadDir(ml.ModelPath)
if err != nil {
Expand Down Expand Up @@ -146,15 +148,23 @@ func (ml *ModelLoader) ShutdownModel(modelName string) error {
ml.mu.Lock()
defer ml.mu.Unlock()

return ml.stopModel(modelName)
}

func (ml *ModelLoader) stopModel(modelName string) error {
defer ml.deleteProcess(modelName)
if _, ok := ml.models[modelName]; !ok {
_, ok := ml.models[modelName]
if !ok {
return fmt.Errorf("model %s not found", modelName)
}
return nil

retries := 1
for ml.models[modelName].GRPC(false, ml.wd).IsBusy() {
log.Debug().Msgf("%s busy. Waiting.", modelName)
dur := time.Duration(retries*2) * time.Second
if dur > retryTimeout {
dur = retryTimeout
}
time.Sleep(dur)
retries++
}

return ml.deleteProcess(modelName)
}

func (ml *ModelLoader) CheckIsLoaded(s string) *Model {
Expand Down
17 changes: 9 additions & 8 deletions pkg/model/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@ import (

func (ml *ModelLoader) StopAllExcept(s string) error {
return ml.StopGRPC(func(id string, p *process.Process) bool {
if id != s {
for ml.models[id].GRPC(false, ml.wd).IsBusy() {
log.Debug().Msgf("%s busy. Waiting.", id)
time.Sleep(2 * time.Second)
}
log.Debug().Msgf("[single-backend] Stopping %s", id)
return true
if id == s {
return false
}
return false

for ml.models[id].GRPC(false, ml.wd).IsBusy() {
log.Debug().Msgf("%s busy. Waiting.", id)
time.Sleep(2 * time.Second)
}
log.Debug().Msgf("[single-backend] Stopping %s", id)
return true
})
}

Expand Down

0 comments on commit e04ad74

Please sign in to comment.