code2seq-1.2.0
توضیحات
Set of pytorch modules and utils to train code2seq model
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | code2seq-1.2.0 |
| نام | code2seq |
| نسخه کتابخانه | 1.2.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Egor Spirin |
| ایمیل نویسنده | spirin.egor@gmail.com |
| آدرس صفحه اصلی | https://github.com/JetBrains-Research/code2seq |
| آدرس اینترنتی | https://pypi.org/project/code2seq/ |
| مجوز | MIT |
# code2seq
[](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)
[](https://github.com/SpirinEgor/code2seq/actions?query=workflow%3ABuild)
[](https://github.com/psf/black)
PyTorch's implementation of code2seq model.
## Installation
You can easily install model through the PIP:
```shell
pip install code2seq
```
## Usage
Minimal code example to run the model:
```python
from argparse import ArgumentParser
from omegaconf import DictConfig, OmegaConf
from pytorch_lightning import Trainer
from code2seq.data.path_context_data_module import PathContextDataModule
from code2seq.model import Code2Seq
def train(config: DictConfig):
# Load data module
data_module = PathContextDataModule(config.data_folder, config.data)
data_module.prepare_data()
data_module.setup()
# Load model
model = Code2Seq(
config.model,
config.optimizer,
data_module.vocabulary,
config.train.teacher_forcing
)
trainer = Trainer(max_epochs=config.hyper_parameters.n_epochs)
trainer.fit(model, datamodule=data_module)
if __name__ == "__main__":
__arg_parser = ArgumentParser()
__arg_parser.add_argument("config", help="Path to YAML configuration file", type=str)
__args = __arg_parser.parse_args()
__config = OmegaConf.load(__args.config)
train(__config)
```
Navigate to [config](config) directory to see examples of configs.
If you have any questions, then feel free to open the issue.
نیازمندی
| مقدار | نام |
|---|---|
| ~=2.1.1 | omegaconf |
| >=1.10.0 | torch |
| ~=1.5.0 | pytorch-lightning |
| ~=0.12.0 | wandb |
| >=0.4.0 | commode-utils |
نحوه نصب
نصب پکیج whl code2seq-1.2.0:
pip install code2seq-1.2.0.whl
نصب پکیج tar.gz code2seq-1.2.0:
pip install code2seq-1.2.0.tar.gz