Set of pytorch modules and utils to train code2seq model
Project description
code2seq
PyTorch's implementation of code2seq model.
Installation
You can easily install model through the PIP:
pip install code2seq
Usage
Minimal code example to run the model:
from os.path import join
import hydra
from code2seq.dataset import PathContextDataModule
from code2seq.model import Code2Seq
from code2seq.utils.vocabulary import Vocabulary
from omegaconf import DictConfig
from pytorch_lightning import Trainer
@hydra.main(config_path="configs")
def train(config: DictConfig):
vocabulary_path = join(config.data_folder, config.dataset.name, config.vocabulary_name)
vocabulary = Vocabulary.load_vocabulary(vocabulary_path)
model = Code2Seq(config, vocabulary)
data_module = PathContextDataModule(config, vocabulary)
trainer = Trainer(max_epochs=config.hyper_parameters.n_epochs)
trainer.fit(model, datamodule=data_module)
if __name__ == "__main__":
train()
Navigate to code2seq/configs to see examples of configs. If you had any questions then feel free to open the issue.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
code2seq-0.0.1.tar.gz
(20.7 kB
view details)
Built Distribution
code2seq-0.0.1-py3-none-any.whl
(32.2 kB
view details)
File details
Details for the file code2seq-0.0.1.tar.gz
.
File metadata
- Download URL: code2seq-0.0.1.tar.gz
- Upload date:
- Size: 20.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fd4952cc09cddeffe68da9eef6450a706422acce196b02659aa2e15117a6060 |
|
MD5 | cbfc90b5317a0b2487c215e92038a3b1 |
|
BLAKE2b-256 | 8f610c306e181e9ef8b1c27229efb16553b49508a820defff878f70653b6994e |
File details
Details for the file code2seq-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: code2seq-0.0.1-py3-none-any.whl
- Upload date:
- Size: 32.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b181e15589984d6e29f4aa3b0c6826d4892e683617df2745f0b069107c4654c7 |
|
MD5 | c594e94af4c9891a88d9f437d0333e43 |
|
BLAKE2b-256 | 11cd2ba325669d740a9a2d35fecbd97d5c85ae2941dad6f36ac98763cf7e884f |