jppgks/twitter-financial-news-sentiment
zeroshot/twitter-financial-news-sentiment prepared for LLM fine-tuning by adding an instruction column and mapping the label from numeric to string ({0:"negative", 1:'positive', 2:'neutral'}). Source from datasets import load_dataset import datasets from huggingface_hub import notebook_login notebook_login() ds = load_dataset('zeroshot/twitter-financial-news-sentiment') num_to_label = { 0: 'negative', 1: 'positive', 2: 'neutral', } instruction = 'What is the sentiment of this… See the full description on the dataset page: https://huggingface.co/datasets/jppgks/twitter-financial-news-sentiment.
zeroshot/twitter-financial-news-sentiment prepared for LLM fine-tuning by adding an instruction column and mapping the label from numeric to string ({0:"negative", 1:'positive', 2:'neutral'}).
from datasets import load_dataset
import datasets
from huggingface_hub import notebook_login
notebook_login()
ds = load_dataset('zeroshot/twitter-financial-news-sentiment')
num_to_label = {
0: 'negative',
1: 'positive',
2: 'neutral',
}
instruction = 'What is the sentiment of this tweet? Please choose an answer from {negative/neutral/positive}.'
# Training split
ds_train = ds['train']
ds_train = ds_train.to_pandas()
ds_train['label'] = ds_train['label'].apply(num_to_label.get)
ds_train['instruction'] = instruction
ds_train.columns = ['input', 'output', 'instruction']
ds_train = datasets.Dataset.from_pandas(ds_train)
ds_train.push_to_hub("twitter-financial-news-sentiment")
# Validation split
ds_valid = ds['validation']
ds_valid = ds_valid.to_pandas()
ds_valid['label'] = ds_valid['label'].apply(num_to_label.get)
ds_valid['instruction'] = instruction
ds_valid.columns = ['input', 'output', 'instruction']
ds_valid = datasets.Dataset.from_pandas(ds_valid, split='validation')
ds_valid.push_to_hub("twitter-financial-news-sentiment", split='validation')