imvladikon commited on
Commit
51b722d
โ€ข
1 Parent(s): 76970d0

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +26 -1
README.md CHANGED
@@ -2,4 +2,29 @@
2
  language:
3
  - he
4
  pipeline_tag: summarization
5
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  language:
3
  - he
4
  pipeline_tag: summarization
5
+ ---
6
+
7
+
8
+ ```python
9
+ from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, SummarizationPipeline
10
+
11
+
12
+ model_name = "imvladikon/het5_small_summarization"
13
+ model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
14
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
15
+ summarizer = SummarizationPipeline(model=model, tokenizer=tokenizer)
16
+ ```
17
+
18
+ example
19
+ ```python
20
+ text = """
21
+ ืฆืจืคืช ืžืžืฉื™ื›ื” ืœื‘ืขื•ืจ: ืœืื—ืจ ืืจื‘ืขื” ื™ืžื™ื ืฉืœ ืขื™ืžื•ืชื™ื ืืœื™ืžื™ื ื‘ื™ืŸ ืžืชืคืจืขื™ื ืœื›ื•ื—ื•ืช ื”ื‘ื™ื˜ื—ื•ืŸ ื‘ื›ืœ ืจื—ื‘ื™ ืฆืจืคืช, ื”ื™ื•ื (ืฉื‘ืช) ื”ืชืงื™ื™ืžื” ื”ืœื•ื•ื™ืชื• ืฉืœ ื”ื ืขืจ ื”ืืœื’'ื™ืจืื™, ื ืื”ืœ ื‘ืŸ ื”-17, ืฉื ื•ืจื” ืœืžื•ื•ืช ืขืœ ื™ื“ื™ ืฉื•ื˜ืจ ืœืื—ืจ ืฉื ื—ืฉื“ ื‘ื’ื ื™ื‘ืช ืจื›ื‘. ืœื‘ืงืฉืช ืžืฉืคื—ืชื•, ื”ื”ืœื•ื•ื™ื” ื”ืชืงื™ื™ืžื” ื›ืื™ืจื•ืข ืžืฆื•ืžืฆืžื ืฉื‘ื• ื”ืฉืชืชืคื• ื‘ื ื™ ืžืฉืคื—ื” ื•ื—ื‘ืจื™ื ื‘ืœื‘ื“. ืœืื—ืจ ืฉืืจื•ื ื• ืฉืœ ื ืื”ืœ ื”ื•ืฆื ืžื”ืžืกื’ื“ ื‘ืขื™ืจ ื ืื ื˜ืจ, ืืœืคื™ื ืงืจืื• "ืœืขืฉื™ื™ืช ืฆื“ืง ืขื‘ื•ืจื•".ื‘ืžืงื‘ื™ืœ, ื”ืžืฉื˜ืจื” ื”ืฆืจืคืชื™ืช ื ืขืจื›ืช ืœื”ืžืฉืš ื”ืžื”ื•ืžื•ืช ื‘ืขืฉืจื•ืช ืžื•ืงื“ื™ื ื‘ืจื—ื‘ื™ ื”ืžื“ื™ื ื”, ื›ืฉื‘ืžื”ืœืš ื”ืœื™ืœื” ื ืขืฆืจื• 1,300 ื‘ื ื™ ืื“ื. ืžืฉืจื“ ื”ืคื ื™ื ื”ืฆืจืคืชื™ ื”ื•ื“ื™ืข ื›ื™ ื‘ืžื”ืœืš ื”ืื™ืจื•ืขื™ื ื”ื•ืฆืชื• 1,350 ื›ืœื™ ืจื›ื‘, ื•-234 ื”ืฆืชื•ืช ืฉืœ ืžื‘ื ื™ื. ื›ืžื• ื›ืŸ, ืขืœ ืคื™ ื”ื ืชื•ื ื™ื ื ื’ืจื ื ื–ืง ืœ-200 ืžืจื›ื–ื™ ืงื ื™ื•ืช, 200 ืกื•ืคืจืžืจืงื˜ื™ื ื•-250 ืกื ื™ืคื™ ื‘ื ืง.
22
+ """.strip()
23
+ summarizer(text,
24
+ max_length=50,
25
+ num_beams=4,
26
+ no_repeat_ngram_size=2,
27
+ early_stopping=True)[0]["summary_text"]
28
+ #ืœืื—ืจ ืืจื‘ืขื” ื™ืžื™ื ืฉืœ ืขื™ืžื•ืชื™ื ืืœื™ืžื™ื ื‘ื™ืŸ ืžืชืคืจืขื™ื ืœื›ื•ื—ื•ืช ื”ื‘ื™ื˜ื—ื•ืŸ ื‘ื›ืœ ืจื—ื‘ื™ ืฆืจืคืช, ื”ืœื•ื•ื™ืชื• ืฉืœ ื ืื”ืœ ื‘ืŸ ื”-17 ื”ืชืงื™ื™ืžื” ื›ืื™ืจื•ืข ืžืฆื•ืžืฆื
29
+ ```
30
+