Skip to content

Add text style transfer (#166)#263

Open
swapnull7 wants to merge 21 commits into
asyml:masterfrom
swapnull7:master
Open

Add text style transfer (#166)#263
swapnull7 wants to merge 21 commits into
asyml:masterfrom
swapnull7:master

Conversation

@swapnull7

@swapnull7 swapnull7 commented Dec 4, 2019

Copy link
Copy Markdown
Collaborator
  • initial commit

  • bug fixes and adjusting conv inputs

  • separate forward function for Discriminator and Generator and disable Gen training for debugging

  • remove debugger statement

  • texar bug fix

  • detaching stuff before accumulating

  • refactor and add component as optional parameter

  • Add optimizer for and backprop against encoder

  • Add in README

* initial commit

* bug fixes and adjusting conv inputs

* separate forward function for Discriminator and Generator and disable Gen training for debugging

* remove debugger statement

* bug fix

* detaching stuff before accumulating

* refactor and add component as optional parameter

* Add optimizer for and backprop against encoder

* Add in README
* initial commit

* bug fixes and adjusting conv inputs

* separate forward function for Discriminator and Generator and disable Gen training for debugging

* remove debugger statement

* bug fix

* detaching stuff before accumulating

* refactor and add component as optional parameter

* Add optimizer for and backprop against encoder

* Add in README

* more fixes to eval mode

* create optimizers so that they can be saved

* fix typo
@codecov

codecov Bot commented Dec 5, 2019

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 42.10526% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.48%. Comparing base (885255c) to head (3776f4b).
⚠️ Report is 86 commits behind head on master.

Files with missing lines Patch % Lines
texar/torch/utils/variables.py 38.88% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #263      +/-   ##
==========================================
- Coverage   82.53%   82.48%   -0.05%     
==========================================
  Files         205      206       +1     
  Lines       15829    15848      +19     
==========================================
+ Hits        13064    13072       +8     
- Misses       2765     2776      +11     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

* initial commit

* bug fixes and adjusting conv inputs

* separate forward function for Discriminator and Generator and disable Gen training for debugging

* remove debugger statement

* bug fix

* detaching stuff before accumulating

* refactor and add component as optional parameter

* Add optimizer for and backprop against encoder

* Add in README

* more fixes to eval mode

* create optimizers so that they can be saved

* fix typo

* linting issues

* add type annotation for encoder

* fix linting

* Isolate AE in training

* works after changing the learning rate

* remove debugger
@swapnull7 swapnull7 marked this pull request as ready for review December 8, 2019 06:00
@swapnull7 swapnull7 self-assigned this Dec 9, 2019
@gpengzhi

gpengzhi commented Dec 9, 2019

Copy link
Copy Markdown
Collaborator

Please merge master into your branch to pass the codecov test.

Comment thread examples/README.md
Comment thread examples/text_style_transfer/README.md Outdated
Comment thread examples/text_style_transfer/README.md
Comment thread examples/text_style_transfer/README.md
Comment thread examples/text_style_transfer/README.md
Comment thread examples/text_style_transfer/ctrl_gen_model.py Outdated
Comment thread examples/text_style_transfer/main.py Outdated
Comment thread examples/text_style_transfer/prepare_data.py Outdated
Comment thread texar/torch/utils/variables.py Outdated
Comment thread texar/torch/utils/variables.py Outdated
Comment thread texar/torch/utils/variables.py Outdated
Comment thread texar/torch/utils/variables.py Outdated
Comment thread texar/torch/utils/variables.py Outdated
Comment thread texar/torch/utils/variables.py Outdated
Comment thread texar/torch/utils/variables.py
@huzecong

huzecong commented Dec 9, 2019

Copy link
Copy Markdown
Collaborator

You might also want to change the PR title; should reference #166 instead.

Comment thread texar/torch/utils/variables.py
Comment thread examples/text_style_transfer/prepare_data.py Outdated
Comment thread examples/text_style_transfer/main.py Outdated
Comment thread examples/text_style_transfer/main.py Outdated
Comment thread examples/text_style_transfer/main.py Outdated
train_op_g.zero_grad()
step += 1

vals_d = model(batch, gamma_, lambda_g_, mode="train",

@gpengzhi gpengzhi Dec 9, 2019

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which dataset do you use here? train_g? It seems that train_d is used in texar-tf. Why does such a difference exist?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For training, I use the same dataset because it is tricky to switch datasets between steps. And considering the discriminator and generator are trained separately, I've noticed it doesn't really affect the results.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the 2 iterators and keeping just one train iterator.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that is the case, we do not need to have train_d in the iterator (?)

Comment thread examples/text_style_transfer/ctrl_gen_model.py Outdated
Comment thread examples/text_style_transfer/ctrl_gen_model.py Outdated
hparams=config.model['opt']
)

def _train_epoch(gamma_, lambda_g_, epoch, verbose=True):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In texar-tf, both train_d and train_g are used in the _train_epoch, but we only use train_g in this function. Did I miss something important?

@swapnull7 swapnull7 changed the title Add text style transfer (#1) Add text style transfer (#166) Dec 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants