mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-01 16:18:27 +00:00
add debug log
This commit is contained in:
parent
65ead15b65
commit
905f14cf7c
@ -48,8 +48,8 @@ def generate_stream_gate(params):
|
||||
params,
|
||||
DEVICE,
|
||||
MAX_POSITION_EMBEDDINGS,
|
||||
2,
|
||||
):
|
||||
print("output: ", output)
|
||||
ret = {
|
||||
"text": output,
|
||||
"error_code": 0,
|
||||
@ -68,7 +68,7 @@ async def api_generate_stream(request: Request):
|
||||
global model_semaphore, global_counter
|
||||
global_counter += 1
|
||||
params = await request.json()
|
||||
|
||||
print(model, tokenizer, params, DEVICE)
|
||||
if model_semaphore is None:
|
||||
model_semaphore = asyncio.Semaphore(LIMIT_MODEL_CONCURRENCY)
|
||||
await model_semaphore.acquire()
|
||||
|
@ -156,12 +156,13 @@ def http_bot(state, temperature, max_new_tokens, request: gr.Request):
|
||||
prompt = state.get_prompt()
|
||||
skip_echo_len = compute_skip_echo_len(prompt)
|
||||
|
||||
logger.info(f"State: {state}")
|
||||
payload = {
|
||||
"model": model_name,
|
||||
"prompt": prompt,
|
||||
"temperature": temperature,
|
||||
"max_new_tokens": max_new_tokens,
|
||||
"stop": state.sep if state.sep_style == SeparatorStyle.SINGLE else None,
|
||||
"stop": state.sep,
|
||||
}
|
||||
|
||||
logger.info(f"Request: \n {payload}")
|
||||
@ -179,6 +180,7 @@ def http_bot(state, temperature, max_new_tokens, request: gr.Request):
|
||||
for chunk in response.iter_lines(decode_unicode=False, delimiter=b"\0"):
|
||||
if chunk:
|
||||
data = json.loads(chunk.decode())
|
||||
logger.info(f"Response: {data}")
|
||||
if data["error_code"] == 0:
|
||||
output = data["text"][skip_echo_len].strip()
|
||||
output = post_process_code(output)
|
||||
|
Loading…
Reference in New Issue
Block a user