Skip-Thoughts.torch for Pytorcb
Skip-Thoughts.torch is a lightweight porting of skip-thought pretrained models from Theano to Pytorch.
Installation
Install from pip
pip install skipthoughts
Install from repo
git clone https://github.com/Cadene/skip-thoughts.torch.gitcd skip-thoughts.torch/pytorchpython setup.py install
Available pretrained models
UniSkip
It uses the nn.GRU layer from torch with the cudnn backend. It is the fastest implementation, but the dropout is sampled after each time-step in the cudnn implementation... (equals bad regularization)
DropUniSkip
It uses the nn.GRUCell layer from torch with the cudnn backend. It is slightly slower than UniSkip, however the dropout is sampled once for all time-steps in a sequence (good regularization).
BayesianUniSkip
It uses a custom GRU layer with a torch backend. It is at least two times slower than UniSkip, however the dropout is sampled once for all time-steps for each Linear (best regularization).
BiSkip
Equivalent to UniSkip, but with a bi-sequential GRU.
Quick example
import torch
from torch.autograd import Variable
import sys
sys.path.append('skip-thoughts.torch/pytorch')
from skipthoughts import UniSkip
dir_st = 'data/skip-thoughts'
vocab = ['robots', 'are', 'very', 'cool', '<eos>', 'BiDiBu']
uniskip = UniSkip(dir_st, vocab)
input = Variable(torch.LongTensor([
[1,2,3,4,0], # robots are very cool 0
[6,2,3,4,5] # bidibu are very cool <eos>
])) # <eos> token is optional
print(input.size()) # batch_size x seq_len
output_seq2vec = uniskip(input, lengths=[4,5])
print(output_seq2vec.size()) # batch_size x 2400
output_seq2seq = uniskip(input)
print(output_seq2seq.size()) # batch_size x seq_len x 2400
Metadata
Release files for skipthoughts 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| skipthoughts-0.0.1.tar.gz | 9.8 kB | Without provenance | Details for skipthoughts-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| skipthoughts-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for skipthoughts-0.0.1-py3-none-any.whl |
Total release size: 18.9 kB
Release files / skipthoughts-0.0.1.tar.gz
| Download URL | skipthoughts-0.0.1.tar.gz |
|---|---|
| Size | 9.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8e4f87a29acd978db8a8b5f2d8ee0e9e1eef7d20845ce30c2dd3cf2f11b4f626
|
|
BLAKE2b-256 checksum How to use checksums |
7b01b6c1126dc402e0d09d90f0fbaf1a6e95e4c4a77293d742d6300c68d164ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
|
Release files / skipthoughts-0.0.1-py3-none-any.whl
| Download URL | skipthoughts-0.0.1-py3-none-any.whl |
|---|---|
| Size | 9.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5c5664194d4d37a3d29698147bcd103c9cbb7573f698abad0248e813e6064a4e
|
|
BLAKE2b-256 checksum How to use checksums |
3410e0b1f148f19b2a792f3811822feeb7f5561de5ae2fffe9b9544642447cdc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
|
Security for skipthoughts 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.