NewsMTSC: (Multi-)Target-dependent Sentiment Classification in News Articles

Overview

NewsMTSC: (Multi-)Target-dependent Sentiment Classification in News Articles

NewsMTSC is a dataset for target-dependent sentiment classification (TSC) on news articles reporting on policy issues. The dataset consists of more than 11k labeled sentences, which we sampled from news articles from online US news outlets. More information can be found in our paper published at the EACL 2021.

This repository contains the dataset for target-dependent sentiment classification in news articles reporting on policy issues. Additionally, the repository contains our model named GRU-TSC, which achieves state-of-the-art TSC classification performance on NewsMTSC. Check it out - it works out of the box :-)

This readme consists of the following parts:

If you are only looking for the dataset, you can download it here or view it here.

To make the model available also to users without programming skills, we aimed to make the installation and using the model as easy as possible. If you face any issue with using the model or notice an issue in our dataset, you are more than welcome to open an issue.

Installation

It's super easy, we promise!

To keep things easy, we use Anaconda for setting up requirements. If you do not have it yet, follow Anaconda's installation instructions. NewsMTSC was tested on MacOS and Ubuntu; other OS may work, too. Let us know :-)

1. Setup the conda environment:

conda create --yes -n newsmtsc python=3.7
conda activate newsmtsc

2. Clone the repository:

git clone [email protected]:fhamborg/NewsMTSC.git
cd NewsMTSC

3. Install pytorch:

Choose either of the following. Either use this command if your GPU supports CUDA:

conda install --yes "pytorch=1.7.1" torchvision cudatoolkit=10.1 -c pytorch

Or use this command if your GPU does not support CUDA, you don't know what CUDA is, or if the previous command gives you an error:

conda install --yes "pytorch=1.7.1" torchvision -c pytorch

4. Install remaining packages:

=2.1,<3" conda install --yes -c anaconda requests gensim openpyxl networkx pip install "transformers>=3.1.0,<4" python -m spacy download en_core_web_sm ">
conda install --yes pandas tqdm scikit-learn
conda install --yes -c conda-forge boto3 regex sacremoses jsonlines matplotlib tabulate imbalanced-learn "spacy>=2.1,<3"
conda install --yes -c anaconda requests gensim openpyxl networkx
pip install "transformers>=3.1.0,<4"
python -m spacy download en_core_web_sm

5. Download our model:

python download.py

You're all set now :-)

Target-dependent Sentiment Classification

Target-dependent sentiment classification works out-of-the-box. Have a look at infer.py or give it a try:

python infer.py

Training

There are two entry points to the system. train.py is used to train and evaluate a specific model on a specific dataset using specific hyperparameters. We call a single run an experiment. controller.py is used to run multiple experiments automatically. This is for example useful for model selection and evaluating hundreds or thousands of combinations of models, hyperparameters, and datasets.

Running a single experiment

Goal: training a model with a user-defined (hyper)parameter combination.

train.py allows fine-grained control over the training and evaluation process, yet for most command line arguments we provide useful defaults. Two arguments are required:

  • --own_model_name (which model is used, e.g., grutsc),
  • --dataset_name (which dataset is used, e.g., newsmtsc-rw).

For more information refer to train.py and combinations_absadata_0.py. If you just want to get started quickly, the command below should work out of the box.

python train.py --own_model_name grutsc --dataset_name newsmtsc-rw

Running multiple experiments

Goal: finding the (hyper)parameter combination to train a model that achieves the best performance.

controller.py takes a set of values for each argument, creates combinations of arguments, applies conditions to remove unnecessary combinations (e.g., some arguments may only be used for a specific model), and creates a multiprocessing pool to run experiments of these argument combinations in parallel. After completion, controller.py creates a summary, which contains detailed results, including evaluation performance, of all experiments. By using createoverview.py, you can export this summary into an Excel spreadsheet.

Acknowledgements

This repository is in part based on ABSA-PyTorch. We thank Song et al. for making their excellent repository open source.

How to cite

If you use the dataset or model, please cite our paper (PDF):

@InProceedings{Hamborg2021b,
  author    = {Hamborg, Felix and Donnay, Karsten},
  title     = {NewsMTSC: (Multi-)Target-dependent Sentiment Classification in News Articles},
  booktitle = {Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics (EACL 2021)},
  year      = {2021},
  month     = {Apr.},
  location  = {Virtual Event},
}
Comments
  • Error in Google Colab

    Error in Google Colab

    Hello!

    I am trying to use the NewsSentiment package on Google Colab. After successful installation using !pip3 install NewsSentiment with the python version 3.7.12, I get an error just from using:

    from NewsSentiment import TargetSentimentClassifier
    tsc = TargetSentimentClassifier()
    
    usage: ipykernel_launcher.py [-h] [--training_mode [TRAINING_MODE]]
                                 [--own_model_name OWN_MODEL_NAME]
                                 [--dataset_name DATASET_NAME]
                                 [--data_format DATA_FORMAT]
                                 [--optimizer OPTIMIZER]
                                 [--initializer INITIALIZER]
                                 [--learning_rate LEARNING_RATE]
                                 [--dropout DROPOUT] [--l2reg L2REG]
                                 [--num_epoch NUM_EPOCH] [--batch_size BATCH_SIZE]
                                 [--log_step LOG_STEP] [--max_seq_len MAX_SEQ_LEN]
                                 [--polarities_dim POLARITIES_DIM]
                                 [--device DEVICE] [--seed SEED]
                                 [--local_context_focus LOCAL_CONTEXT_FOCUS]
                                 [--SRD SRD] [--snem SNEM] [--devmode [DEVMODE]]
                                 [--experiment_path EXPERIMENT_PATH]
                                 [--balancing BALANCING]
                                 [--spc_lm_representation SPC_LM_REPRESENTATION]
                                 [--spc_input_order SPC_INPUT_ORDER]
                                 [--use_early_stopping [USE_EARLY_STOPPING]]
                                 [--eval_only_after_last_epoch [EVAL_ONLY_AFTER_LAST_EPOCH]]
                                 [--pretrained_model_name PRETRAINED_MODEL_NAME]
                                 [--state_dict STATE_DICT]
                                 [--single_targets [SINGLE_TARGETS]]
                                 [--multi_targets [MULTI_TARGETS]] [--loss LOSS]
                                 [--targetclasses TARGETCLASSES]
                                 [--knowledgesources KNOWLEDGESOURCES [KNOWLEDGESOURCES ...]]
                                 [--is_use_natural_target_phrase_for_spc [IS_USE_NATURAL_TARGET_PHRASE_FOR_SPC]]
                                 [--default_lm DEFAULT_LM] [--run_id RUN_ID]
                                 [--coref_mode_in_training COREF_MODE_IN_TRAINING]
                                 [--logging LOGGING]
                                 [--ignore_parsing_errors [IGNORE_PARSING_ERRORS]]
                                 [--export_finetuned_model EXPORT_FINETUNED_MODEL]
    ipykernel_launcher.py: error: unrecognized arguments: -f /root/.local/share/jupyter/runtime/kernel-64f5d3e5-ff4d-4bab-b66d-cbdb4d4203f9.json
    An exception has occurred, use %tb to see the full traceback.
    
    SystemExit: 2
    

    Any idea what this can be?

    Thanks,

    Joan

    opened by joansc 6
  • last_hidden_states being string instead of Tensor

    last_hidden_states being string instead of Tensor

    21:40:47 INFO diskdict(20):__init__|: loaded DiskDict with 6726 items from knowledge/bingliuopinion/opinion_polarity.ddict
    21:40:47 INFO diskdict(20):__init__|: loaded DiskDict with 6886 items from knowledge/mpqasubjectivity/subjclueslen1-HLTEMNLP05.tff.ddict
    21:40:47 INFO diskdict(20):__init__|: loaded DiskDict with 6468 items from knowledge/nrcemolex/NRC-Emotion-Lexicon-Wordlevel-v0.92.txt.ddict
    21:40:49 INFO infer(25):__init__|: overwriting: own_model_name=None to grutsc
    21:40:49 INFO infer(25):__init__|: overwriting: default_lm=bert-base-uncased to roberta-base
    21:40:49 INFO infer(25):__init__|: overwriting: state_dict=None to grutsc
    21:40:49 INFO infer(25):__init__|: overwriting: knowledgesources=[] to nrc_emotions mpqa_subjectivity bingliu_opinion
    21:40:49 INFO train(1045):prepare_and_start_instructor|: set default language model to roberta-base
    21:40:49 INFO train(1038):post_process_arguments|: updated total number of categories to 10 with EKS nrc_emotions
    21:40:49 INFO train(1038):post_process_arguments|: updated total number of categories to 13 with EKS mpqa_subjectivity
    21:40:49 INFO train(1038):post_process_arguments|: updated total number of categories to 15 with EKS bingliu_opinion
    21:40:49 INFO train(1064):prepare_and_start_instructor|: set number of polarity classes to 3
    21:40:49 INFO train(1071):prepare_and_start_instructor|: no random seed was given, using system time
    21:40:49 INFO train(1072):prepare_and_start_instructor|: setting random seed: 1621885249
    21:40:49 INFO train(911):_setup_cuda|: cuda information
    21:40:49 INFO train(912):_setup_cuda|: scc SGE_GPU: None
    21:40:49 INFO train(913):_setup_cuda|: arg: cuda device: None
    21:40:49 INFO train(936):_setup_cuda|: using CPU
    21:40:49 INFO train(223):create_transformer_model|: creating model for weights name: roberta-base
    21:40:49 INFO train(239):create_transformer_model|: using model_path: roberta-base
    Some weights of the model checkpoint at roberta-base were not used when initializing RobertaModel: ['lm_head.bias', 'lm_head.decoder.weight', 'lm_head.dense.weight', 'lm_head.layer_norm.bias', 'lm_head.dense.bias', 'lm_head.layer_norm.weight']
    - This IS expected if you are initializing RobertaModel from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).
    - This IS NOT expected if you are initializing RobertaModel from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).
    21:40:55 INFO train(121):__init__|: initialized transformer tokenizers and models
    21:40:55 INFO train(148):__init__|: loading weights from pretrained_models/state_dicts/grutsc...
    21:40:57 INFO train(151):__init__|: done
    21:40:57 INFO train(153):__init__|: initialized own model
    21:40:57 INFO train(212):_print_args|: n_trainable_params: 153015555, n_nontrainable_params: 0
    21:40:57 INFO train(215):_print_args|: > training arguments:
    21:40:57 INFO train(217):_print_args|: >>> training_mode: False
    21:40:57 INFO train(217):_print_args|: >>> own_model_name: grutsc
    21:40:57 INFO train(217):_print_args|: >>> dataset_name: None
    21:40:57 INFO train(217):_print_args|: >>> data_format: None
    21:40:57 INFO train(217):_print_args|: >>> optimizer: adam
    21:40:57 INFO train(217):_print_args|: >>> initializer: xavier_uniform_
    21:40:57 INFO train(217):_print_args|: >>> learning_rate: 2e-05
    21:40:57 INFO train(217):_print_args|: >>> dropout: 0.1
    21:40:57 INFO train(217):_print_args|: >>> l2reg: 0.01
    21:40:57 INFO train(217):_print_args|: >>> num_epoch: 10
    21:40:57 INFO train(217):_print_args|: >>> batch_size: 64
    21:40:57 INFO train(217):_print_args|: >>> log_step: 5
    21:40:57 INFO train(217):_print_args|: >>> max_seq_len: 150
    21:40:57 INFO train(217):_print_args|: >>> polarities_dim: 3
    21:40:57 INFO train(217):_print_args|: >>> device: cpu
    21:40:57 INFO train(217):_print_args|: >>> seed: 1621885249
    21:40:57 INFO train(217):_print_args|: >>> local_context_focus: cdm
    21:40:57 INFO train(217):_print_args|: >>> SRD: 3
    21:40:57 INFO train(217):_print_args|: >>> snem: f1_macro
    21:40:57 INFO train(217):_print_args|: >>> devmode: False
    21:40:57 INFO train(217):_print_args|: >>> experiment_path: ./
    21:40:57 INFO train(217):_print_args|: >>> balancing: None
    21:40:57 INFO train(217):_print_args|: >>> spc_lm_representation: mean_last
    21:40:57 INFO train(217):_print_args|: >>> spc_input_order: text_target
    21:40:57 INFO train(217):_print_args|: >>> use_early_stopping: False
    21:40:57 INFO train(217):_print_args|: >>> eval_only_after_last_epoch: False
    21:40:57 INFO train(217):_print_args|: >>> pretrained_model_name: None
    21:40:57 INFO train(217):_print_args|: >>> state_dict: pretrained_models/state_dicts/grutsc
    21:40:57 INFO train(217):_print_args|: >>> single_targets: True
    21:40:57 INFO train(217):_print_args|: >>> multi_targets: False
    21:40:57 INFO train(217):_print_args|: >>> loss: crossentropy
    21:40:57 INFO train(217):_print_args|: >>> targetclasses: newsmtsc3
    21:40:57 INFO train(217):_print_args|: >>> knowledgesources: ('nrc_emotions', 'mpqa_subjectivity', 'bingliu_opinion')
    21:40:57 INFO train(217):_print_args|: >>> is_use_natural_target_phrase_for_spc: False
    21:40:57 INFO train(217):_print_args|: >>> default_lm: roberta-base
    21:40:57 INFO train(217):_print_args|: >>> run_id: 0
    21:40:57 INFO train(217):_print_args|: >>> coref_mode_in_training: ignore
    21:40:57 INFO train(217):_print_args|: >>> base_path: /home/moritz/Documents/Hiwi/NewsMTSC
    /home/moritz/anaconda3/envs/newsmtsc/lib/python3.7/site-packages/transformers/tokenization_utils_base.py:2110: FutureWarning: The `pad_to_max_length` argument is deprecated and will be removed in a future version, use `padding=True` or `padding='longest'` to pad to the longest sequence in the batch, or use `padding='max_length'` to pad to a max length. In this case, you can give a specific length with `max_length` (e.g. `max_length=45`) or leave max_length to None to pad to the maximal input size of the model (e.g. 512 for Bert).
      FutureWarning,
    21:40:57 WARNING dataset(194):_create_word_to_wordpiece_mapping|: overlap when mapping tokens to wordpiece (allow overwriting because Roberta is used)
    Traceback (most recent call last):
      File "/snap/pycharm-educational/38/plugins/python-ce/helpers/pydev/pydevd.py", line 1483, in _exec
        pydev_imports.execfile(file, globals, locals)  # execute the script
      File "/snap/pycharm-educational/38/plugins/python-ce/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
        exec(compile(contents+"\n", file, 'exec'), glob, loc)
      File "/home/moritz/Documents/Hiwi/NewsMTSC/infer.py", line 155, in <module>
        text_right=", you have to admit that he’s an astute reader of politics.",
      File "/home/moritz/Documents/Hiwi/NewsMTSC/infer.py", line 88, in infer
        outputs = self.model(inputs)
      File "/home/moritz/anaconda3/envs/newsmtsc/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
        result = self.forward(*input, **kwargs)
      File "/home/moritz/Documents/Hiwi/NewsMTSC/models/singletarget/grutscsingle.py", line 132, in forward
        (last_hidden_states, knowledge_embedded), dim=2
    TypeError: expected Tensor as element 0 in argument 0, but got str
    

    last_hidden_states has indeed the string value “last_hidden_states” (i.e. last_hidden_states = “last_hidden_states”) after the statement in https://github.com/fhamborg/NewsMTSC/blob/aaa358baf1473ecab22585c73c6d52307e6a3179/models/singletarget/grutscsingle.py#L102-L106

    opened by movabo 4
  • Strange results on Hugging Face

    Strange results on Hugging Face

    Hello!

    I am testing your model uploaded on Hugging Face( roberta-targeted-sentiment-classification-newsarticles) and its giving some strange results. Just from inputting text on the example text box I get:

    Two children among 3 Eritrean refugees killed in Tigray air raid. - LABEL_0=0.53 LABEL_1=0.47 Gunfire heard as BBC visits scene of Kazakh clashes. - LABEL_0=0.539 LABEL_1=0.461 Trinity College Dublin begins €90m project to relocate vulnerable books - LABEL_0=0.506 LABEL_1=0.494 US economy added 199,000 new jobs in December as unemployment rate drops - LABEL_0=0.506 LABEL_1=0.494

    If I use transformers with my own python code sentiment_analysis = pipeline("sentiment-analysis", model=folder, tokenizer=folder, return_all_scores=True), I get slightly different results:

    Two children among 3 Eritrean refugees killed in Tigray air raid. - LABEL_0=0.59 LABEL_1=0.41 Gunfire heard as BBC visits scene of Kazakh clashes. - LABEL_0=0.6 LABEL_1=0.39 Trinity College Dublin begins €90m project to relocate vulnerable books - LABEL_0=0.59 LABEL_1=0.40 US economy added 199,000 new jobs in December as unemployment rate drops - LABEL_0=0.59 LABEL_1=0.41

    I assume LABEL_0 corresponds the proability the sentence is negative in sentiment...? Anyway, I do not see relevant results from the model on both cases and I am wondering if it's because I am missing something.

    Thanks and keep up with the amazing work!

    Joan

    opened by joansc 3
  • Model update

    Model update

    Hi, I recent rework the LCF-BERT model, now it is much faster and stable. If you have interest to update the model, please see PyABSA.

    Cheers,

    Yang Heng

    opened by yangheng95 3
  • Fix several bugs, prepare PyTorch hub support

    Fix several bugs, prepare PyTorch hub support

    Bugs fixed:

    • AttributeError: spacy.pipeline.DependencyParser object has no attribute 'labels' -> Allow spacy versions greater 2.0.*
    • ModuleNotFoundError: No module named 'models.singletarget.stancedetectionpaper' -> Local import in method where it's required
    • ModuleNotFoundError: No module named 'models.singletarget.knowledgesourceshosseiniatdbert' -> Local import in method where it's required
    opened by movabo 3
  • How to deal with sentence with multiple target with GRUTSC?

    How to deal with sentence with multiple target with GRUTSC?

    Hi @fhamborg,

    I am sort of confused with the implementation on how to deal with sentences with multiple target using the GRUTSC model in training time.

    Do you end you making multiple inputs for the same sentence for each target? eg. input1 = [cls,sentence,sep,target1,sep] eg. input2 = [cls,sentence,sep,target2,sep] and so on..?

    opened by Pager07 2
  • Difference between huggingface and

    Difference between huggingface and "normal" dataset

    Hello,

    Thank you for sharing your code and datasets.

    I notice there's a difference in the total number of samples between the huggingface and the normal version of the dataset. Could you explain me ?

    Also in your paper, I understand that you make several sampling of dev and test from the devtest_xx.jsonl file ? Can you confirm ?

    Thanks a lot

    opened by EvanDufraisse 1
  • download.py error

    download.py error

      ~/IdeaProjects/NewsMTSC   main ···································································································································································································  4s  CompanySentimentNews  15:54:38
    ❯ python download.py
    15:54:47 INFO diskdict(20):__init__|: loaded DiskDict with 6726 items from knowledge/bingliuopinion/opinion_polarity.ddict
    15:54:47 INFO diskdict(20):__init__|: loaded DiskDict with 6886 items from knowledge/mpqasubjectivity/subjclueslen1-HLTEMNLP05.tff.ddict
    15:54:47 INFO diskdict(20):__init__|: loaded DiskDict with 6468 items from knowledge/nrcemolex/NRC-Emotion-Lexicon-Wordlevel-v0.92.txt.ddict
    Traceback (most recent call last):
      File "download.py", line 111, in <module>
        Download.run_from_cmd()
      File "download.py", line 102, in run_from_cmd
        return cls(**args)
      File "download.py", line 19, in __init__
        from train import OWN_MODELNAME2CLASS
      File "/Users/felix/IdeaProjects/NewsMTSC/train.py", line 29, in <module>
        from dataset import FXDataset, RandomOversampler, FXEasyTokenizer
      File "/Users/felix/IdeaProjects/NewsMTSC/dataset.py", line 101, in <module>
        "aux",
    AssertionError
      ~/IdeaProjects/NewsMTSC   main
    
    opened by fhamborg 1
  • may  I want  your dataset about  train.jsonl and test_mt.jsonl,test_rw.jsonl?

    may I want your dataset about train.jsonl and test_mt.jsonl,test_rw.jsonl?

    Hello ,I am apost graduate student,I am interested in your work on news sentiment analysis, I have seen your dataset on github ,but the number of train.jsonl is 7758,test_mt is 721,test_rw is 1067,It is not same from your paper,may I want your complete dataset? my gmail is : [email protected],Thank you very much 👍

    opened by CMM915915 1
  • NewsTSC

    NewsTSC

    Hi Felix,

    I am writing to you about the NEWSTSC repo which is now archived. I ran the train script to train LCF_BERT with the following settings

    python train.py  --model_name lcf_bert --optimizer adam --initializer xavier_uniform_ --learning_rate 3e-5 --batch_size 16 --balancing lossweighting --num_epoch 4 --lsr False --use_tp_placeholders False --eval_only_after_last_epoch True --devmode False --local_context_focus cdm --SRD 3 --pretrained_model_name bert_news_ccnc_10mio_3ep --snem recall_avg --dataset_name newstsc --experiment_path ./experiments/newstsc_20191126-115759/0/ --crossval 0 --task_format newstsc --device cuda:0
    

    I found that the recall_avg score is ~0.65 after 4 epochs. (this is approximately what the paper for NEWTSC describes )

    I then downloaded the fine-tuned weights "lcf_bert_newstsc_val_recall_avg_0.5954_epoch3" and ran test on the given test set for NEWSTSC. I am getting recall_avg scores ~0.825.

    Were the provided fine-tuned weights generated from the 3k sentence dataset provided here?

    opened by Pager07 1
  • Fix UnboundLocalError thrown during training

    Fix UnboundLocalError thrown during training

    NewsSentiment/train.py --own_model_name grutsc --dataset_name newsmtsc-rw threw this error after some time during training:

    Traceback (most recent call last):
      File "NewsSentiment/train.py", line 1379, in <module>
        prepare_and_start_instructor(opt)
      File "NewsSentiment/train.py", line 1206, in prepare_and_start_instructor
        ins.run()
      File "NewsSentiment/train.py", line 866, in run
        criterion, optimizer, train_data_loader, dev_data_loader
      File "NewsSentiment/train.py", line 504, in _train
        selected_model_dev_stats,
      File "NewsSentiment/train.py", line 526, in _intraining_evaluation_and_model_save
        dev_stats = self._evaluate(dev_data_loader)
      File "NewsSentiment/train.py", line 767, in _evaluate
        stats = self.evaluator.calc_statistics(y_true, y_pred, t_outputs_confidence)
    UnboundLocalError: local variable 't_outputs_confidence' referenced before assignment
    

    Looks like an oversight when this variable was introduced in 213c1da0 as in some circumstances this variable can be referenced before assignment.

    opened by simonepstein 0
  • Package Requirements: cudatoolkit 10.1

    Package Requirements: cudatoolkit 10.1

    Hi! Thank you for bringing this work to us!

    I tried to install the NewsSentiment[cuda] package in a conda environment with cudatoolkit installed. Cudatoolkit version is 10.1.243. I keep getting the error that the version is not satisfied. Below is the command and error statement.

    (newsmtsc) C:\Users\nguye>pip install NewsSentiment[cuda]==1.1.9
    ERROR: Could not find a version that satisfies the requirement cudatoolkit==10.1; extra == "cuda" (from newssentiment[cuda]) (from versions: none)
    ERROR: No matching distribution found for cudatoolkit==10.1; extra == "cuda"
    

    My environment:

    (newsmtsc) C:\Users\nguye>conda list
    # packages in environment at C:\Users\nguye\anaconda3\envs\newsmtsc:
    #
    # Name                    Version                   Build  Channel
    ca-certificates           2022.10.11           haa95532_0
    certifi                   2022.12.7        py38haa95532_0
    cudatoolkit               10.1.243             h74a9793_0
    libffi                    3.4.2                hd77b12b_6
    openssl                   1.1.1s               h2bbff1b_0
    pip                       22.3.1           py38haa95532_0
    python                    3.8.15               h6244533_2
    setuptools                65.5.0           py38haa95532_0
    sqlite                    3.40.0               h2bbff1b_0
    vc                        14.2                 h21ff451_1
    vs2015_runtime            14.27.29016          h5e58377_2
    wheel                     0.37.1             pyhd3eb1b0_0
    wincertstore              0.2              py38haa95532_2
    

    For the cudatoolkit installation. There's no way on top of my mind to prevent conda to install the exact 10.1 version.

    (newsmtsc) C:\Users\nguye>conda install cudatoolkit=10.1
    Collecting package metadata (current_repodata.json): done
    Solving environment: done
    
    ## Package Plan ##
    
      environment location: C:\Users\nguye\anaconda3\envs\newsmtsc
    
      added / updated specs:
        - cudatoolkit=10.1
    
    
    The following NEW packages will be INSTALLED:
    
      cudatoolkit        pkgs/main/win-64::cudatoolkit-10.1.243-h74a9793_0
    
    
    Proceed ([y]/n)? y
    
    
    Downloading and Extracting Packages
    
    Preparing transaction: done
    Verifying transaction: done
    Executing transaction: done
    

    I could be wrong somewhere in the installation process. Please let me know how did you deal with this.

    Thanks in advance.

    opened by anng217 0
  • Question on sentiment output

    Question on sentiment output

    Hi there authors, really impressive work with much ease to use, thanks for sharing this :)

    I have a silly question regarding the template example provided:

    • sentiment = tsc.infer_from_text("I like " ,"Peter", " but I don't like Robert.") => [{'class_id': 1, 'class_label': 'neutral', 'class_prob': 0.44148460030555725}, {'class_id': 2, 'class_label': 'positive', 'class_prob': 0.4068439304828644}, {'class_id': 0, 'class_label': 'negative', 'class_prob': 0.15167152881622314}]

    In this case, why is the output neutral? I thought it should be positive. Just to clarify, the input should be [before target] [target] [after target]?

    opened by ipheiman 1
  • Let's turn multilingual!

    Let's turn multilingual!

    Okay, so, I have decided that I want to use this amazing IMPRESSIVE work of art for predicting sentiments in spanish. I noticed that the SentimentAnalysis tool runs on Spacy and uses a English news training dataset. I just can't find the folder were spacy or the dataset are loaded. Is changing these parameters enough? Any further ideas?

    EDIT: I forked the code, edited dataset.py and made a simple way of requiring a different spacy model from the coder's input. I changed the order in FXBaseModel to require RoBERTa before the XLNET model. I plan to make new training datasets (but i just don't know how yet).

    opened by diegopaucarv 1
  • TextTooLongException not thrown when text is too long in specific case

    TextTooLongException not thrown when text is too long in specific case

    When attempting to classify sentiment with the following input, I get a misleading exception. Generally TextTooLongException seems to be thrown appropriately, but this seemed to be the one exception to that:)

    To reproduce:

    left = "market eye-sgx nifty flat; bharti infratel debuts. * nifty futures on the singapore exchange unchanged. the msci-asia pacific index, excluding japan gains 0.43 percent. * bharti infratel ltd debuts after raising about $760 million in india's biggest ipo in two years. traders expect shares to come under pressure due to concerns about the outlook for mobile tower operators. * foreign investors sold 1.33 billion rupees of stocks, while domestic institutions bought 1.33 billion rupees of stocks on thursday, when india's bse index fell 0.48 percent. * traders expect market to trade in a narrow range, with select "
    centre = "oil"
    right = " marketing companies shares to be traced on talks of hike in diesel prices."
    tsc = TargetSentimentClassifier()
    sentiment = tsc.infer_from_text(left, centre, right)
    

    I get the exception:

    TargetNotFoundException
    no target found: [market, eye, -, sgx, nifty, flat, ;, bharti, infratel, debuts, ., *, nifty, futures, on, the, singapore, exchange, unchanged, ., the, msci, -, asia, pacific, index, ,, excluding, japan, gains, 0.43, percent, ., *, bharti, infratel, ltd, debuts, after, raising, about, $, 760, million, in, india, 's, biggest, ipo, in, two, years, ., traders, expect, shares, to, come, under, pressure, due, to, concerns, about, the, outlook, for, mobile, tower, operators, ., *, foreign, investors, sold, 1.33, billion, rupees, of, stocks, ,, while, domestic, institutions, bought, 1.33, billion, rupees, of, stocks, on, thursday, ,, when, india, 's, bse, index, fell, 0.48, percent, ., *, traders, expect, market, to, trade, in, a, narrow, range, ,, with], 615, oil
    

    With package version 1.1.21

    Thanks, love the library!

    opened by bendavidsteel 1
Releases(v1.0.0)
  • v1.0.0(Apr 26, 2021)

Owner
Felix Hamborg
Loves to work on real-world issues
Felix Hamborg
CodeBERT: A Pre-Trained Model for Programming and Natural Languages.

CodeBERT This repo provides the code for reproducing the experiments in CodeBERT: A Pre-Trained Model for Programming and Natural Languages. CodeBERT

Microsoft 1k Jan 03, 2023
Code for Emergent Translation in Multi-Agent Communication

Emergent Translation in Multi-Agent Communication PyTorch implementation of the models described in the paper Emergent Translation in Multi-Agent Comm

Facebook Research 75 Jul 15, 2022
Grapheme-to-phoneme (G2P) conversion is the process of generating pronunciation for words based on their written form.

Neural G2P to portuguese language Grapheme-to-phoneme (G2P) conversion is the process of generating pronunciation for words based on their written for

fluz 11 Nov 16, 2022
Installation, test and evaluation of Scribosermo speech-to-text engine

Scribosermo STT Setup Scribosermo is a LGPL licensed, open-source speech recognition engine to "Train fast Speech-to-Text networks in different langua

Florian Quirin 3 Jun 20, 2022
A benchmark for evaluation and comparison of various NLP tasks in Persian language.

Persian NLP Benchmark The repository aims to track existing natural language processing models and evaluate their performance on well-known datasets.

Mofid AI 68 Dec 19, 2022
Funnel-Transformer: Filtering out Sequential Redundancy for Efficient Language Processing

Introduction Funnel-Transformer is a new self-attention model that gradually compresses the sequence of hidden states to a shorter one and hence reduc

GUOKUN LAI 197 Dec 11, 2022
Ask for weather information like a human

weather-nlp About Ask for weather information like a human. Goals Understand typical questions like: Hourly temperatures in Potsdam on 2020-09-15. Rai

5 Oct 29, 2022
Multilingual finetuning of Machine Translation model on low-resource languages. Project for Deep Natural Language Processing course.

Low-resource-Machine-Translation This repository contains the code for the project relative to the course Deep Natural Language Processing. The goal o

Andrea Cavallo 3 Jun 22, 2022
Datasets of Automatic Keyphrase Extraction

This repository contains 20 annotated datasets of Automatic Keyphrase Extraction made available by the research community. Following are the datasets and the original papers that proposed them. If yo

LIAAD - Laboratory of Artificial Intelligence and Decision Support 163 Dec 23, 2022
Official source for spanish Language Models and resources made @ BSC-TEMU within the "Plan de las Tecnologías del Lenguaje" (Plan-TL).

Spanish Language Models 💃🏻 A repository part of the MarIA project. Corpora 📃 Corpora Number of documents Number of tokens Size (GB) BNE 201,080,084

Plan de Tecnologías del Lenguaje - Gobierno de España 203 Dec 20, 2022
KakaoBrain KoGPT (Korean Generative Pre-trained Transformer)

KoGPT KoGPT (Korean Generative Pre-trained Transformer) https://github.com/kakaobrain/kogpt https://huggingface.co/kakaobrain/kogpt Model Descriptions

Kakao Brain 797 Dec 26, 2022
Facilitating the design, comparison and sharing of deep text matching models.

MatchZoo Facilitating the design, comparison and sharing of deep text matching models. MatchZoo 是一个通用的文本匹配工具包,它旨在方便大家快速的实现、比较、以及分享最新的深度文本匹配模型。 🔥 News

Neural Text Matching Community 3.7k Jan 02, 2023
Train 🤗-transformers model with Poutyne.

poutyne-transformers Train 🤗 -transformers models with Poutyne. Installation pip install poutyne-transformers Example import torch from transformers

Lennart Keller 2 Dec 18, 2022
A simple word search made in python

Word Search Puzzle A simple word search made in python Usage $ python3 main.py -h usage: main.py [-h] [-c] [-f FILE] Generates a word s

Magoninho 16 Mar 10, 2022
Named Entity Recognition API used by TEI Publisher

TEI Publisher Named Entity Recognition API This repository contains the API used by TEI Publisher's web-annotation editor to detect entities in the in

e-editiones.org 14 Nov 15, 2022
Unofficial implementation of Google's FNet: Mixing Tokens with Fourier Transforms

FNet: Mixing Tokens with Fourier Transforms Pytorch implementation of Fnet : Mixing Tokens with Fourier Transforms. Citation: @misc{leethorp2021fnet,

Rishikesh (ऋषिकेश) 217 Dec 05, 2022
Materials (slides, code, assignments) for the NYU class I teach on NLP and ML Systems (Master of Engineering).

FREE_7773 Repo containing material for the NYU class (Master of Engineering) I teach on NLP, ML Sys etc. For context on what the class is trying to ac

Jacopo Tagliabue 90 Dec 19, 2022
Backend for the Autocomplete platform. An AI assisted coding platform.

Introduction A custom predictor allows you to deploy your own prediction implementation, useful when the existing serving implementations don't fit yo

Tatenda Christopher Chinyamakobvu 1 Jan 31, 2022
BERN2: an advanced neural biomedical namedentity recognition and normalization tool

BERN2 We present BERN2 (Advanced Biomedical Entity Recognition and Normalization), a tool that improves the previous neural network-based NER tool by

DMIS Laboratory - Korea University 99 Jan 06, 2023
TFPNER: Exploration on the Named Entity Recognition of Token Fused with Part-of-Speech

TFPNER TFPNER: Exploration on the Named Entity Recognition of Token Fused with Part-of-Speech Named entity recognition (NER), which aims at identifyin

1 Feb 07, 2022