Instructions to use Terrificfantasm/bert-base-agnews-delivered with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Terrificfantasm/bert-base-agnews-delivered with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="Terrificfantasm/bert-base-agnews-delivered")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("Terrificfantasm/bert-base-agnews-delivered") model = AutoModelForSequenceClassification.from_pretrained("Terrificfantasm/bert-base-agnews-delivered", device_map="auto") - Notebooks
- Google Colab
- Kaggle
AG News topic classification
Selected method: full_finetuning, epoch 3. The choice was fixed on validation data before test evaluation. This is a measured academic adaptation of BERT, not a production-validated system.
Training data and evaluation
12,000 training / 2,000 internal validation / 2,000 test texts. Stratified subsets; 161 duplicate official-train rows removed before sampling. Test uses the official test split.
Validation macro-F1; test accuracy and macro-F1.
BERT pooled output and a linear four-class head. Truncate inputs to 128 tokens.
The table preserves native scales: AG News, NER and POS metrics are in [0, 1]; QA EM/F1 are in [0, 100]. Training seconds exclude validation, saving and final evaluation.
| method | best_epoch | trainable_parameters | train_seconds | test_accuracy | test_macro_f1 |
|---|---|---|---|---|---|
| feature_based | 3 | 3076 | 91.783473 | 0.769000 | 0.768263 |
| full_finetuning | 3 | 109485316 | 309.044172 | 0.925000 | 0.925091 |
Optimization and reproducibility
Three epochs, seed 42. AdamW: head LR 1e-3, trainable encoder LR 2e-5, weight decay 0.01, 10% linear warmup, clipping 1.0. Effective batch size 32. A partial method trains only the last two encoder layers and head; lower layers are frozen in evaluation mode. Frozen weights were checked for invariance. Full fine-tuning updates all parameters.
Base model revision: 86b5e0934494bd15c9632b12f734a8a67f723594. Dataset revision: eb185aade064a813bc0b7f42de02595523103ca4. Detailed configuration is in training_config.json; the complete comparison is in evaluation.json. The included experiment source and requirements-lock.txt document the original environment. Use a new output directory when reproducing. QA source includes the documented UTF-8 JSON read fix; it did not change any training weights.
Only one seed was evaluated. Small gaps may reflect initialization, dropout and ordering variability; no statistical significance is claimed. Training hardware: RTX 4060 Ti, CUDA bf16. Training runtime is not inference latency.
Intended use and limitations
English news classification into World, Sports, Business, Sci/Tech.
Inputs beyond 128 tokens are truncated. No evaluation on Spanish, other domains or other taxonomies.
Loading the delivered model
from transformers import pipeline
model = pipeline('text-classification', model='Terrificfantasm/bert-base-agnews-delivered')
print(model('The team won the final match.', truncation=True, max_length=128))
Source terms and references
The upstream BERT checkpoints identify Apache-2.0 licensing. AG News card currently lists the dataset license as unknown. Dataset terms are separate from the base checkpoint license. This repository does not redistribute the training corpus. It preserves upstream attribution without asserting a new blanket license over all data sources.
- Base checkpoint: https://huggingface.co/google-bert/bert-base-uncased
- Data source: https://huggingface.co/datasets/fancyzhx/ag_news
- Devlin et al., BERT: https://arxiv.org/abs/1810.04805
- Transformers training: https://huggingface.co/docs/transformers/training
- Downloads last month
- 12
Model tree for Terrificfantasm/bert-base-agnews-delivered
Base model
google-bert/bert-base-uncased