This repository hosts a fine-tuned
GPT-2-based
model optimized for
book and article recommendations
. The model suggests relevant books and articles based on input alphabets or keywords.
import torch
defrecommend_titles(model, tokenizer, alphabet, num_recommendations=5):
device = "cuda"if torch.cuda.is_available() else"cpu"
input_text = alphabet
input_ids = tokenizer.encode(input_text, return_tensors="pt").to(device)
with torch.no_grad():
outputs = model.generate(input_ids, max_length=15, num_return_sequences=num_recommendations, do_sample=True)
return [tokenizer.decode(output, skip_special_tokens=True) for output in outputs]
# 🔹 **Test with an Alphabet**
alphabet = "A"
recommended_titles = recommend_titles(model, tokenizer, alphabet, num_recommendations=5)
print(f"Alphabet: {alphabet}")
print("Recommended Titles:", recommended_titles)
📊 Evaluation Results
After fine-tuning, the model was evaluated on the article-name dataset, achieving the following performance:
Metric
Score
Meaning
Accuracy
89.2%
Percentage of correctly suggested titles
Diversity
High
Generates a wide variety of titles
🔧 Fine-Tuning Details
Dataset
The
Arbaz0348/article-name-dataset
dataset was used for training and evaluation. The dataset consists of
titles from books and articles
.
Training Configuration
Number of epochs
: 6
Batch size
: 8
Optimizer
: AdamW
Learning rate
: 3e-5
Evaluation strategy
: Epoch-based
Quantization
The model was quantized using
int8 dynamic quantization
, reducing latency and memory usage while maintaining accuracy.
📂 Repository Structure
.
├── model/ # Contains the fine-tuned model files
├── tokenizer_config/ # Tokenizer configuration and vocabulary files
├── quantized_model/ # Quantized Model
├── README.md # Model documentation
⚠️ Limitations
The model may generate
similar-sounding titles
at times.
Context understanding
is limited due to short input constraints.
Quantization
may slightly affect accuracy compared to the full-precision model.
Runs of AventIQ-AI gpt2-book-article-recommendation on huggingface.co
8
Total runs
-1
24-hour runs
-1
3-day runs
-1
7-day runs
2
30-day runs
More Information About gpt2-book-article-recommendation huggingface.co Model
gpt2-book-article-recommendation huggingface.co
gpt2-book-article-recommendation huggingface.co is an AI model on huggingface.co that provides gpt2-book-article-recommendation's model effect (), which can be used instantly with this AventIQ-AI gpt2-book-article-recommendation model. huggingface.co supports a free trial of the gpt2-book-article-recommendation model, and also provides paid use of the gpt2-book-article-recommendation. Support call gpt2-book-article-recommendation model through api, including Node.js, Python, http.
gpt2-book-article-recommendation huggingface.co is an online trial and call api platform, which integrates gpt2-book-article-recommendation's modeling effects, including api services, and provides a free online trial of gpt2-book-article-recommendation, you can try gpt2-book-article-recommendation online for free by clicking the link below.
AventIQ-AI gpt2-book-article-recommendation online free url in huggingface.co:
gpt2-book-article-recommendation is an open source model from GitHub that offers a free installation service, and any user can find gpt2-book-article-recommendation on GitHub to install. At the same time, huggingface.co provides the effect of gpt2-book-article-recommendation install, users can directly use gpt2-book-article-recommendation installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
gpt2-book-article-recommendation install url in huggingface.co: