• Stars
    star
    241
  • Rank 167,643 (Top 4 %)
  • Language
    Python
  • License
    BSD 3-Clause "New...
  • Created almost 7 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Reproducing Hu, et. al., ICML 2017's "Toward Controlled Generation of Text"

Controlled Text Generation

Reproducing Hu, et. al., ICML 2017's "Toward Controlled Generation of Text" in PyTorch. This work is for University of Bonn's NLP Lab project on Winter Semester 2017/2018.

Requirements

  1. Python 3.5+
  2. PyTorch 0.3
  3. TorchText https://github.com/pytorch/text

How to run

  1. Run python train_vae.py --save {--gpu}. This will create vae.bin. Essentially this is the base VAE as in Bowman, 2015 [2].
  2. Run python train_discriminator --save {--gpu}. This will create ctextgen.bin. The discriminator is using Kim, 2014 [3] architecture and the training procedure is as in Hu, 2017 [1].
  3. Run test.py --model {vae, ctextgen}.bin {--gpu} for basic evaluations, e.g. conditional generation and latent interpolation.

Difference compared to the paper

  1. Only conditions the model with sentiment, i.e. no tense conditioning.
  2. Entirely using SST dataset, which has only ~2800 sentences after filtering. This might not be enough and leads to overfitting. The base VAE in the original model by Hu, 2017 [1] is trained using larger dataset first.
  3. Obviously most of the hyperparameters values are different.

References

  1. Hu, Zhiting, et al. "Toward controlled generation of text." International Conference on Machine Learning. 2017. [pdf]
  2. Bowman, Samuel R., et al. "Generating sentences from a continuous space." arXiv preprint arXiv:1511.06349 (2015). [pdf]
  3. Kim, Yoon. "Convolutional neural networks for sentence classification." arXiv preprint arXiv:1408.5882 (2014). [pdf]

More Repositories

1

generative-models

Collection of generative models, e.g. GAN, VAE in Pytorch and Tensorflow.
Python
7,304
star
2

MCMC

Collection of Monte Carlo (MC) and Markov Chain Monte Carlo (MCMC) algorithms applied on simple examples.
Python
356
star
3

hipsternet

All the hipster things in Neural Net in a single repo
Python
287
star
4

probabilistic-models

Collection of probabilistic models and inference algorithms
Python
241
star
5

natural-gradients

Collection of algorithms for approximating Fisher Information Matrix for Natural Gradient (and second order method in general)
Python
135
star
6

last_layer_laplace

Last-layer Laplace approximation code examples
Jupyter Notebook
78
star
7

cnn-levelset

Source code for Kristiadi and Pranowo, 2017's "Deep Convolutional Level Set Method for Image Segmentation"
Python
59
star
8

pub-ready-plots

Agustinus' very opiniated publication-ready plotting library
Python
50
star
9

wiseodd.github.io

Agustinusβ€˜ personal website and blog
MDX
39
star
10

lula

Companion code for the paper "Learnable Uncertainty under Laplace Approximations" (UAI 2021).
Python
18
star
11

compound-density-networks

Implementation of: Kristiadi, Agustinus, and Asja Fischer. "Predictive Uncertainty Quantification with Compound Density Networks." (2019).
Python
15
star
12

lapeft-bayesopt

Discrete Bayesian optimization with LLMs, PEFT finetuning methods, and the Laplace approximation.
Python
14
star
13

cuda-pso

Comparison between CUDA and CPU for PSO using 3-dimensional Levy function as test case
C++
13
star
14

bayesian_ood_training

Jupyter Notebook
9
star
15

swarm-image-segmenter

Image segmentation using swarm intelligence, accelerated using GPGPU (CUDA)
C++
7
star
16

laplace-bayesopt

Laplace approximated BNN surrogate for BoTorch
Python
7
star
17

phd_thesis_template

TeX
4
star
18

rgpr

Companion code for the paper "An Infinite-Feature Extension for Bayesian ReLU Nets That Fixes Their Asymptotic Overconfidence" (NeurIPS 2021)
Python
4
star
19

two-funds-rebalancer

Given your current portfolio value, desired allocation after rebalancing, and the amount of cash you have, this script will output how much of your cash should be used to buy stock/bonds (in percent). Only works for portfolios with two funds, e.g. the Couch Potato and classic two-funds 60-40 portfolios.
Python
2
star
20

llm-bayesopt-exps

Official experiment code for the "Sober Look at LLMs for Material Discovery" paper.
Python
1
star
21

bo-async-feedback

Python
1
star