Style Transfer in Text
- Non-parallel
- NTU Hung-yi Lee DLHLP2020 HW5
- Yelp
- Chinese Articles
- NTU Hung-yi Lee DLHLP2020 HW5
- Course
- Homework
- HW5-1
- HW5-2 (not found yet)
- HW5-3 (not found yet)
- Video
- Starter Code
- It is based on this paper: Style Transformer => Text version of StarGAN
- Other
HW5-1: Understand and train a Text Style Transfer model
- Modified configurations
- show what's different from default
- Show training curves
- plot the three loss in style transformer
- plot the discriminator loss
- Evaluation
- report best model's
- accuracy
- ref-BLEU
- perplexity
- generate model's output on the 1000 yelp testing data
- show some results on sentences (case study)
- good examples
- bad (problematic) examples
- observation
- report best model's
Baseline: (positive + negative) / 2
accuracy: 0.7 ref-BLEU: 17 perplexity: 150
HW5-2: Understand the modules of Sylte Transformer
- Problem 1
- sample one sentence and apply style transfer
- show the attention maps and explaination
- Problem 2
- apply style transfer on test data and collect the sentence embedding
- visualize the distribution of embedding by T-sne
- Problem 3
- sample one sentence, mask one position at a time and do style transfer
- show the results and explaination
# code has already done (just load the model trained in HW5-1)
python3 main.py --part2 --part2_model_dir=<trained_model_dir> --part2_step=<trained_step>
# all the results could be found under ./part2_output
HW5-3
- Improve your model
- add dataset (e.g. IMDB dataset) => need to train an evaluator (for calculating perplexity and accuracy)
- experiment at the discrete part
- Add more styles
- styles are not related to positive and negative style
- Try other models
Pre-trained Language Model
- ymcui/Chinese-BERT-wwm: Pre-Training with Whole Word Masking for Chinese BERT(中文BERT-wwm系列模型)
- brightmart/roberta_zh: RoBERTa中文预训练模型: RoBERTa for Chinese
Corpus
- THUCNews
Based on the starter code of the NTU Hung-yi Lee DLHLP2020 HW5
Files under DLHLP2020HW5
This will need the fasttext to be exact the version
0.8.3
.
cd DLHLP2020HW5
# Quick setup (do the Requirements part)
bash setup.sh
# if you face any compilation error while install dependencies
# maybe you need to execute this first
# sudo apt install python3-dev
I use the latest version of fasttext (
0.9.2
)
TODO:
- Rename some variable names (if we want to keep using this model...), currently I keep using the
pos
andneg
nameing but for two different domain articles. - We might want to keep some information like date unchange while doing style transfer.
- Found it might be very hard for a style transfer model because of the generator tends to change the "keywords" to pass the discriminator, which might be the information that we want.