Want to contribute to pythae library ? That is cool! Thank you! 😄
If you want to contribute to this repo, please consider following this checklist
- Fork this repo
- Clone it on your local drive and install the library in editable mode
$ git clone git@github.com:your_github_name/benchmark_VAE.git
$ cd benchmark_VAE
$ pip install -e .
- Create a branch with an explicit name of your contribution
$ git checkout -b my_branch_with_contribution
-
Make sure you add the appropriate tests to test your feature. If the library test coverage reduces significantly, the contribution will raise some red flags.
-
Ensure that your contribution passes the existing test suite by running
pytest tests/
-
Polish your contribution using black and isort
-
Finally, open a pull request directly on your Github ! 🚀
If you want to add a new model please make sure that you followed the following checklist:
- Create a folder named
your_model_name
inpythae/models
and containg a file with the model implementation entitledyour_model_name_model.py
and a file with the model configuration namedyour_model_name_config.py
. - The
your_model_name_model.py
file contains a class with the name of your model inheriting from eitherAE
orVAE
classes depending on the model architecture. - The
your_model_name_config.py
files contains a dataclass inheriting from eitherAEConfig
orVAEConfig
. See for instancepythae/models/rae_l2
folder for a AE-based models andpythae/models/rhvae
folder for a VAE-based models - The model must have a forward method in which the loss is computed and returning a
ModelOutput
instance with the loss being stored under theloss
key. - You also implemented the classmethods
load_from_folder
and_load_model_config_from_folder
allowing to reload the model from a folder. Seepythae/models/rae_l2
for instance. - Make your tests in the
tests
folder. See for instancepythae/tests/test_rae_l2_tests.py
. You will see that the tests for the models look the same and cover them quite well. Hence, you can reuse this test suite as an inspiration to test your model.
If you want to add a new sampler please make sure that you followed the following checklist:
- Create a folder named
your_sampler_name
inpythae/samplers
and containg a file with the sampler implementation entitledyour_sampler_name_sampler.py
and a file with the sampler configuration (if needed) namedyour_sampler_name_config.py
. Seepythae/samplers/gaussian_mixture
for instance. - The
your_sampler_name_sampler.py
files contains a class with the name of yoyr sampler inheriting fromBaseSampler
. - The
your_sampler_name_config.py
files contains a dataclass inheriting fromBaseSamplerConfig
. Seepythae/samplers/gaussian_mixture/gaussian_mixture_config.py
. - The sampler must have a
sample
method able to save the generated images in a folder and return them if desired. - If the sampler needs to be fitted, a
fit
merhod can be implemented. Seepythae/samplers/gaussian_mixture/gaussian_mixture_samplers.py
for example. - Make your tests in the
tests
folder. See for instancepythae/tests/test_gaussian_mixture_sampler.py
. You will see that the tests for the samplers look the same, you can reuse this test suite as an inspiration to test your sampler.
In any case if you have any question, do not hesitate to reach out to me directly, I will be happy to help! 😄