Skip to main content

a Pytorch implementation of the Reformer network (https://openreview.net/forum?id=rkgNKkHtvB)

Project description

Reformer

a Pytorch implementation of the Reformer Network (https://openreview.net/pdf?id=rkgNKkHtvB)

Much of this code base is loosely translated from the jax implementation found here from Google: https://github.com/google/trax/blob/master/trax/models/research/reformer.py

How to use

All of the hard work has been taken care of, all you need to do is instantiate the model!

from reformer_lm.reformer_lm import ReformerLM
import torch

test = torch.rand((4, 4, 64))
model = ReformerLM(
    vocab_size=300000,
    d_in=test.shape[-2],
    d_out=test.shape[-1],
    n_layers=6,
    n_heads=1,
    attn_k=test.shape[-1],
    attn_v=test.shape[-1],
)

output = model(test)
print(output)

This model is still in testing, and will therefore continue to see updates. PRs are welcomed! Feel free to take advantage of the Docker container for development. I have been working in notebooks to test code with the original paper, and then I refactor my code back into the package

paypal

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

reformer_lm-1.0.1.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

reformer_lm-1.0.1-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file reformer_lm-1.0.1.tar.gz.

File metadata

  • Download URL: reformer_lm-1.0.1.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.0

File hashes

Hashes for reformer_lm-1.0.1.tar.gz
Algorithm Hash digest
SHA256 e607623fc53b06d2ad459c467a63fa2708e5e0e05aa7909adf309a6347820f37
MD5 a23402e347c397adab2a3ba69761af91
BLAKE2b-256 2928557c9269d29bd780fbda91e46d39ae03ab30b38c8be2f8f9610a278b8255

See more details on using hashes here.

File details

Details for the file reformer_lm-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: reformer_lm-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.0

File hashes

Hashes for reformer_lm-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7cae226bb9eb07e74dbf8b643b595fadf6bf6166f727f4fc46f1d4929892bb90
MD5 2db14b8dca1ec44b9511322832061918
BLAKE2b-256 7ad375ecb2cf438a06bd8031dd427427e46f6229df37b262fe9dbdcf6bff454c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page