fancyzhx/ag_news
Viewer • Updated • 128k • 119k • 190
How to use starkdv123/agnews-distilbert-lora with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="starkdv123/agnews-distilbert-lora") # Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("starkdv123/agnews-distilbert-lora", dtype="auto")How to use starkdv123/agnews-distilbert-lora with PEFT:
Task type is invalid.
This repository contains LoRA adapter weights trained on AG News for DistilBERT.
| Model | Test Accuracy | Macro F1 |
|---|---|---|
| LoRA (merged) | 0.9400 | 0.9400 |
World Sports Busines Sci/Tec
World 1791 14 49 46
Sports 12 1874 9 5
Busines 42 8 1718 132
Sci/Tec 30 9 100 1761
from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
from peft import PeftModel
base = "distilbert-base-uncased"
adapter = "starkdv123/agnews-distilbert-lora"
tok = AutoTokenizer.from_pretrained(base)
base_model = AutoModelForSequenceClassification.from_pretrained(base, num_labels=4)
model = PeftModel.from_pretrained(base_model, adapter)
clf = pipeline("text-classification", model=model, tokenizer=tok, truncation=True)
clf(["New AI chip announced for smartphones."])
Karan D Vasa — https://huggingface.co/starkdv123