Industrial-grade implementation of seq2seq algorithm based on Pytorch, integrated beam search algorithm.
Project description
seq2seq
Industrial-grade implementation of seq2seq algorithm based on Pytorch, integrated beam search algorithm.
seq2seq is based on other excellent open source projects, this project has the following highlights:
- easy to train, predict and deploy;
- lightweight implementation;
- multitasking support (including dialogue generation and machine translation).
Model description
- Encoder: Bidirectional GRU
- Decoder: GRU with Attention Mechanism
- Bahdanau Attention: Neural Machine Translation by Jointly Learning to Align and Translate
- Luong Attention: Effective Approaches to Attention-based Neural Machine Translation
- Diversity Promoting Beam Search: A Simple, Fast Diverse Decoding Algorithm for Neural Generation
Install
seq2seq is dependent on PyTorch. Two ways to install:
Install seq2seq from Pypi:
pip install seq2seq-pytorch
Install seq2seq from the Github source:
git clone https://github.com/Chiang97912/seq2seq.git
cd seq2seq
python setup.py install
Usage
Train
from seq2seq.model import Seq2Seq
sources = ['...']
targets = ['...']
model = Seq2Seq('seq2seq-model', embed_size=256, hidden_size=512, lang4src='en', lang4tgt='en', device='cuda:0')
model.fit(sources, targets, epochs=20, batch_size=64)
Test
from seq2seq.model import Seq2Seq
model = Seq2Seq('seq2seq-model')
outputs = model.generate('...', beam_size=3, method='greedy')
print(outputs)
Dependencies
pythonversion 3.6pyTorchversion 1.9.0torchtextversion 0.3.1numpyversion 1.19.5nltkversion 3.5jiebaversion 0.42.1
References
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file seq2seq-pytorch-0.1.2.tar.gz.
File metadata
- Download URL: seq2seq-pytorch-0.1.2.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.6.1 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28d6a868f3b85be47cb1a069c3efccfcb33d41d15f8b52e12e40e5eb3e839675
|
|
| MD5 |
f4ea68307d3679de41e34370947d102b
|
|
| BLAKE2b-256 |
e00791858d769a76b048505d5fb64e123148d5a1ba59eb42e0201b81e1c8d07a
|
File details
Details for the file seq2seq_pytorch-0.1.2-py2.py3-none-any.whl.
File metadata
- Download URL: seq2seq_pytorch-0.1.2-py2.py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.6.1 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82df2014028960e6dad306103f6e8f70dc71e0d88892c9427ef358b2fb549d7f
|
|
| MD5 |
278f38e856f6b6f3d0e63cfbc10a6b6b
|
|
| BLAKE2b-256 |
7cf912a41d3dc7da8729249f5d843928e3d9e419d92ae86ce8f61ddf1fcec016
|