Text Classification
Transformers
Safetensors
distilbert
poster-fonts
single-label
text-embeddings-inference
Instructions to use CXu0630/poster-font-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CXu0630/poster-font-classifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="CXu0630/poster-font-classifier")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("CXu0630/poster-font-classifier") model = AutoModelForSequenceClassification.from_pretrained("CXu0630/poster-font-classifier", device_map="auto") - Notebooks
- Google Colab
- Kaggle
poster-font-classifier
Fine-tuned distilbert-base-uncased that maps a natural-language poster brief to
a font ('Font' column), for poster font recommendation.
- Task: single-label (softmax) text classification
- Labels (15): Avenir, Baskerville, Bebas Neue, Comic Sans MS, Courier New, Futura, Garamond, Helvetica, Impact, Lobster, Montserrat, Papyrus, Playfair Display, Roboto, Times New Roman
- Training data: 788 train / 198 validation examples
- Hyperparameters: 5 epochs, lr 5e-05, batch size 16, max length 128
Validation metrics
| metric | value |
|---|---|
| accuracy | 0.8939 |
| f1_macro | 0.8937 |
Usage
import json, torch
from huggingface_hub import hf_hub_download
from transformers import AutoModelForSequenceClassification, AutoTokenizer
repo = "CXu0630/poster-font-classifier"
tokenizer = AutoTokenizer.from_pretrained(repo)
model = AutoModelForSequenceClassification.from_pretrained(repo).eval()
cfg = json.load(open(hf_hub_download(repo, "inference_config.json")))
enc = tokenizer(["retro jazz night poster"], truncation=True, max_length=cfg["max_len"], return_tensors="pt")
with torch.no_grad():
logits = model(**enc).logits
probs = torch.softmax(logits, -1)[0]
print(sorted(((model.config.id2label[i], float(p)) for i, p in enumerate(probs)), key=lambda x: -x[1]))
- Downloads last month
- 24
Model tree for CXu0630/poster-font-classifier
Base model
distilbert/distilbert-base-uncased