Switch Transformers
Implementation of Switch Transformers from the paper: "Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity" in PyTorch, Einops, and Zeta. PAPER LINK
Installation
pip install switch-transformers
Usage
import torch
from switch_transformers import SwitchTransformer
# Generate a random tensor of shape (1, 10) with values between 0 and 100
x = torch.randint(0, 100, (1, 10))
# Create an instance of the SwitchTransformer model
# num_tokens: the number of tokens in the input sequence
# dim: the dimensionality of the model
# heads: the number of attention heads
# dim_head: the dimensionality of each attention head
model = SwitchTransformer(
num_tokens=100, dim=512, heads=8, dim_head=64
)
# Pass the input tensor through the model
out = model(x)
# Print the shape of the output tensor
print(out.shape)
Citation
@misc{fedus2022switch,
title={Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity},
author={William Fedus and Barret Zoph and Noam Shazeer},
year={2022},
eprint={2101.03961},
archivePrefix={arXiv},
primaryClass={cs.LG}
}
License
MIT
Metadata
Release files for switch-transformers 0.0.4
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 |
|---|---|---|---|---|
| switch_transformers-0.0.4.tar.gz | 5.6 kB | Without provenance | Details for switch_transformers-0.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| switch_transformers-0.0.4-py3-none-any.whl | Python 3 | none | any | Details for switch_transformers-0.0.4-py3-none-any.whl |
Total release size: 11.2 kB
Release files / switch_transformers-0.0.4.tar.gz
| Download URL | switch_transformers-0.0.4.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e80972012db0ac1f73d922b31f5d0a05af4402a0859ca6bf03279ecf64f536fc
|
|
BLAKE2b-256 checksum How to use checksums |
93549467b85567de5db2a86f0e2884361a8bc5acf6763873354c2b5398c55847
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.2 CPython/3.11.0 Darwin/22.4.0
|
Release files / switch_transformers-0.0.4-py3-none-any.whl
| Download URL | switch_transformers-0.0.4-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e57f21e358197e6e8347fb59703104b7a1c42bf2ccded4d95475614e145f7d1b
|
|
BLAKE2b-256 checksum How to use checksums |
b8c6ea0db98bfc80cc07851dea77af3124a28e0cbede49375129362e8a5d714d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.2 CPython/3.11.0 Darwin/22.4.0
|
Security for switch-transformers 0.0.4
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.