Downloads · 30 days
266
3% of all-time downloads
RichardErkhov/Iker_-_ClickbaitFighter-2B-gguf
Iker_-_ClickbaitFighter-2B-gguf is a machine learning model from RichardErkhov. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Downloads · 30 days
266
3% of all-time downloads
All-time downloads
7.9K
Public
Repo size
30.7 GB
Likes
0
Public
Click a slice to open those files.
.gguf35.6 GB · 100%
From the Hugging Face model README
Quantization made by Richard Erkhov.
ClickbaitFighter-2B - GGUF
| Name | Quant method | Size |
|---|---|---|
| ClickbaitFighter-2B.Q2_K.gguf | Q2_K | 1.08GB |
| ClickbaitFighter-2B.IQ3_XS.gguf | IQ3_XS | 1.16GB |
| ClickbaitFighter-2B.IQ3_S.gguf | IQ3_S | 1.2GB |
| ClickbaitFighter-2B.Q3_K_S.gguf | Q3_K_S | 1.2GB |
| ClickbaitFighter-2B.IQ3_M.gguf | IQ3_M | 1.22GB |
| ClickbaitFighter-2B.Q3_K.gguf | Q3_K | 1.29GB |
| ClickbaitFighter-2B.Q3_K_M.gguf | Q3_K_M | 1.29GB |
| ClickbaitFighter-2B.Q3_K_L.gguf | Q3_K_L | 1.36GB |
| ClickbaitFighter-2B.IQ4_XS.gguf | IQ4_XS | 1.4GB |
| ClickbaitFighter-2B.Q4_0.gguf | Q4_0 | 1.44GB |
| ClickbaitFighter-2B.IQ4_NL.gguf | IQ4_NL | 1.45GB |
| ClickbaitFighter-2B.Q4_K_S.gguf | Q4_K_S | 1.45GB |
| ClickbaitFighter-2B.Q4_K.gguf | Q4_K | 1.52GB |
| ClickbaitFighter-2B.Q4_K_M.gguf | Q4_K_M | 1.52GB |
| ClickbaitFighter-2B.Q4_1.gguf | Q4_1 | 1.56GB |
| ClickbaitFighter-2B.Q5_0.gguf | Q5_0 | 1.68GB |
| ClickbaitFighter-2B.Q5_K_S.gguf | Q5_K_S | 1.68GB |
| ClickbaitFighter-2B.Q5_K.gguf | Q5_K | 1.71GB |
| ClickbaitFighter-2B.Q5_K_M.gguf | Q5_K_M | 1.71GB |
| ClickbaitFighter-2B.Q5_1.gguf | Q5_1 | 1.79GB |
| ClickbaitFighter-2B.Q6_K.gguf | Q6_K | 1.92GB |
| ClickbaitFighter-2B.Q8_0.gguf | Q8_0 | 2.49GB |
license: cc-by-nc-sa-4.0 datasets:
A model finetuned with the NoticIA Dataset. This model can generate summaries of clickbait headlines
If you are looking for a larger model, with better performance, check out ClickbaitFighter-10B.
import torch # pip install torch
from newspaper import Article #pip3 install newspaper3k
from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig # pip install transformers
article_url ="https://www.huffingtonpost.es/virales/le-compra-abrigo-abuela-97nos-reaccion-fantasia.html"
article = Article(article_url)
article.download()
article.parse()
headline=article.title
body = article.text
def prompt(
headline: str,
body: str,
) -> str:
"""
Generate the prompt for the model.
Args:
headline (`str`):
The headline of the article.
body (`str`):
The body of the article.
Returns:
`str`: The formatted prompt.
"""
return (
f"Ahora eres una Inteligencia Artificial experta en desmontar titulares sensacionalistas o clickbait. "
f"Tu tarea consiste en analizar noticias con titulares sensacionalistas y "
f"generar un resumen de una sola frase que revele la verdad detrás del titular.\n"
f"Este es el titular de la noticia: {headline}\n"
f"El titular plantea una pregunta o proporciona información incompleta. "
f"Debes buscar en el cuerpo de la noticia una frase que responda lo que se sugiere en el título. "
f"Siempre que puedas cita el texto original, especialmente si se trata de una frase que alguien ha dicho. "
f"Si citas una frase que alguien ha dicho, usa comillas para indicar que es una cita. "
f"Usa siempre las mínimas palabras posibles. No es necesario que la respuesta sea una oración completa. "
f"Puede ser sólo el foco de la pregunta. "
f"Recuerda responder siempre en Español.\n"
f"Este es el cuerpo de la noticia:\n"
f"{body}\n"
)
prompt = prompt(headline=headline, body=body)
tokenizer = AutoTokenizer.from_pretrained("Iker/ClickbaitFighter-2B")
model = AutoModelForCausalLM.from_pretrained(
"Iker/ClickbaitFighter-2B", torch_dtype=torch.bfloat16, device_map="auto"
)
formatted_prompt = tokenizer.apply_chat_template(
[{"role": "user", "content": prompt}],
tokenize=False,
add_generation_prompt=True,
)
model_inputs = tokenizer(
[formatted_prompt], return_tensors="pt", add_special_tokens=False
)
model_output = model.generate(**model_inputs.to(model.device), generation_config=GenerationConfig(
max_new_tokens=32,
min_new_tokens=1,
do_sample=False,
num_beams=1,
use_cache=True
))
summary = tokenizer.batch_decode(model_output,skip_special_tokens=True)[0]
print(summary.strip().split("\n")[-1]) # Get only the summary, without the prompt.
import torch # pip install torch
from datasets import load_dataset # pip install datasets
from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig # pip install transformers
dataset = load_dataset("Iker/NoticIA")
example = dataset["test"][0]
headline = example["web_headline"]
body = example["web_text"]
def prompt(
headline: str,
body: str,
) -> str:
"""
Generate the prompt for the model.
Args:
headline (`str`):
The headline of the article.
body (`str`):
The body of the article.
Returns:
`str`: The formatted prompt.
"""
return (
f"Ahora eres una Inteligencia Artificial experta en desmontar titulares sensacionalistas o clickbait. "
f"Tu tarea consiste en analizar noticias con titulares sensacionalistas y "
f"generar un resumen de una sola frase que revele la verdad detrás del titular.\n"
f"Este es el titular de la noticia: {headline}\n"
f"El titular plantea una pregunta o proporciona información incompleta. "
f"Debes buscar en el cuerpo de la noticia una frase que responda lo que se sugiere en el título. "
f"Siempre que puedas cita el texto original, especialmente si se trata de una frase que alguien ha dicho. "
f"Si citas una frase que alguien ha dicho, usa comillas para indicar que es una cita. "
f"Usa siempre las mínimas palabras posibles. No es necesario que la respuesta sea una oración completa. "
f"Puede ser sólo el foco de la pregunta. "
f"Recuerda responder siempre en Español.\n"
f"Este es el cuerpo de la noticia:\n"
f"{body}\n"
)
prompt = prompt(headline=headline, body=body)
tokenizer = AutoTokenizer.from_pretrained("Iker/ClickbaitFighter-2B")
model = AutoModelForCausalLM.from_pretrained(
"Iker/ClickbaitFighter-2B", torch_dtype=torch.bfloat16, device_map="auto"
)
formatted_prompt = tokenizer.apply_chat_template(
[{"role": "user", "content": prompt}],
tokenize=False,
add_generation_prompt=True,
)
model_inputs = tokenizer(
[formatted_prompt], return_tensors="pt", add_special_tokens=False
)
model_output = model.generate(**model_inputs.to(model.device), generation_config=GenerationConfig(
max_new_tokens=32,
min_new_tokens=1,
do_sample=False,
num_beams=1,
use_cache=True
))
summary = tokenizer.batch_decode(model_output,skip_special_tokens=True)[0]
print(summary.strip().split("\n")[-1]) # Get only the summary, without the prompt.
@misc{noticia2024,
title={NoticIA: A Clickbait Article Summarization Dataset in Spanish},
author={Iker García-Ferrero and Begoña Altuna},
year={2024},
eprint={2404.07611},
archivePrefix={arXiv},
primaryClass={cs.CL}
}