Skip to content

Commit

Permalink
fix: update vllm to v0.4.0 hotfix version
Browse files Browse the repository at this point in the history
  • Loading branch information
nkwangleiGIT committed Apr 7, 2024
1 parent f259628 commit 246fe68
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 19 deletions.
6 changes: 3 additions & 3 deletions pkg/appruntime/agent/streamhandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ type StreamHandler struct {
var _ callbacks.Handler = StreamHandler{}

func (handler StreamHandler) HandleStreamingFunc(ctx context.Context, chunk []byte) {
if _, ok := handler.args[base.OutputAnserStreamChanKeyInArg]; ok {
if _, ok := handler.args[base.OutputAnswerStreamChanKeyInArg]; ok {
logger := klog.FromContext(ctx)
streamChan, ok := handler.args[base.OutputAnserStreamChanKeyInArg].(chan string)
streamChan, ok := handler.args[base.OutputAnswerStreamChanKeyInArg].(chan string)
if !ok {
err := fmt.Errorf("answer_stream is not chan string, but %T", handler.args[base.OutputAnserStreamChanKeyInArg])
err := fmt.Errorf("answer_stream is not chan string, but %T", handler.args[base.OutputAnswerStreamChanKeyInArg])
logger.Error(err, "answer_stream is not chan string")
return
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/appruntime/app_runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func (a *Application) Run(ctx context.Context, cli client.Client, respStream cha
out := map[string]any{
base.InputQuestionKeyInArg: input.Question,
"files": input.Files,
base.OutputAnserStreamChanKeyInArg: respStream,
base.OutputAnswerStreamChanKeyInArg: respStream,
base.InputIsNeedStreamKeyInArg: input.NeedStream,
base.LangchaingoChatMessageHistoryKeyInArg: input.History,
// Use an empty context before run
Expand Down Expand Up @@ -205,7 +205,7 @@ func (a *Application) Run(ctx context.Context, cli client.Client, respStream cha
var er *base.RetrieverGetNullDocError
if errors.As(err, &er) {
agentReturnNothing := true
v, ok := out[base.OutputAnserKeyInArg]
v, ok := out[base.OutputAnswerKeyInArg]
if ok {
if answer, ok := v.(string); ok && len(answer) > 0 {
agentReturnNothing = false
Expand All @@ -229,7 +229,7 @@ func (a *Application) Run(ctx context.Context, cli client.Client, respStream cha
waitRunningNodes.PushBack(n)
}
}
if a, ok := out[base.OutputAnserKeyInArg]; ok {
if a, ok := out[base.OutputAnswerKeyInArg]; ok {
if answer, ok := a.(string); ok && len(answer) > 0 {
output = Output{Answer: answer}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/appruntime/base/keyword.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ const (
InputQuestionKeyInArg = "question"
InputIsNeedStreamKeyInArg = "_need_stream"
LangchaingoChatMessageHistoryKeyInArg = "_history"
OutputAnserKeyInArg = "_answer"
OutputAnswerKeyInArg = "_answer"
AgentOutputInArg = "_agent_answer"
MapReduceDocumentOutputInArg = "_mapreduce_document_answer"
OutputAnserStreamChanKeyInArg = "_answer_stream"
OutputAnswerStreamChanKeyInArg = "_answer_stream"
RuntimeRetrieverReferencesKeyInArg = "_references"
LangchaingoRetrieverKeyInArg = "retriever"
LangchaingoLLMKeyInArg = "llm"
Expand Down
2 changes: 1 addition & 1 deletion pkg/appruntime/chain/apichain.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (l *APIChain) Run(ctx context.Context, _ client.Client, args map[string]any
out, err = handleNoErrNoOut(ctx, needStream, out, err, l.APIChain, args, options)
klog.FromContext(ctx).V(5).Info("use apichain, blocking out:" + out)
if err == nil {
args[base.OutputAnserKeyInArg] = out
args[base.OutputAnswerKeyInArg] = out
return args, nil
}
return args, fmt.Errorf("apichain run error: %w", err)
Expand Down
6 changes: 3 additions & 3 deletions pkg/appruntime/chain/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ import (

func stream(res map[string]any) func(ctx context.Context, chunk []byte) error {
return func(ctx context.Context, chunk []byte) error {
if _, ok := res[base.OutputAnserStreamChanKeyInArg]; ok {
if _, ok := res[base.OutputAnswerStreamChanKeyInArg]; ok {
logger := klog.FromContext(ctx)
streamChan, ok := res[base.OutputAnserStreamChanKeyInArg].(chan string)
streamChan, ok := res[base.OutputAnswerStreamChanKeyInArg].(chan string)
if !ok {
err := fmt.Errorf("answer_stream is not chan string, but %T", res[base.OutputAnserStreamChanKeyInArg])
err := fmt.Errorf("answer_stream is not chan string, but %T", res[base.OutputAnswerStreamChanKeyInArg])
logger.Error(err, "answer_stream is not chan string")
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/appruntime/chain/llmchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func (l *LLMChain) Run(ctx context.Context, cli client.Client, args map[string]a
out, err = handleNoErrNoOut(ctx, needStream, out, err, l.LLMChain, args, options)
klog.FromContext(ctx).V(5).Info("use llmchain, blocking out:" + out)
if err == nil {
args[base.OutputAnserKeyInArg] = out
args[base.OutputAnswerKeyInArg] = out
return args, nil
}
return args, fmt.Errorf("llmchain run error: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/appruntime/chain/retrievalqachain.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func (l *RetrievalQAChain) Run(ctx context.Context, cli client.Client, args map[
out, err = handleNoErrNoOut(ctx, needStream, out, err, l.ConversationalRetrievalQA, args, options)
klog.FromContext(ctx).V(5).Info("use retrievalqachain, blocking out:" + out)
if err == nil {
args[base.OutputAnserKeyInArg] = out
args[base.OutputAnswerKeyInArg] = out
return args, nil
}
return args, fmt.Errorf("retrievalqachain run error: %w", err)
Expand Down
8 changes: 3 additions & 5 deletions pkg/worker/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ import (

const (
// tag is the same version as fastchat
defaultFastChatImage = "kubeagi/arcadia-fastchat-worker:v0.2.36"
defaultFastChatImage = "kubeagi/arcadia-fastchat-worker:vllm-v0.4.0-hotfix"
// For ease of maintenance and stability, VLLM module is now included in standard image as a default feature.
defaultFastchatVLLMImage = "kubeagi/arcadia-fastchat-worker:v0.2.36"
defaultFastchatVLLMImage = "kubeagi/arcadia-fastchat-worker:vllm-v0.4.0-hotfix"
// defaultKubeAGIImage for RunnerKubeAGI
defaultKubeAGIImage = "kubeagi/core-library-cli:v0.0.1"

Expand Down Expand Up @@ -249,9 +249,7 @@ func (runner *RunnerFastchatVLLM) Build(ctx context.Context, model *arcadiav1alp
additionalEnvs = append(additionalEnvs, corev1.EnvVar{Name: "NUMBER_GPUS", Value: gpus})

modelFileDir := fmt.Sprintf("%s/%s", defaultModelMountPath, model.Name)
// --enforce-eager to disable cupy
// TODO: remove --enforce-eager when https://github.com/kubeagi/arcadia/issues/878 is fixed
extraAgrs = fmt.Sprintf("%s --trust-remote-code --enforce-eager", extraAgrs)
extraAgrs = fmt.Sprintf("%s --trust-remote-code", extraAgrs)
if runner.modelFileFromRemote {
m := arcadiav1alpha1.Model{}
if err := runner.c.Get(ctx, types.NamespacedName{Namespace: *model.Namespace, Name: model.Name}, &m); err != nil {
Expand Down

0 comments on commit 246fe68

Please sign in to comment.