Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenych
chat_demo
Commits
241da631
Commit
241da631
authored
Jul 15, 2024
by
Rayyyyy
Browse files
fix params bug
parent
fe3bae99
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
10 deletions
+7
-10
llm_service/inferencer.py
llm_service/inferencer.py
+2
-2
llm_service/worker.py
llm_service/worker.py
+2
-2
server_start.py
server_start.py
+3
-6
No files found.
llm_service/inferencer.py
View file @
241da631
...
@@ -43,7 +43,7 @@ class InferenceWrapper:
...
@@ -43,7 +43,7 @@ class InferenceWrapper:
self
.
model
=
llm
.
from_hf
(
self
.
model
,
self
.
tokenizer
,
dtype
=
"float16"
).
cuda
()
self
.
model
=
llm
.
from_hf
(
self
.
model
,
self
.
tokenizer
,
dtype
=
"float16"
).
cuda
()
except
Exception
as
e
:
except
Exception
as
e
:
logger
.
error
(
str
(
e
)
)
logger
.
error
(
f
"fastllm initial failed,
{
e
}
"
)
def
chat
(
self
,
prompt
:
str
,
history
=
[]):
def
chat
(
self
,
prompt
:
str
,
history
=
[]):
...
@@ -58,7 +58,7 @@ class InferenceWrapper:
...
@@ -58,7 +58,7 @@ class InferenceWrapper:
history
,
history
,
do_sample
=
False
)
do_sample
=
False
)
except
Exception
as
e
:
except
Exception
as
e
:
logger
.
error
(
str
(
e
)
)
logger
.
error
(
f
"chat inference failed,
{
e
}
"
)
return
output_text
return
output_text
...
...
llm_service/worker.py
View file @
241da631
...
@@ -13,12 +13,12 @@ class ChatAgent:
...
@@ -13,12 +13,12 @@ class ChatAgent:
self
.
reranker_model_path
=
config
[
'feature_database'
][
'reranker_model_path'
]
self
.
reranker_model_path
=
config
[
'feature_database'
][
'reranker_model_path'
]
reject_throttle
=
float
(
config
[
'feature_database'
][
'reject_throttle'
])
reject_throttle
=
float
(
config
[
'feature_database'
][
'reject_throttle'
])
local_llm_path
=
config
[
'llm'
][
'local_llm_path'
]
local_llm_path
=
config
[
'llm'
][
'local_llm_path'
]
accelerate
=
config
.
getboolean
(
'llm'
,
'
accelerate
'
)
use_vllm
=
config
.
getboolean
(
'llm'
,
'
use_vllm
'
)
self
.
retriever
=
CacheRetriever
(
self
.
embedding_model_path
,
self
.
retriever
=
CacheRetriever
(
self
.
embedding_model_path
,
self
.
reranker_model_path
).
get
(
reject_throttle
=
reject_throttle
,
self
.
reranker_model_path
).
get
(
reject_throttle
=
reject_throttle
,
work_dir
=
self
.
work_dir
)
work_dir
=
self
.
work_dir
)
self
.
llm_server
=
LLMInference
(
local_llm_path
,
tensor_parallel_size
,
accelerate
=
accelerate
)
self
.
llm_server
=
LLMInference
(
local_llm_path
,
tensor_parallel_size
,
use_vllm
=
use_vllm
)
def
generate_prompt
(
self
,
def
generate_prompt
(
self
,
history_pair
,
history_pair
,
...
...
server_start.py
View file @
241da631
...
@@ -116,20 +116,17 @@ def auto_select_dcu(config):
...
@@ -116,20 +116,17 @@ def auto_select_dcu(config):
def
parse_args
():
def
parse_args
():
parser
=
argparse
.
ArgumentParser
(
description
=
'Start all services.'
)
parser
=
argparse
.
ArgumentParser
(
description
=
'Start all services.'
)
parser
.
add_argument
(
'--config_path'
,
parser
.
add_argument
(
'--config_path'
,
default
=
'
/path/of
/config.ini'
,
default
=
'
.
/config.ini'
,
help
=
'Config directory'
)
help
=
'Config directory'
)
parser
.
add_argument
(
'--log_path'
,
parser
.
add_argument
(
'--log_path'
,
default
=
''
,
default
=
'
./log/assistant.log
'
,
help
=
'Set log file path'
)
help
=
'Set log file path'
)
return
parser
.
parse_args
()
return
parser
.
parse_args
()
def
main
():
def
main
():
args
=
parse_args
()
args
=
parse_args
()
log_path
=
'./log/assistant.log'
logger
.
add
(
sink
=
args
.
log_path
,
level
=
"DEBUG"
,
rotation
=
"500MB"
,
compression
=
"zip"
,
encoding
=
"utf-8"
,
enqueue
=
True
)
if
args
.
log_path
:
log_path
=
args
.
log_path
logger
.
add
(
sink
=
log_path
,
level
=
"DEBUG"
,
rotation
=
"500MB"
,
compression
=
"zip"
,
encoding
=
"utf-8"
,
enqueue
=
True
)
workflow
(
args
)
workflow
(
args
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment