Rahmat82 commited on
Commit
ab570b5
·
verified ·
1 Parent(s): 254f909

example code added

Browse files
Files changed (1) hide show
  1. README.md +15 -7
README.md CHANGED
@@ -34,7 +34,7 @@ should probably proofread and complete it, then remove this comment. -->
34
 
35
  # fastSUMMARIZER-t5-small-finetuned-on-xsum
36
 
37
- This model is a fine-tuned version of [t5-small](https://huggingface.co/t5-small) on the xsum dataset. Click the following link to open the model's demo: https://huggingface.co/spaces/Rahmat82/RHM-text-summarizer-light
38
 
39
  It achieves the following results on the evaluation set:
40
  - Loss: 2.2425
@@ -46,17 +46,25 @@ It achieves the following results on the evaluation set:
46
 
47
  ## Model description
48
 
49
- More information needed
50
 
51
- ## Intended uses & limitations
52
 
53
- More information needed
54
 
55
- ## Training and evaluation data
 
56
 
57
- More information needed
58
 
59
- ## Training procedure
 
 
 
 
 
 
 
60
 
61
  ### Training hyperparameters
62
 
 
34
 
35
  # fastSUMMARIZER-t5-small-finetuned-on-xsum
36
 
37
+ This model is a fine-tuned version of [t5-small](https://huggingface.co/t5-small) on the xsum dataset.
38
 
39
  It achieves the following results on the evaluation set:
40
  - Loss: 2.2425
 
46
 
47
  ## Model description
48
 
49
+ This model is light and performs very fast.
50
 
51
+ ## Use the model
52
 
53
+ Click the following link to open the model's demo: https://huggingface.co/spaces/Rahmat82/RHM-text-summarizer-light
54
 
55
+ ```python
56
+ from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, pipeline
57
 
58
+ model_id = "Rahmat82/t5-small-finetuned-summarization-xsum"
59
 
60
+ model = AutoModelForSeq2SeqLM.from_pretrained(model_id)
61
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
62
+
63
+ text_to_summarize = """If you ever feel the need to sleep while standing, a company in Japan has catered to your needs. The Koyoju Plywood Corporation on Japan's northernmost island of Hokkaido has unveiled the "Giraffenap" booth. This ingenious cubicle allows the user to sleep in a vertical position. It will allow office workers and commuters to catch forty winks without the need for a bed. The designers say a 20-minute nap improves mental performance and increases productivity by reducing fatigue. It also boosts concentration and aids memory retention. The Giraffenap pods come in two designs – the futuristic-looking 'Spacia' and the lattice wood 'Forest'. They will go on sale in December at an expected price of around $20,000. The Giraffenap website says there is a need to refresh while at work. It says: "It's so common these days to work non-stop without an opportunity to properly recover from physical fatigue or stress, often resulting in unwanted sleepiness during the day. Now it's time to break the stereotype that nodding off on the job is a sign of boredom or laziness." The site added that naps allow for "more efficient and fulfilling work". The website stated that napping reduces drowsiness, and improves ingenuity and creativeness. The designers offered some advice for an effective snooze. The optimal time is 15 to 20 minutes, and all naps should take place before 3 p.m. In addition, you should not lie down as this leads to deep sleep."""
64
+
65
+ pipe = pipeline("summarization",model = model, tokenizer=tokenizer)
66
+ print(pipe(text_to_summarize)[0]["summary_text"])
67
+ ```
68
 
69
  ### Training hyperparameters
70