From 5fe6d1872c4467336e77286f2555a2e539a4d68c Mon Sep 17 00:00:00 2001 From: Emmett McFaralne Date: Sat, 23 Mar 2024 21:33:26 -0400 Subject: [PATCH] importing llmlingua on startup --- compress.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compress.py b/compress.py index d752d1b..d043826 100644 --- a/compress.py +++ b/compress.py @@ -5,7 +5,9 @@ from typing import * import os from core import Chunk, SourceTypes +from llmlingua import PromptCompressor +llm_lingua = PromptCompressor(model_name="microsoft/llmlingua-2-xlm-roberta-large-meetingbank", use_llmlingua2=True) CTAGS_LANGUAGES = {'py': "Python", 'ts': "Typescript", "tsx": "Typescript", "cpp": "C++", "c": "C"} def compress_with_ctags(chunk: Chunk, extension: str) -> Chunk: @@ -57,8 +59,6 @@ def compress_with_ctags(chunk: Chunk, extension: str) -> Chunk: return Chunk(path=chunk.path, text=ctags_skeleton, image=chunk.image, source_type=SourceTypes.UNCOMPRESSIBLE_CODE) def compress_chunks(chunks: List[Chunk]) -> List[Chunk]: - from llmlingua import PromptCompressor - llm_lingua = PromptCompressor(model_name="microsoft/llmlingua-2-xlm-roberta-large-meetingbank", use_llmlingua2=True) new_chunks = [] for chunk in chunks: new_chunk = None