dh-mc commited on
Commit
37368f6
·
1 Parent(s): 90abc4b

show timing/speed for summarization

Browse files
Files changed (1) hide show
  1. summarize.py +8 -2
summarize.py CHANGED
@@ -48,7 +48,7 @@ keep_page_info = (
48
 
49
  sources = load_documents(source_pdfs_path, keep_page_info)
50
 
51
- print(f"Splitting {len(sources)} PDF pages in to chunks ...")
52
 
53
  chunks = split_chunks(
54
  sources, chunk_size=int(chunk_size), chunk_overlap=int(chunk_overlap)
@@ -66,7 +66,13 @@ result = summarize_chain.call_chain(
66
  )
67
 
68
  end = timer()
69
- print(f"Completed in {end - start:.3f}s")
70
 
71
  print("\n\n***Summary:")
72
  print(result["output_text"])
 
 
 
 
 
 
 
48
 
49
  sources = load_documents(source_pdfs_path, keep_page_info)
50
 
51
+ print(f"Splitting {len(sources)} documents in to chunks ...")
52
 
53
  chunks = split_chunks(
54
  sources, chunk_size=int(chunk_size), chunk_overlap=int(chunk_overlap)
 
66
  )
67
 
68
  end = timer()
69
+ total_time = end - start
70
 
71
  print("\n\n***Summary:")
72
  print(result["output_text"])
73
+
74
+ print(f"Total time used: {total_time:.3f} s")
75
+ print(f"Number of tokens generated: {llm_loader.streamer.total_tokens}")
76
+ print(
77
+ f"Average generation speed: {llm_loader.streamer.total_tokens / total_time:.3f} tokens/s"
78
+ )