sngwon commited on
Commit
8ed9cdb
·
verified ·
1 Parent(s): b01b1b9

Create README.md

Browse files

# Model: PersonalityClassifier

## Model Details

* **Model Type:** PersonalityClassifier is a fine-tuned model from `google/flan-t5-xl` using annotation data for personality classification.
* **Model Date:** PersonalityClassifier was trained in Jan 2024.
* **Paper or resources for more information:** [https://arxiv.org/abs/2504.06868](https://arxiv.org/abs/2504.06868)

## Requirements

* `torch==2.1.0`
* `transformers==4.29.0`

## How to use the model

```python
import torch
from transformers import T5ForConditionalGeneration, AutoTokenizer

# Set device to CUDA if available, otherwise use CPU
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

# Load model and tokenizer
model_name = "mirlab/PersonalityClassifier"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = T5ForConditionalGeneration.from_pretrained(model_name).to(device)

# Define model inference function
def modelGenerate(input_text, lm, tokenizer):
# Tokenize input text and move to device
input_ids = tokenizer(input_text, truncation=True, padding=True, return_tensors='pt')['input_ids'].to(device)

# Generate text using the model
model_output = lm.generate(input_ids)

# Decode generated tokens into text
model_answer = tokenizer.batch_decode(model_output, skip_special_tokens=True)

return model_answer

# Example input text
# Format: "[Valence] Statement: [Your Statement]. Trait: [Target Trait]"
# Target Trait is among ["Openness", "Conscientiousness", "Extraversion", "Agreeableness", "Neuroticism", "Machiavellianism", "Narcissism", "Psychopathy"].
# Valence indicates positive (+) or negative (-) alignment with the trait.

input_texts = "[Valence] Statement: I am outgoing. Trait: Extraversion"

# Generate output using the model and print
output_texts = modelGenerate(input_texts, model, tokenizer)
print(output_texts)

Files changed (1) hide show
  1. README.md +10 -0
README.md ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: afl-3.0
3
+ language:
4
+ - en
5
+ base_model:
6
+ - google/flan-t5-xl
7
+ pipeline_tag: text-classification
8
+ tags:
9
+ - personality
10
+ ---