Transformer-VAE (WIP)
Transformer-VAE's learn smooth latent spaces of discrete sequences without any explicit rules in their decoders.
This can be used for program synthesis, drug discovery, music generation and much more!
To see how it works checkout this blog post.
This repo is in active development but I should be coming out with full a release soon.
Install
Install using pip:
pip install transformer_vae
Usage
You can exececute the module to easily train it on your own data.
python -m transformer_vae \
--project_name="T5-VAE" \
--output_dir=poet \
--do_train \
--huggingface_dataset=poems \
Or you can import Transformer-VAE to use as a package much like a Huggingface model.
from transformer_vae import T5_VAE_Model
model = T5_VAE_Model.from_pretrained('t5-vae-poet')
Training
Setup Weights & Biasis for logging, see client.
Get a dataset to model, must be represented with text. This is what we will be interpolating over.
This can be a text file with each line representing a sample.
python -m transformer_vae \
--project_name="T5-VAE" \
--output_dir=poet \
--do_train \
--train_file=poems.txt \
Alternatively seperate each sample with a line containing only <|endoftext|> seperating samples:
python -m transformer_vae \
--project_name="T5-VAE" \
--output_dir=poet \
--do_train \
--train_file=poems.txt \
--multiline_samples
Alternatively provide a Huggingface dataset.
python -m transformer_vae \
--project_name="T5-VAE" \
--output_dir=poet \
--do_train \
--dataset=poems \
--content_key text
Experiment with different parameters.
Once finished upload to huggingface model hub.
# TODO
Explore the produced latent space using Colab_T5_VAE.ipynb or vising this Colab page.
Contributing
Install with tests:
pip install -e .[test]
Possible contributions to make:
- Could the docs be more clear? Would it be worth having a docs site/blog?
- Use a Funnel transformer encoder, is it more efficient?
- Allow defining alternative tokens set.
- Store the latent codes from the previous step to use in MMD loss so smaller batch sizes are possible.
Feel free to ask what would be useful!
Metadata
Release files for transformer-vae 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| transformer_vae-0.0.2.tar.gz | 24.3 kB | Without provenance | Details for transformer_vae-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| transformer_vae-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for transformer_vae-0.0.2-py3-none-any.whl |
Total release size: 51.7 kB
Release files / transformer_vae-0.0.2.tar.gz
| Download URL | transformer_vae-0.0.2.tar.gz |
|---|---|
| Size | 24.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d89d5f03a5f2753ed24f922e1e09fe7e84902ceb45ba35e1b8765cca8660d7b6
|
|
BLAKE2b-256 checksum How to use checksums |
0a73d1be69980961f9001beaadf70f10e5f36a418c74f2ab88753d299d3b1f31
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.9
|
Release files / transformer_vae-0.0.2-py3-none-any.whl
| Download URL | transformer_vae-0.0.2-py3-none-any.whl |
|---|---|
| Size | 27.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2ea8a09b9c518a9e91c0752f3af404f9de11c972651da047654fa46deeb782da
|
|
BLAKE2b-256 checksum How to use checksums |
0710d0d7557be61bcd71b30e847d3a77b31304cd48ae689c086fc984fe017612
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.9
|
Security for transformer-vae 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.