Spaces:
Running
Running
Update util/keywordExtract.py
Browse files- util/keywordExtract.py +3 -0
util/keywordExtract.py
CHANGED
|
@@ -29,6 +29,8 @@ def summarize_kobart(text):
|
|
| 29 |
truncation=True,
|
| 30 |
max_length=512, # 모델에 맞게 조정 (512/1024 중 하나일 확률 큼)
|
| 31 |
)
|
|
|
|
|
|
|
| 32 |
|
| 33 |
summary_ids = summary_model.generate(
|
| 34 |
**inputs,
|
|
@@ -41,6 +43,7 @@ def summarize_kobart(text):
|
|
| 41 |
)
|
| 42 |
return summary_tokenizer.decode(summary_ids[0], skip_special_tokens=True)
|
| 43 |
|
|
|
|
| 44 |
# ✅ 키워드 추출용 KoBERT
|
| 45 |
class KoBERTEmbedding:
|
| 46 |
def __init__(self, model, tokenizer):
|
|
|
|
| 29 |
truncation=True,
|
| 30 |
max_length=512, # 모델에 맞게 조정 (512/1024 중 하나일 확률 큼)
|
| 31 |
)
|
| 32 |
+
if "token_type_ids" in inputs:
|
| 33 |
+
inputs.pop("token_type_ids")
|
| 34 |
|
| 35 |
summary_ids = summary_model.generate(
|
| 36 |
**inputs,
|
|
|
|
| 43 |
)
|
| 44 |
return summary_tokenizer.decode(summary_ids[0], skip_special_tokens=True)
|
| 45 |
|
| 46 |
+
|
| 47 |
# ✅ 키워드 추출용 KoBERT
|
| 48 |
class KoBERTEmbedding:
|
| 49 |
def __init__(self, model, tokenizer):
|