GithubHelp home page GithubHelp logo

smae's Introduction

SMAE

This is the code for "Learning Sentiment Memories for Sentiment Modification without Parallel Data".

Environment and Dependency

  • Ubuntu 16.04
  • Python 3.5
  • Tensorflow 1.4
  • nltk 3.2.5

Data

yelp

Usage

CUDA_VISIBLE_DEVICES=0 python3 main.py
To run this code, you first need to process the dataset into the specific format. We provide the sample file in dataset to facilitate runing code. But these files are just a small piece of the complete training set and are not enough to get a satisfied performance. You can process the data provided by yelp to get enough training set. During running, several files will be created.

The full dataset we used in our experiments can be found here: full_data

Feel free to contact me if you have any questions:)

Cite

If you use this code for your research, please cite the following paper:

  @inproceedings{zhang2018learning,  
  author = {Zhang, Yi and Xu, Jingjing and Yang, Pengcheng and Sun, Xu},  
  title = {Learning Sentiment Memories for Sentiment Modification without Parallel Data},  
  booktitle = {EMNLP 2018},  
  year = {2018}  
  }  

smae's People

Contributors

xusun26 avatar zhangyics avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

smae's Issues

AttributeError: 'HParams' object has no attribute 'train_data_path'

mldl@ub1604:/ub16_prj/SMAE$ CUDA_VISIBLE_DEVICES=0 python3 main.py
INFO:tensorflow:Starting running in train mode...
max_size of vocab was specified as 50000; we now have 50000 words. Stopping reading.
Finished constructing vocabulary of 50000 total words. Last word added: photofacials
Traceback (most recent call last):
File "main.py", line 327, in
tf.app.run()
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "main.py", line 292, in main
cnn_batcher = ClaBatcher(hps_discriminator, vocab)
File "/home/mldl/ub16_prj/SMAE/batcher_classification.py", line 100, in init
hps.train_data_path, start_file_number=0, end_file_number=65)
AttributeError: 'HParams' object has no attribute 'train_data_path'
mldl@ub1604:
/ub16_prj/SMAE$

Assertion error when testing "emotional words" detection model

I'm getting an error AssertionError: Error: Empty filelist at valid_filtered/* at the "run testing emotional words detection model" step. See the below terminal trace, including the immediately preceding log messages.

This happens when running on the default dataset included with the repo when using the given command CUDA_VISIBLE_DEVICES=0 python3 main.py

INFO:tensorflow:finished 15 epoches
INFO:tensorflow:starting run testing emotional words detection model...
INFO:tensorflow:final sigmoid attention valid acc: 0.799829
INFO:tensorflow:starting run testing emotional words detection model...
The sentiment classification accuracy of the emotional words detection model is 0.800
len valid, 164
Generating training examples......
Traceback (most recent call last):
  File "main.py", line 303, in <module>
    tf.app.run()
  File "/home/ubuntu/anaconda3/envs/tensorflow_p36/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 125, in run
    _sys.exit(main(argv))
  File "main.py", line 294, in main
    batcher = GenBatcher(vocab, FLAGS) ##read from train
  File "/home/ubuntu/SMAE/Batch_iter.py", line 155, in __init__
    self.valid_queue_positive = self.fill_example_queue("valid_filtered/*", mode="valid", target_score=1, start_filenumber=0, end_filenumber=20)
  File "/home/ubuntu/SMAE/Batch_iter.py", line 239, in fill_example_queue
    assert filelist, ('Error: Empty filelist at %s' % data_path)  # check filelist isn't empty
AssertionError: Error: Empty filelist at valid_filtered/*

I assume these files are supposed to be written during training, but aren't for some reason. Any idea why?

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.