helliun/bart-perspectives
215
1---2license: mit3datasets:4- mteb/tweet_sentiment_extraction5language:6- en7library_name: transformers8---9# bart-perspectives10 11## Overview12 13The BART-perspectives model is a sequence-to-sequence transformers mode;. Built on top of Facebook's BART-large (specifically the `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.14 15## Usage16 17It is designed to be used with the `perspectives` library:18 19```python20from perspectives import DataFrame21 22# Load DataFrame23df = DataFrame(texts = [list of sentences]) 24 25# Get perspectives26df.get_perspectives()27 28# Search29df.search(speaker='...', emotion='...')30```31 32You can use also this model directly with a pipeline for text generation:33 34```python35from transformers import pipeline36 37# Load the model38generator = pipeline('text-generation', model='helliun/bart-perspectives')39 40# Get perspective41perspective = generator("Describe the perspective of this text: <your text>", max_length=1024, do_sample=False)42print(perspective)43```44You can also use it with `transformers.AutoTokenizer` and `transformers.AutoModelForSeq2SeqLM`:45 46```python47from transformers import AutoTokenizer, AutoModelForSeq2SeqLM48 49# Load the model50tokenizer = AutoTokenizer.from_pretrained("helliun/bart-perspectives")51model = AutoModelForSeq2SeqLM.from_pretrained("helliun/bart-perspectives")52 53# Tokenize the sentence54inputs = tokenizer.encode("Describe the perspective for this sentence: <your text>", return_tensors='pt')55 56# Pass the tensor through the model57results = model.generate(inputs)58 59# Decode the results60decoded = tokenizer.decode(results[:,0])61print(decoded)62```63 64## Training65 66The model was fine-tuned on a subset of the `mteb/tweet-sentiment-extraction` dataset with emotional analyses generated synthetically by GPT-4.67 68## About me69 70I'm a recent grad of Ohio State University where I did an undergraduate thesis on Synthetic Data Augmentation using LLMs. I've worked as an NLP consultant for a couple awesome startups, and now I'm looking for a role with an inspiring company who is as interested in the untapped potential of LMs as I am! [Here's my LinkedIn.](https://www.linkedin.com/in/henry-leonardi-a63851165/)71 72## Contributing and Support73 74Please raise an issue here if you encounter any problems using the model. Contributions like fine-tuning on additional data or improving the model architecture are always welcome!75 76[Buy me a coffee!](https://www.buymeacoffee.com/helliun)77 78## License79 80The model is open source and free to use under the MIT license.