Spaces:
Runtime error
Runtime error
JerryLiJinyi
commited on
Commit
•
b5fca0e
1
Parent(s):
94562ac
Update selective_context_compressor.py
Browse files
selective_context_compressor.py
CHANGED
@@ -27,17 +27,3 @@ class SCCompressor(AbstractCompressor):
|
|
27 |
}
|
28 |
return result
|
29 |
|
30 |
-
|
31 |
-
if __name__ == '__main__':
|
32 |
-
import time
|
33 |
-
|
34 |
-
compressor = SCCompressor(lang='en', model='gpt2', device='cuda')
|
35 |
-
test_prompt = "You belong to good side. In reveal phase, You can know which two players are Morgana and Assassin but you can't know which one is Morgana or Assassin specifically, you should reason it by yourself as the game progresses."
|
36 |
-
|
37 |
-
# level can be ['sent', 'phrase', 'token']; model can be ['gpt2', 'curie'], lang can only be 'en'
|
38 |
-
# if model is 'curie', an OPENAI-API-Key must be given in selective_context.py
|
39 |
-
start = time.time()
|
40 |
-
result = compressor.compress(original_prompt=test_prompt, ratio=0.4, level='phrase')
|
41 |
-
end = time.time()
|
42 |
-
print(result)
|
43 |
-
print('程序运行时间为: %s Seconds' % (end - start))
|
|
|
27 |
}
|
28 |
return result
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|