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.4.tar.gz
(21.2 kB
view details)
Built Distribution
code2seq-0.0.4-py3-none-any.whl
(32.2 kB
view details)
File details
Details for the file code2seq-0.0.4.tar.gz
.
File metadata
- Download URL: code2seq-0.0.4.tar.gz
- Upload date:
- Size: 21.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 230280f65bfe6bc7d3d4a016df20a2374e3f3b19448216bcac93a9fa57c8149e |
|
MD5 | c24368099f206d320bc0e61c05d889a0 |
|
BLAKE2b-256 | 96a2739d43300d91a45def832fb4c78143e52ba375c76693b93d4aa537f851d5 |
File details
Details for the file code2seq-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: code2seq-0.0.4-py3-none-any.whl
- Upload date:
- Size: 32.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 468d349251ce84cdd1ae920bdc81afec2883df76f689ff4fa8bf82b4c7dcb2b0 |
|
MD5 | c4cd88dbb7a78bfa9b297b04a75cac8f |
|
BLAKE2b-256 | 37933ce0a2d9a1134e9e0ec519f6a00c0a71df866dced6380f40581b1937b3c7 |