mirror of
https://github.com/ParisNeo/lollms.git
synced 2024-12-21 13:37:55 +00:00
Update personality.py
This commit is contained in:
parent
942fced394
commit
fa98d94184
@ -2221,12 +2221,11 @@ class APScript(StateMachine):
|
|||||||
chunk_summary_post_processing=None,
|
chunk_summary_post_processing=None,
|
||||||
summary_mode=SUMMARY_MODE.SUMMARY_MODE_SEQUENCIAL
|
summary_mode=SUMMARY_MODE.SUMMARY_MODE_SEQUENCIAL
|
||||||
):
|
):
|
||||||
depth=0
|
|
||||||
tk = self.personality.model.tokenize(text)
|
tk = self.personality.model.tokenize(text)
|
||||||
prev_len = len(tk)
|
prev_len = len(tk)
|
||||||
document_chunks=None
|
document_chunks=None
|
||||||
while len(tk)>max_summary_size and (document_chunks is None or len(document_chunks)>1):
|
while len(tk)>max_summary_size and (document_chunks is None or len(document_chunks)>1):
|
||||||
self.step_start(f"Comprerssing {doc_name}... [depth {depth+1}]")
|
self.step_start(f"Comprerssing {doc_name}...")
|
||||||
chunk_size = int(self.personality.config.ctx_size*0.6)
|
chunk_size = int(self.personality.config.ctx_size*0.6)
|
||||||
document_chunks = DocumentDecomposer.decompose_document(text, chunk_size, 0, self.personality.model.tokenize, self.personality.model.detokenize, True)
|
document_chunks = DocumentDecomposer.decompose_document(text, chunk_size, 0, self.personality.model.tokenize, self.personality.model.detokenize, True)
|
||||||
text = self.summerize_chunks(
|
text = self.summerize_chunks(
|
||||||
@ -2243,9 +2242,8 @@ class APScript(StateMachine):
|
|||||||
dtk_ln=prev_len-len(tk)
|
dtk_ln=prev_len-len(tk)
|
||||||
prev_len = len(tk)
|
prev_len = len(tk)
|
||||||
self.step(f"Current text size : {prev_len}, max summary size : {max_summary_size}")
|
self.step(f"Current text size : {prev_len}, max summary size : {max_summary_size}")
|
||||||
self.step_end(f"Comprerssing {doc_name}... [depth {depth+1}]")
|
self.step_end(f"Comprerssing {doc_name}...")
|
||||||
depth += 1
|
if dtk_ln<=10: # it is not summarizing
|
||||||
if dtk_ln<=10: # it is not sumlmarizing
|
|
||||||
break
|
break
|
||||||
return text
|
return text
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user