4nkh/theme_data
Viewer • Updated • 150 • 11
How to use 4nkh/theme_model with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="4nkh/theme_model") # Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("4nkh/theme_model")
model = AutoModelForSequenceClassification.from_pretrained("4nkh/theme_model")This repository contains a fine-tuned BERT model for classifying short texts into community-oriented themes. The model was trained locally and pushed to the Hugging Face Hub.
Model details
mentorship, entrepreneurship, startup successtrain_theme.jsonl (included)Usage
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
repo = "4nkh/theme_model"
tokenizer = AutoTokenizer.from_pretrained(repo)
model = AutoModelForSequenceClassification.from_pretrained(repo)
texts = ["Our co-op paired first-time founders with veteran shop owners to troubleshoot setbacks."]
inputs = tokenizer(texts, truncation=True, padding=True, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
probs = torch.sigmoid(logits)
preds = (probs >= 0.5).int()
print('probs', probs.numpy(), 'preds', preds.numpy())
Notes
train_theme_model.py in this folder.License
Specify your license here (e.g., Apache-2.0) or remove this section if you prefer a different license.
Base model
google-bert/bert-base-uncased