Spaces:
Runtime error
Runtime error
JerryLiJinyi
commited on
Commit
•
552bf8e
1
Parent(s):
c6a14bf
Upload 2 files
Browse files- app.py +3 -3
- requirements.txt +2 -1
app.py
CHANGED
@@ -5,17 +5,17 @@ from compressor import PromptCompressor
|
|
5 |
def compressit(original_text, compressor1, ratio, maxlength):
|
6 |
|
7 |
if compressor1=="Selective Context":
|
8 |
-
compressor = PromptCompressor(type='SCCompressor', lang='en', model='gpt2', device='
|
9 |
elif compressor1=="LLMLingua":
|
10 |
return "Sorry, currently we cannot provide services for LLMLingua due to the Huggingface Token issue. Please try other compressors."
|
11 |
elif compressor1=="LongLLMLingua":
|
12 |
return "Sorry, currently we cannot provide services for LongLLMLingua due to the Huggingface Token issue. Please try other compressors."
|
13 |
elif compressor1=="SCRL":
|
14 |
-
compressor = PromptCompressor(type='SCRLCompressor', model_dir="models/gigaword-L8/", device="
|
15 |
elif compressor1=="KiS":
|
16 |
compressor = PromptCompressor(type='KiSCompressor', device="cuda", model_dir="philippelaban/keep_it_simple")
|
17 |
else:
|
18 |
-
compressor = PromptCompressor(type='SCCompressor', lang='en', model='gpt2', device='
|
19 |
|
20 |
if compressor1 != "SCRL":
|
21 |
compressed_prompt = compressor.compressgo(original_prompt=original_text, ratio=float(ratio), max_length=int(maxlength))
|
|
|
5 |
def compressit(original_text, compressor1, ratio, maxlength):
|
6 |
|
7 |
if compressor1=="Selective Context":
|
8 |
+
compressor = PromptCompressor(type='SCCompressor', lang='en', model='gpt2', device='cpu')
|
9 |
elif compressor1=="LLMLingua":
|
10 |
return "Sorry, currently we cannot provide services for LLMLingua due to the Huggingface Token issue. Please try other compressors."
|
11 |
elif compressor1=="LongLLMLingua":
|
12 |
return "Sorry, currently we cannot provide services for LongLLMLingua due to the Huggingface Token issue. Please try other compressors."
|
13 |
elif compressor1=="SCRL":
|
14 |
+
compressor = PromptCompressor(type='SCRLCompressor', model_dir="models/gigaword-L8/", device="cpu", tokenizer_dir="sentence-transformers/paraphrase-distilroberta-base-v2")
|
15 |
elif compressor1=="KiS":
|
16 |
compressor = PromptCompressor(type='KiSCompressor', device="cuda", model_dir="philippelaban/keep_it_simple")
|
17 |
else:
|
18 |
+
compressor = PromptCompressor(type='SCCompressor', lang='en', model='gpt2', device='cpu')
|
19 |
|
20 |
if compressor1 != "SCRL":
|
21 |
compressed_prompt = compressor.compressgo(original_prompt=original_text, ratio=float(ratio), max_length=int(maxlength))
|
requirements.txt
CHANGED
@@ -20,4 +20,5 @@ wandb
|
|
20 |
rake-nltk
|
21 |
scikit-learn
|
22 |
python-Levenshtein
|
23 |
-
colorama
|
|
|
|
20 |
rake-nltk
|
21 |
scikit-learn
|
22 |
python-Levenshtein
|
23 |
+
colorama
|
24 |
+
en_core_web_sm
|