Coder Social home page Coder Social logo

c3da's Introduction

C3DA

Code and datasets of our paper “A Contrastive Cross-Channel Data Augmentation Framework for Aspect-based Sentiment Analysis”

Requirements

  • torch==1.4.0
  • scikit-learn==0.23.2
  • transformers==3.2.0
  • cython==0.29.13
  • nltk==3.5

To install requirements, run pip install -r requirements.txt.

Generating

To generate data items, run:

python C3DA/generate.py

Training

To train the C3DA model, run:

sh C3DA/run.sh

and C3DA/start.sh, C3DA/start1.sh is used to adjust our hyper-parameters.

Logs

Logs are saved under C3DA/C3DA/log

Credits

The code and datasets in this repository are based on ABSA-PyTorch and CDT_ABSA.

Cite

@inproceedings{wang2022a,
  author    = {Bing Wang and Liang Ding and Qihuang Zhong and Ximing Li and Dacheng Tao},
  title     = {A Contrastive Cross-Channel Data Augmentation Framework for Aspect-Based Sentiment Analysis},
  booktitle = {Proceedings of the 29th International Conference on Computational Linguistics, {COLING} 2022, Gyeongju, Republic of Korea, October 12-17,
               2022},
  pages     = {6691--6704},
  publisher = {International Committee on Computational Linguistics},
  year      = {2022},
  url       = {https://aclanthology.org/2022.coling-1.581},
  timestamp = {Thu, 13 Oct 2022 17:29:38 +0200},
  biburl    = {https://dblp.org/rec/conf/coling/Wang0ZLT22.bib},
  bibsource = {dblp computer science bibliography, https://dblp.org}
}

c3da's People

Contributors

wangbing1416 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

c3da's Issues

“CLLoss=0”

你好,请教一下,为什么当我的设置的withCL=true的时候,整个训练过程中CLLoss 几乎为0呢

Target sizes over 512

你好,在运行 python train.py --dataset restaurant --prompt_name lora --ft_epoch 100 --model_name bert --withAugment --withCL 时报错

Traceback (most recent call last):
File "/home/userc3da/train.py", line 428, in
main()
File "/home/user/c3da/train.py", line 425, in main
ins.run()
File "/home/user/c3da/train.py", line 287, in run
max_test_acc, max_f1, model_path = self._train(criterion, optimizer, max_test_acc_overall)
File "/home/user/c3da/train.py", line 170, in _train
aug_inputs = self.entropy_filter(aug_sample)
File "/home/user/c3da/train.py", line 143, in entropy_filter
logit = F.softmax(self.model(sen.unsqueeze(dim=0), mode='filter'), dim=1)
File "/home/user/miniconda3/envs/c3da/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1190, in _call_impl
return forward_call(*input, **kwargs)
File "/home/user/c3da/models/predictModel.py", line 36, in forward
res = self.backbone(inputs) # del attention_mask and bert_segments_ids
File "/home/user/miniconda3/envs/c3da/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1190, in _call_impl
return forward_call(*input, **kwargs)
File "/home/user/miniconda3/envs/c3da/lib/python3.9/site-packages/transformers/models/bert/modeling_bert.py", line 956, in forward
buffered_token_type_ids_expanded = buffered_token_type_ids.expand(batch_size, seq_length)
RuntimeError: The expanded size of the tensor (692) must match the existing size (512) at non-singleton dimension 1. Target sizes: [1, 692]. Tensor sizes: [1, 512]``

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.