nandakishormpai
commited on
Commit
•
d65e265
1
Parent(s):
163a864
Update README.md
Browse files
README.md
CHANGED
@@ -2,11 +2,19 @@
|
|
2 |
license: apache-2.0
|
3 |
tags:
|
4 |
- generated_from_trainer
|
|
|
|
|
|
|
|
|
|
|
5 |
metrics:
|
6 |
- rouge
|
7 |
model-index:
|
8 |
- name: t5-small-machine-articles-tag-generation
|
9 |
results: []
|
|
|
|
|
|
|
10 |
---
|
11 |
|
12 |
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
@@ -14,7 +22,67 @@ should probably proofread and complete it, then remove this comment. -->
|
|
14 |
|
15 |
# t5-small-machine-articles-tag-generation
|
16 |
|
17 |
-
This model is a fine-tuned version of [t5-small](https://huggingface.co/t5-small) on the
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
It achieves the following results on the evaluation set:
|
19 |
- Loss: 2.1373
|
20 |
- Rouge1: 35.4695
|
@@ -23,19 +91,10 @@ It achieves the following results on the evaluation set:
|
|
23 |
- Rougelsum: 31.8068
|
24 |
- Gen Len: 17.8617
|
25 |
|
26 |
-
## Model description
|
27 |
-
|
28 |
-
More information needed
|
29 |
-
|
30 |
-
## Intended uses & limitations
|
31 |
-
|
32 |
-
More information needed
|
33 |
-
|
34 |
## Training and evaluation data
|
35 |
|
36 |
-
|
37 |
|
38 |
-
## Training procedure
|
39 |
|
40 |
### Training hyperparameters
|
41 |
|
@@ -49,25 +108,10 @@ The following hyperparameters were used during training:
|
|
49 |
- num_epochs: 10
|
50 |
- mixed_precision_training: Native AMP
|
51 |
|
52 |
-
### Training results
|
53 |
-
|
54 |
-
| Training Loss | Epoch | Step | Validation Loss | Rouge1 | Rouge2 | Rougel | Rougelsum | Gen Len |
|
55 |
-
|:-------------:|:-----:|:----:|:---------------:|:-------:|:-------:|:-------:|:---------:|:-------:|
|
56 |
-
| No log | 1.0 | 47 | 2.5909 | 24.2327 | 9.1727 | 21.8909 | 22.0571 | 18.7872 |
|
57 |
-
| No log | 2.0 | 94 | 2.4153 | 26.6932 | 11.6208 | 23.4245 | 23.5239 | 18.7553 |
|
58 |
-
| No log | 3.0 | 141 | 2.3114 | 30.3316 | 14.2051 | 27.106 | 27.1811 | 18.4894 |
|
59 |
-
| No log | 4.0 | 188 | 2.2459 | 32.0196 | 15.096 | 28.605 | 28.6557 | 18.0319 |
|
60 |
-
| No log | 5.0 | 235 | 2.2018 | 33.3377 | 15.947 | 30.3578 | 30.3452 | 18.0106 |
|
61 |
-
| No log | 6.0 | 282 | 2.1758 | 34.6311 | 16.5613 | 30.7548 | 30.7693 | 17.9468 |
|
62 |
-
| No log | 7.0 | 329 | 2.1586 | 34.7046 | 16.7347 | 30.6985 | 30.6839 | 17.7553 |
|
63 |
-
| No log | 8.0 | 376 | 2.1480 | 35.388 | 16.9474 | 31.4169 | 31.45 | 17.8085 |
|
64 |
-
| No log | 9.0 | 423 | 2.1397 | 35.522 | 17.0258 | 31.8568 | 31.8409 | 17.9574 |
|
65 |
-
| No log | 10.0 | 470 | 2.1373 | 35.4695 | 17.081 | 31.8215 | 31.8068 | 17.8617 |
|
66 |
-
|
67 |
|
68 |
### Framework versions
|
69 |
|
70 |
- Transformers 4.26.1
|
71 |
- Pytorch 1.13.1+cu116
|
72 |
- Datasets 2.9.0
|
73 |
-
- Tokenizers 0.13.2
|
|
|
2 |
license: apache-2.0
|
3 |
tags:
|
4 |
- generated_from_trainer
|
5 |
+
- machine_learning
|
6 |
+
- article_tag
|
7 |
+
- tag_generation
|
8 |
+
- ml_article_tag
|
9 |
+
- blog_tag_generation
|
10 |
metrics:
|
11 |
- rouge
|
12 |
model-index:
|
13 |
- name: t5-small-machine-articles-tag-generation
|
14 |
results: []
|
15 |
+
language:
|
16 |
+
- en
|
17 |
+
pipeline_tag: text2text-generation
|
18 |
---
|
19 |
|
20 |
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
|
|
22 |
|
23 |
# t5-small-machine-articles-tag-generation
|
24 |
|
25 |
+
Machine Learning model to generate Tags for Machine Learning related articles. This model is a fine-tuned version of [t5-small](https://huggingface.co/t5-small) fine-tuned on a refined version of [190k Medium Articles](https://www.kaggle.com/datasets/fabiochiusano/medium-articles) dataset for generating Machine Learning article tags using the article textual content as input. While usually formulated as a multi-label classification problem, this model deals with _tag generation_ as a text2text generation task (inspiration and reference: [fabiochiu/t5-base-tag-generation](https://huggingface.co/fabiochiu/t5-base-tag-generation)).
|
26 |
+
<br><br>
|
27 |
+
Finetuning Notebook Reference: [Hugging face summarization notebook](https://github.com/huggingface/notebooks/blob/main/examples/summarization.ipynb).
|
28 |
+
# How to use the model
|
29 |
+
### Installations
|
30 |
+
|
31 |
+
```python
|
32 |
+
pip install transformers nltk
|
33 |
+
```
|
34 |
+
### Code
|
35 |
+
|
36 |
+
```python
|
37 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
38 |
+
import nltk
|
39 |
+
nltk.download('punkt')
|
40 |
+
|
41 |
+
tokenizer = AutoTokenizer.from_pretrained("nandakishormpai/t5-small-machine-articles-tag-generation")
|
42 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("nandakishormpai/t5-small-machine-articles-tag-generation")
|
43 |
+
|
44 |
+
article_text = """
|
45 |
+
Paige, AI in pathology and genomics
|
46 |
+
|
47 |
+
Fundamentally transforming the diagnosis and treatment of cancer
|
48 |
+
Paige has raised $25M in total. We talked with Leo Grady, its CEO.
|
49 |
+
How would you describe Paige in a single tweet?
|
50 |
+
AI in pathology and genomics will fundamentally transform the diagnosis and treatment of cancer.
|
51 |
+
How did it all start and why?
|
52 |
+
Paige was founded out of Memorial Sloan Kettering to bring technology that was developed there to doctors and patients worldwide. For over a decade, Thomas Fuchs and his colleagues have developed a new, powerful technology for pathology. This technology can improve cancer diagnostics, driving better patient care at lower cost. Paige is building clinical products from this technology and extending the technology to the development of new biomarkers for the biopharma industry.
|
53 |
+
What have you achieved so far?
|
54 |
+
TEAM: In the past year and a half, Paige has built a team with members experienced in AI, entrepreneurship, design and commercialization of clinical software.
|
55 |
+
PRODUCT: We have achieved FDA breakthrough designation for the first product we plan to launch, a testament to the impact our technology will have in this market.
|
56 |
+
CUSTOMERS: None yet, as we are working on CE and FDA regulatory clearances. We are working with several biopharma companies.
|
57 |
+
What do you plan to achieve in the next 2 or 3 years?
|
58 |
+
Commercialization of multiple clinical products for pathologists, as well as the development of novel biomarkers that can help speed up and better inform the diagnosis and treatment selection for patients with cancer.
|
59 |
+
"""
|
60 |
+
|
61 |
+
inputs = tokenizer([article_text], max_length=1024, truncation=True, return_tensors="pt")
|
62 |
+
output = model.generate(**inputs, num_beams=8, do_sample=True, min_length=10,
|
63 |
+
max_length=128)
|
64 |
+
|
65 |
+
decoded_output = tokenizer.batch_decode(output, skip_special_tokens=True)[0]
|
66 |
+
tags = decoded_output.split(",")
|
67 |
+
|
68 |
+
print(tags)
|
69 |
+
|
70 |
+
# ['Paige', ' AI in pathology and genomics', ' AI in pathology', ' genomics']
|
71 |
+
|
72 |
+
```
|
73 |
+
## Dataset Preparation
|
74 |
+
|
75 |
+
Over the 190k article dataset from Kaggle, around 12k of them are Machine Learning based and the tags were pretty high level.
|
76 |
+
Generating more specific tags would be of use while developing a system for Technical Blog Platforms.
|
77 |
+
ML Articles were filtered out and around 1000 articles were sampled. GPT3 API was used to Tag those and then preprocessing on the generated tags was performed to enusre articles with 4 or 5 tags were selected for the final dataset that came around 940 articles.
|
78 |
+
|
79 |
+
|
80 |
+
## Intended uses & limitations
|
81 |
+
|
82 |
+
This model can be used to generate Tags for Machine Learning articles primarily and can be used for other technical articles expecting a lesser accuracy and detail. The results might contain duplicate tags that must be handled in the postprocessing of results.
|
83 |
+
|
84 |
+
## Results
|
85 |
+
|
86 |
It achieves the following results on the evaluation set:
|
87 |
- Loss: 2.1373
|
88 |
- Rouge1: 35.4695
|
|
|
91 |
- Rougelsum: 31.8068
|
92 |
- Gen Len: 17.8617
|
93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
## Training and evaluation data
|
95 |
|
96 |
+
Dataset of over 940 articles were split across train : val : test as 80:10:10 ratio samples.
|
97 |
|
|
|
98 |
|
99 |
### Training hyperparameters
|
100 |
|
|
|
108 |
- num_epochs: 10
|
109 |
- mixed_precision_training: Native AMP
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
|
112 |
### Framework versions
|
113 |
|
114 |
- Transformers 4.26.1
|
115 |
- Pytorch 1.13.1+cu116
|
116 |
- Datasets 2.9.0
|
117 |
+
- Tokenizers 0.13.2
|