From 06a42ee1325cb34cb6a160a500e9fcae48c8d7a3 Mon Sep 17 00:00:00 2001 From: Baize Date: Tue, 4 Apr 2023 06:32:49 +0000 Subject: [PATCH] Update app.py --- app.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index cefcaa5..7770333 100644 --- a/app.py +++ b/app.py @@ -17,7 +17,7 @@ base_model = "decapoda-research/llama-7b-hf" adapter_model = "project-baize/baize-lora-7B" tokenizer,model,device = load_tokenizer_and_model(base_model,adapter_model) - +total_cont = 0 def predict(text, chatbot, history, @@ -43,7 +43,8 @@ def predict(text, begin_length = len(prompt) torch.cuda.empty_cache() input_ids = inputs["input_ids"].to(device) - + total_cont += 1 + print(total_cont) with torch.no_grad(): for x in greedy_search(input_ids,model,tokenizer,stop_words=["[|Human|]", "[|AI|]"],max_length=max_length_tokens,temperature=temperature,top_p=top_p): if is_stop_word_or_prefix(x,["[|Human|]", "[|AI|]"]) is False: @@ -221,4 +222,4 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo: #) demo.title = "Baize" -demo.queue(concurrency_count=1,).launch() \ No newline at end of file +demo.queue(concurrency_count=2).launch() \ No newline at end of file