MCPcopy Index your code
hub / github.com/ImKeTT/AdaVAE

github.com/ImKeTT/AdaVAE @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
337 symbols 1,132 edges 23 files 99 documented · 29%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

AdaVAE: Exploring Adaptive GPT-2s in VAEs for Language Modeling

[Repo In Progress] Official implementation for AdaVAE, check the paper on arxiv https://arxiv.org/pdf/2205.05862.pdf.

Setup

make sure that you have installed:

transformers==3.1.0
torch
tensorboard
tqdm
apex [from https://github.com/NVIDIA/apex]
nltk

Datasets

  • Language Modeling: yelp, yahoo, snli, ptb from download_datasets.md in Optimus. Put them in the ./data/optimus_dataset folder.
  • Low Resource Text Classification: yelp polarity dataset from Shen et. al., and put it to ./data folder directly. SST-2 and WNLI from GLUE, use download_glu_data.py to download them, and put both datasets in the ./glue_data folder.
  • Controllable Text Generation: yelp polarity dataset from Shen et. al., and put it to ./data folder directly.
  • Text Generation via Latent Manipulation: Any dataset mentioned above with pre-trained model weights in Language Modeling task.

Make sure that all data folders contain train.txt, test.txt, valid.txt files.

Dependencies

adavae
|____low_nlu
| |____run_cls.sh
| |____latent_classifier.py
| |____utils_glue.py
| |____...
|____controlgen
| |____oracle_cls.py
| |____run.sh
| |____run_vae_ctrl_gen.py
| |____...
|____README.md
|____dialogue
| |____run_spacefusion_gen.py
| |____...
|____data
|____src
| |____test.py
| |____adapters
| | |____vae.py
| | |____...
| |____adaVAE.py
| |____run_manipulation.sh
| |____run_lm.sh
| |____test.py
| |____...

Tasks

Language Modeling

model_LM

Run language modeling task by bash src/run_lm.sh, change arguments accordingly.

Low Resource Text Classification

model_cls

Run classification task by bash low_nlu/run_cls.sh, change arguments accordingly.

Controllable Text Generation

Before conducting controllable text generation , you need to:

  1. Pre-train an oracle classifier for controllability evaluation by python controlgen/oracle_cls.py.
  2. Pre-train the AdaVAE model with Language Modeling task and load the weights.

Finally run controllable text generation task by bash controlgen/run.sh, change arguments accordingly.

Text Generation via Latent Manipulation

Run manipulation or analogy generation by bash src/run_manipulation.sh, the default dataset for this task if yelp polarity dataset.

Visualization

TBD.

Dialog Generation

TBD.

Model Testing

TBD. [Check src/test.py for more information]

Others

Please email me or open an issue if you have any question.

if you find our work useful, please cite the paper :>

@article{tu2022adavae,
  title={AdaVAE: Exploring Adaptive GPT-2s in Variational Auto-Encoders for Language Modeling},
  author={Tu, Haoqin and Yang, Zhongliang and Yang, Jinshuai and Zhang, Siyu and Huang, Yongfeng},
  journal={arXiv preprint arXiv:2205.05862},
  year={2022}
}

We thank open sourced codes related to VAEs and parameter-efficient methods, which inspired our work !!

Core symbols most depended-on inside this repo

info
called by 214
src/logger.py
mean
called by 89
dialogue/eval_dialog_response.py
from_file
called by 22
src/data.py
_read_tsv
called by 21
low_nlu/utils_glue.py
num_params
called by 14
src/utils.py
tokenize
called by 12
src/utils.py
eval
called by 12
src/adapters/common.py
step
called by 11
controlgen/oracle_cls.py

Shape

Method 186
Function 94
Class 57

Languages

Python100%

Modules by API surface

low_nlu/utils_glue.py67 symbols
src/adapters/vae.py64 symbols
src/adapters/common.py43 symbols
src/data.py35 symbols
src/utils.py16 symbols
controlgen/ctrl_gen.py15 symbols
dialogue/eval_dialog_multi_response.py14 symbols
dialogue/eval_dialog_response.py12 symbols
metrics/cls_ft.py10 symbols
src/test.py8 symbols
dialogue/spacefusion.py8 symbols
dialogue/run_spacefusion_gen.py7 symbols

For agents

$ claude mcp add AdaVAE \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact