Run this model with HF Jobs
Run Minej/bert-base-personality on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/Minej/bert-base-personality. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/Minej/bert-base-personality on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use Minej/bert-base-personality with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Minej/bert-base-personality with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="Minej/bert-base-personality")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("Minej/bert-base-personality") model = AutoModelForSequenceClassification.from_pretrained("Minej/bert-base-personality", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
Why do prediction results have negative values?
from transformers import BertTokenizer, BertForSequenceClassification
def personality_detection(text):
tokenizer = BertTokenizer.from_pretrained(pretrained_model_name_or_path = "personality-bert-base")
model = BertForSequenceClassification.from_pretrained(pretrained_model_name_or_path = "personality-bert-base")
inputs = tokenizer(text, truncation=True, padding=True, return_tensors="pt")
outputs = model(**inputs)
predictions = outputs.logits.squeeze().detach().numpy()
label_names = ['Extroversion', 'Neuroticism', 'Agreeableness', 'Conscientiousness', 'Openness']
result = {label_names[i]: predictions[i] for i in range(len(label_names))}
return result
text = "I am feeling excited about the upcoming event"
result = personality_detection(text)
print(result)
{'Extroversion': -0.58424836, 'Neuroticism': 0.10371539, 'Agreeableness': -0.15687147, 'Conscientiousness': -0.78882587, 'Openness': -0.5310378}
I got same result with the negative output.
I also got the negative number even thought I do the sample which shown the README
I've got the positive number by using the model installed local
Same, is it necessary to pass the output to a sigmoid or softmax?
Yes according to the example provided, a sigmoid function is applied.
pred_label = torch.sigmoid(b_logit_pred)
Not sure if they added this to the model card recently.