AventIQ-AI / Roberta-Base-News-Classification

huggingface.co
Total runs: 17
24-hour runs: 0
7-day runs: 7
30-day runs: 10
Model's Last Updated: March 02 2025

Introduction of Roberta-Base-News-Classification

Model Details of Roberta-Base-News-Classification

Here's your model card based on the example you provided:


RoBERTa-Base for News Classification (FP16 Quantized)

This is a RoBERTa-Base model fine-tuned on the AG News dataset for text classification. It categorizes news articles into one of four classes: World, Sports, Business, and Science/Technology . The model has been further quantized to FP16 for improved inference speed and reduced memory usage, making it efficient for deployment on resource-constrained environments.


Model Details
Model Description
  • Model Type: Transformer-based text classifier
  • Base Model: roberta-base
  • Fine-Tuned Dataset: AG News
  • Maximum Sequence Length: 512 tokens
  • Output: One of four news categories
  • Task: Text classification

Full Model Architecture
RobertaForSequenceClassification(
  (roberta): RobertaModel(
    (embeddings): RobertaEmbeddings(...)
    (encoder): RobertaEncoder(...)
  )
  (classifier): RobertaClassificationHead(
    (dense): Linear(in_features=768, out_features=768, bias=True)
    (dropout): Dropout(p=0.1)
    (out_proj): Linear(in_features=768, out_features=4, bias=True)
  )
)

Usage Instructions
Installation
pip install -U transformers torch
Loading the Model for Inference
from transformers import RobertaForSequenceClassification, RobertaTokenizer
import torch

# Load the model and tokenizer
model_name = "AventIQ-AI/Roberta-Base-News-Classification"  # Update with your model ID
tokenizer = RobertaTokenizer.from_pretrained(model_name)
model = RobertaForSequenceClassification.from_pretrained(model_name)

# Move to GPU if available
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device)

# Function to predict category
def predict(text):
    inputs = tokenizer(text, return_tensors="pt", padding="max_length", truncation=True, max_length=512).to(device)
    with torch.no_grad():
        outputs = model(**inputs)
    logits = outputs.logits
    predicted_class = torch.argmax(logits, dim=1).item()
    class_labels = {0: "World", 1: "Sports", 2: "Business", 3: "Science/Technology"}
    return class_labels[predicted_class]

# Example usage
custom_text = "Stock prices are rising due to global economic recovery."
predicted_label = predict(custom_text)
print(f"Predicted Category: {predicted_label}")

Training Details
Training Dataset
  • Name: AG News
  • Size: 50,000 training samples, 7,600 test samples
  • Labels:
    • 0: World
    • 1: Sports
    • 2: Business
    • 3: Science/Technology

Training Hyperparameters
Non-Default Hyperparameters:
  • per_device_train_batch_size: 8
  • per_device_eval_batch_size: 8
  • gradient_accumulation_steps: 2 (effective batch size = 16)
  • num_train_epochs: 3
  • learning_rate: 2e-5
  • fp16: True (for reduced memory footprint and faster inference)
  • weight_decay: 0.01
  • optimizer: AdamW

Model Performance
Metric Score
Accuracy 94.3%
F1 Score 94.1%
Precision 94.5%
Recall 94.2%

(Update these values based on your actual evaluation results.)


Quantization Details
  • The model has been quantized to FP16 to reduce its size and improve inference speed.
  • FP16 quantization provides a 2x reduction in memory while maintaining similar accuracy.

Limitations & Considerations
  • The model is trained on AG News and may not generalize well to other domains such as medical, legal, or entertainment news.
  • Due to FP16 quantization , there might be a minor loss in precision, but inference speed is significantly improved.
  • The model is not intended for real-time misinformation detection —it only classifies text based on its most probable category.

Runs of AventIQ-AI Roberta-Base-News-Classification on huggingface.co

17
Total runs
0
24-hour runs
8
3-day runs
7
7-day runs
10
30-day runs

More Information About Roberta-Base-News-Classification huggingface.co Model

Roberta-Base-News-Classification huggingface.co

Roberta-Base-News-Classification huggingface.co is an AI model on huggingface.co that provides Roberta-Base-News-Classification's model effect (), which can be used instantly with this AventIQ-AI Roberta-Base-News-Classification model. huggingface.co supports a free trial of the Roberta-Base-News-Classification model, and also provides paid use of the Roberta-Base-News-Classification. Support call Roberta-Base-News-Classification model through api, including Node.js, Python, http.

Roberta-Base-News-Classification huggingface.co Url

https://huggingface.co/AventIQ-AI/Roberta-Base-News-Classification

AventIQ-AI Roberta-Base-News-Classification online free

Roberta-Base-News-Classification huggingface.co is an online trial and call api platform, which integrates Roberta-Base-News-Classification's modeling effects, including api services, and provides a free online trial of Roberta-Base-News-Classification, you can try Roberta-Base-News-Classification online for free by clicking the link below.

AventIQ-AI Roberta-Base-News-Classification online free url in huggingface.co:

https://huggingface.co/AventIQ-AI/Roberta-Base-News-Classification

Roberta-Base-News-Classification install

Roberta-Base-News-Classification is an open source model from GitHub that offers a free installation service, and any user can find Roberta-Base-News-Classification on GitHub to install. At the same time, huggingface.co provides the effect of Roberta-Base-News-Classification install, users can directly use Roberta-Base-News-Classification installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

Roberta-Base-News-Classification install url in huggingface.co:

https://huggingface.co/AventIQ-AI/Roberta-Base-News-Classification

Url of Roberta-Base-News-Classification

Roberta-Base-News-Classification huggingface.co Url

Provider of Roberta-Base-News-Classification huggingface.co

AventIQ-AI
ORGANIZATIONS

Other API from AventIQ-AI

huggingface.co

Total runs: 18
Run Growth: 14
Growth Rate: 77.78%
Updated:February 17 2025