-
Notifications
You must be signed in to change notification settings - Fork 510
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support to config the context pre-process by the yaml file (#396)
Signed-off-by: SimFG <[email protected]>
- Loading branch information
Showing
12 changed files
with
284 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from gptcache.utils.lazy_import import LazyImport | ||
|
||
summarization = LazyImport( | ||
"summarization_context", | ||
globals(), | ||
"gptcache.processor.context.summarization_context", | ||
) | ||
selective = LazyImport( | ||
"selective_context", globals(), "gptcache.processor.context.selective_context" | ||
) | ||
concat = LazyImport( | ||
"concat_context", globals(), "gptcache.processor.context.concat_context" | ||
) | ||
|
||
|
||
__all__ = [ | ||
"SummarizationContextProcess", | ||
"SelectiveContextProcess", | ||
"ConcatContextProcess", | ||
] | ||
|
||
|
||
def SummarizationContextProcess(summarizer=None, tokenizer=None, target_length=512): | ||
return summarization.SummarizationContextProcess( | ||
summarizer, tokenizer, target_length | ||
) | ||
|
||
|
||
def SelectiveContextProcess( | ||
model_type: str = "gpt2", | ||
lang: str = "en", | ||
reduce_ratio: float = 0.35, | ||
reduce_level: str = "phrase", | ||
): | ||
return selective.SelectiveContextProcess( | ||
model_type=model_type, | ||
lang=lang, | ||
reduce_ratio=reduce_ratio, | ||
reduce_level=reduce_level, | ||
) | ||
|
||
|
||
def ConcatContextProcess(): | ||
return concat.ConcatContextProcess() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.