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
Safetensors
Model size
67M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for CXu0630/poster-font-classifier

Finetuned
(12531)
this model