File size: 8,865 Bytes
40698c7
58697be
b79c9a5
 
 
 
 
 
 
b63fcd0
 
428863c
58697be
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dacb3fc
 
99e09f4
dacb3fc
 
 
 
99e09f4
 
dacb3fc
 
 
 
 
8bf940d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0ced645
 
 
 
 
 
8bf940d
 
0ced645
 
 
 
 
8bf940d
 
 
dacb3fc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
---
license: apache-2.0
datasets:
- Ateeqq/news-title-generator
language:
- en
library_name: transformers
tags:
- text-generation-inference
metrics:
- accuracy
widget:
- text: >-
    Jumping on the bandwagon in the artificial intelligence race, Meta has
    started rolling out AI chatbot feature for its social networking sites
    WhatsApp and Instagram across India and Africa, India Today reported. The
    AI-powered search bar feature was first introduced in WhatsApp beta for
    Android 2.24.7.14 update. It allows users to use the search engine to ask
    queries. The feature is mainly being tested out in certain regions such as
    India and Africa and is expected to go global soon. Now, the company is
    experimenting with putting Meta AI in the Instagram search bar. You can use
    it to either chat with AI or to look up content.
  example_title: 1st - Meta News
- text: >-
    Tesla has slashed the price of its Full Self-Driving (FSD) software
    subscription to $99 per month, down from $199 per month, as the electric
    vehicle maker aims to boost adoption of its advanced driver assistance
    system ahead of first-quarter earnings. The price cut comes a couple of
    weeks after Tesla launched a free one-month trial of FSD for every customer
    in the U.S. with a compatible Tesla. That trial is still ongoing. Formerly
    known as FSD Beta, Tesla is now referring to the software as “Supervised
    FSD” to make it clear that the software doesn’t turn Teslas into autonomous
    vehicles, and human drivers still need to supervise the not-so-self-driving
    software.
  example_title: 2nd Tesla News
- text: >-
    To assess a community’s risk of extreme weather, policymakers rely first on
    global climate models that can be run decades, and even centuries, forward
    in time, but only at a coarse resolution. These models might be used to
    gauge, for instance, future climate conditions for the northeastern U.S.,
    but not specifically for Boston. To estimate Boston’s future risk of extreme
    weather such as flooding, policymakers can combine a coarse model’s
    large-scale predictions with a finer-resolution model, tuned to estimate how
    often Boston is likely to experience damaging floods as the climate warms.
    But this risk analysis is only as accurate as the predictions from that
    first, coarser climate model. “If you get those wrong for large-scale
    environments, then you miss everything in terms of what extreme events will
    look like at smaller scales, such as over individual cities,” says
    Themistoklis Sapsis, the William I. Koch Professor and director of the
    Center for Ocean Engineering in MIT’s Department of Mechanical Engineering.
  example_title: 3rd Mit Article
- text: >-
    Microsoft is opening a new office in London dedicated to artificial
    intelligence (AI) research and development. The tech firm's AI boss Mustafa
    Suleyman said it will advertise roles for exceptional individuals in the
    coming weeks and months. But he has not said how many jobs will be created.
    Microsoft is a major investor in ChatGPT-creator OpenAI, which itself opened
    an office in London in 2023. There is an enormous pool of AI talent and
    expertise in the UK, said Mr Suleyman in a blog post. Microsoft AI plans to
    make a significant, long-term investment in the region as we begin hiring
    the best AI scientists and engineers into this new AI hub. Mr Suleyman
    co-founded AI research lab DeepMind in the UK, which was bought by Google in
    2014.
  example_title: 4th Microsoft
- text: >-
    OpenAI, Google, and the French artificial intelligence startup Mistral have
    all released new versions of their frontier AI models within 12 hours of one
    another, as the industry prepares for a burst of activity over the summer.
    The unprecedented flurry of releases come as the sector readies for the
    expected launch of the next major version of GPT, the system that underpins
    OpenAI’s hit chatbot Chat-GPT. The first came only hours after Nick Clegg
    appeared on stage at an event in London, where he confirmed reports that the
    third version of Meta’s own AI model, Llama, would be published in a matter
    of weeks.
  example_title: 5th LLM Release
- text: >-
    French AI startup Mistral on Tuesday released Mixtral 8x22B, a new large
    language model (LLM) and its latest attempt. Mixtral 8x22B is expected to
    outperform Mistral's previous Mixtral 8x7B LLM, which itself showed signs of
    outshining OpenAI's GPT-3.5 and Meta's Llama 2, according to Gigazine. The
    new Mixtral model boasts a 65,000-token context window, which refers to the
    amount of text that an AI model can process and reference at one time.
    Further, Mixtral 8x22B has a parameter size of up to 176 billion, a
    reference to the number of internal variables that the model uses to make
    decisions or predictions.
  example_title: 6th Mixtral 8x22B
---

# News Title(Headline) Generator 📰

This document details the development of our innovative News Title Generator, designed to produce compelling and informative titles for your news articles.
Check the Live Demo [Here](https://exnrt.com/news-title-generator/).

I've tested several other news headline generators on Hugging Face and across the internet, and I can confidently say that this one is the best. 🤗

## Model Architecture:

* **Foundation:** The T5 base model from the Transformers library is our title generator's foundation. This powerful pre-trained model is adept at various text-to-text tasks, making it an ideal choice for our application.
* **Fine-Tuning:** To optimize performance specifically for news title generation, we fine-tuned the T5 base model on a curated dataset from Hugging Face [https://huggingface.co/datasets/Ateeqq/news-title-generator](https://huggingface.co/datasets/Ateeqq/news-title-generator). This dataset consists of over 78,000 training examples, ensuring the model learns the nuances and structure of effective news titles.

## How to use?

```python
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM

tokenizer = AutoTokenizer.from_pretrained("Ateeqq/news-title-generator")
model = AutoModelForSeq2SeqLM.from_pretrained("Ateeqq/news-title-generator")
```
```python
def generate_title(input_text):

  input_ids = tokenizer.encode(input_text, return_tensors="pt")
  output = model.generate(input_ids)
  decoded_text = tokenizer.decode(output[0], skip_special_tokens=True)
  return decoded_text

input_text = """Microsoft is opening a new office in London dedicated to artificial
    intelligence (AI) research and development. The tech firm's AI boss Mustafa
    Suleyman said it will advertise roles for exceptional individuals in the
    coming weeks and months. But he has not said how many jobs will be created.
    Microsoft is a major investor in ChatGPT-creator OpenAI, which itself opened
    an office in London in 2023."""
generated_title = generate_title(input_text)

print(generated_title)
```
## Output
```
Microsoft to open new London office dedicated to AI research
```


## Technical Specifications

* **Framework:** PyTorch, a popular deep learning framework, provides the foundation for our model's development and execution.
* **Dataset Split:** The training data is strategically divided into two sets: 78,720 examples for training and 19,681 examples for testing. This split ensures the model is adequately trained while reserving a portion for evaluating its generalizability.
* **Model Parameters:** The fine-tuned model boasts 223 million trainable parameters, allowing it to capture the intricate relationships between text elements that contribute to strong news titles.

## Training Configuration

* **Batch Size:** 8
* **Maximum Epochs:** The training process iterates through the entire dataset three times (epochs) to ensure thorough learning.
* **Global Seed:** A fixed random seed (42) is set to guarantee reproducibility of training results.
* **Token Length Limits:** The source text (article content) is restricted to a maximum of 128 tokens, while the generated titles are capped at 50 tokens.

## Key Takeaways

Our News Title Generator leverages the power of the T5 base model, fine-tuned on a comprehensive news title dataset, to deliver exceptional results. The model's architecture and training configuration are meticulously designed to produce high-quality, informative titles within an appropriate character length. This tool empowers creators and journalists to craft impactful headlines that effectively capture readers' attention.

Contact us (at [exnrt.com/contact-us](https://exnrt.com/contact-us/)) today to learn more about integrating the News Title Generator into your editorial workflow and unlock the full potential of AI-driven journalism.