NTEE_category_tagging
37
license:apache-2.0
by
GivingTuesday
Other
OTHER
New
37 downloads
Early-stage
Edge AI:
Mobile
Laptop
Server
Unknown
Mobile
Laptop
Server
Quick Summary
AI model with specialized capabilities.
Code Examples
Example usagetexttransformers
from transformers import BertTokenizer, BertForSequenceClassification
import torch
tokenizer = BertTokenizer.from_pretrained("GivingTuesday/NTEE_category_tagging")
# OR this works too:
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("GivingTuesday/NTEE_category_tagging")
# num_labels: 28 because this will assign one of 28 NTEE codes
model = BertForSequenceClassification.from_pretrained("GivingTuesday/NTEE_category_tagging", num_labels=28)
model.eval()
# example texts
text = """NATIONAL CHURCH RESIDENCES OF SOUTH,PROVIDE HOUSING FOR LOW AND MODERATE INCOME PERSONS.,"THE SOLE PURPOSE IS TO PROVIDE ELDERLY PERSONS AND HANDICAPPED PERSONS WITH HOUSING FACILITIES AND SERVICES SPECIALLY DESIGNED TO MEET THEIR PHYSICAL, SOCIAL, AND PSYCHOLOGICAL NEEDS, AND TO PROMOTE THEIR HEALTH, SECURITY, HAPPINESS AND USEFULNESS IN LONGER LIVING, THE CHARGES FOR SUCH FACILITIES AND SERVICES TO BE PREDICATED UPON THE PROVISION, MAINTENANCE, AND OPERATION THEREOF ON A NONPROFIT BASIS."""
text = """NORTH CAROLINAS EASTERN ALLIANCE,"TO PROMOTE AND ENCOURAGE ECONOMIC DEVELOPMENT WITHIN EASTERN NORTH CAROLINA BY FOSTERING DEVELOPMENT PROJECTS TO PROVIDE LAND, BUILDINGS, FACILITIES, PROGRAMS, INFORMATION AND DATA SYSTEMS, AND INFRASTRUCTURE REQUIREMENTS FOR BUSINESS AND INDUSTRY WITHIN EASTERN NORTH CAROLINA.","HELPS TO RECRUIT NEW BUSINESSES INTO THE REGION, AS WELL AS HELP EXPAND EXISTING BUSINESSES BY ASSISTING WITH SITE LOCATIONS AND GRANTS. THEY ALSO WORK WITH THE LOCAL COMMUNITY COLLEGES TO EDUCATE THE CITIZENS OF THE REGION SO TO MAKE THE AREA MORE APPEALING TO POTENTIAL NEW BUSINESSES."""
inputs = tokenizer(text, return_tensors="pt")
#encoded_output = tokenizer.encode(text)
#print(tokenizer.convert_ids_to_tokens(encoded_output))
with torch.no_grad():
output = model(**inputs)
probabilities = torch.softmax(output.logits, dim=1)
predicted_class_index = torch.argmax(output.logits, dim=1)
predicted_label = model2.config.id2label[predicted_class_index.item()]
print(predicted_label)Deploy This Model
Production-ready deployment in minutes
Together.ai
Instant API access to this model
Production-ready inference API. Start free, scale to millions.
Try Free APIReplicate
One-click model deployment
Run models in the cloud with simple API. No DevOps required.
Deploy NowDisclosure: We may earn a commission from these partners. This helps keep LLMYourWay free.