Views
No views yet
philschmid/bart-large-cnn-samsum finetune), it is specifically designed to extract perspectives from textual data at scale. The model provides an in-depth analysis of the speaker's identity, their emotions, the object of these emotions, and the reason behind these emotions.perspectives library:1from perspectives import DataFrame
2
3# Load DataFrame
4df = DataFrame(texts = [list of sentences])
5
6# Get perspectives
7df.get_perspectives()
8
9# Search
10df.search(speaker='...', emotion='...')1from transformers import pipeline
2
3# Load the model
4generator = pipeline('text-generation', model='helliun/bart-perspectives')
5
6# Get perspective
7perspective = generator("Describe the perspective of this text: <your text>", max_length=1024, do_sample=False)
8print(perspective)transformers.AutoTokenizer and transformers.AutoModelForSeq2SeqLM:1from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
2
3# Load the model
4tokenizer = AutoTokenizer.from_pretrained("helliun/bart-perspectives")
5model = AutoModelForSeq2SeqLM.from_pretrained("helliun/bart-perspectives")
6
7# Tokenize the sentence
8inputs = tokenizer.encode("Describe the perspective for this sentence: <your text>", return_tensors='pt')
9
10# Pass the tensor through the model
11results = model.generate(inputs)
12
13# Decode the results
14decoded = tokenizer.decode(results[:,0])
15print(decoded)mteb/tweet-sentiment-extraction dataset with emotional analyses generated synthetically by GPT-4.