Skip to content

Commit

Permalink
Fix progress bar remaining time:
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabian Wolf committed Aug 23, 2024
1 parent 8a577e6 commit 2eff344
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def create_parser():
parser.add_argument("--gpu", type=str, default=os.getenv('GPU', "all"), help="Which GPU to use", choices=["all", "0", "1", "2", "3", "4", "5", "6", "7", "mps"])
parser.add_argument("--debug", action="store_true", default=os.getenv('DEBUG', 'false') == 'true')
parser.add_argument("--mode", type=str, default=os.getenv('MODE', "choice"), choices=["anonymizer", "informationextraction", "choice"], help="Which mode to run")
parser.add_argument("--enable_parallel", action="store_true", default=os.getenv('ENABLE_PARALLEL', 'false') == 'true', help="Parallel llama-cpp processing.")
parser.add_argument("--disable_parallel", action="store_true", default=os.getenv('DISABLE_PARALLEL', 'false') == 'true', help="Disable parallel llama-cpp processing.")
parser.add_argument("--no_parallel_preprocessing", action="store_true", default=os.getenv('NO_PARALLEL_PREPROCESSING', 'false') == 'true', help="Disable parallel preprocessing")
# kv cache type can be q4_0, q8_0, f16, f32, q5_0, q5_1, q4_1, iq4_nl
parser.add_argument("--context_size", type=int, default=int(os.getenv('CONTEXT_SIZE', -1)), help="Set custom context size for llama cpp")
Expand Down Expand Up @@ -155,7 +155,7 @@ def check_model_config(model_dir, model_config_file):
app.config["GPU"] = args.gpu
app.config["LLAMACPP_PORT"] = args.llamacpp_port
app.config["DEBUG"] = args.debug
app.config["NO_PARALLEL"] = not args.enable_parallel
app.config["NO_PARALLEL"] = args.disable_parallel
app.config["VERBOSE_LLAMA"] = args.verbose_llama
app.config["PARALLEL_PREPROCESSING"] = not args.no_parallel_preprocessing

Expand Down
7 changes: 6 additions & 1 deletion webapp/llm_processing/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ def update_progress(job_id, progress: tuple[int, int, bool]):
llm_progress[job_id] = progress

# Calculate elapsed time since the job started
if job_id not in start_times:

if job_id not in start_times or progress[0] == 0:
start_times[job_id] = time.time()
elapsed_time = time.time() - start_times[job_id]

Expand Down Expand Up @@ -365,6 +366,10 @@ async def main():
print("PARALLEL ERROR:")
print(e)

update_progress(
job_id=job_id, progress=(0, len(df), True)
)

if not no_parallel:
print("RUN PARALLELLY")
asyncio.run(main())
Expand Down

0 comments on commit 2eff344

Please sign in to comment.