Simple Mamba
Install
pip install simple-mamba
Usage
import torch
from simple_mamba import MambaBlock
# Define block parameters
dim = 512
hidden_dim = 128
heads = 8
in_channels = 3
out_channels = 3
kernel_size = 3
# Create an instance of MambaBlock
mamba_block = MambaBlock(
dim, hidden_dim, heads, in_channels, out_channels, kernel_size
)
# Create a sample input tensor
x = torch.randn(1, dim, dim)
# Pass the tensor through the MambaBlock
output = mamba_block(x)
print("Output shape:", output.shape)
SSM
import torch
from simple_mamba import SSM
# # Example usage
vocab_size = 10000 # Example vocabulary size
embed_dim = 256 # Example embedding dimension
state_dim = 512 # State dimension
num_layers = 2 # Number of state-space layers
model = SSM(vocab_size, embed_dim, state_dim, num_layers)
# Example input (sequence of word indices)
input_seq = torch.randint(
0, vocab_size, (32, 10)
) # Batch size of 32, sequence length of 10
# Forward pass
logits = model(input_seq)
print(logits.shape) # Should be [32, 10, vocab_size]
License
MIT
Citation
@misc{gu2023mamba,
title={Mamba: Linear-Time Sequence Modeling with Selective State Spaces},
author={Albert Gu and Tri Dao},
year={2023},
eprint={2312.00752},
archivePrefix={arXiv},
primaryClass={cs.LG}
}
Metadata
Release files for simple-mamba 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 |
|---|---|---|---|---|
| simple_mamba-0.0.4.tar.gz | 5.4 kB | Without provenance | Details for simple_mamba-0.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| simple_mamba-0.0.4-py3-none-any.whl | Python 3 | none | any | Details for simple_mamba-0.0.4-py3-none-any.whl |
Total release size: 11.5 kB
Release files / simple_mamba-0.0.4.tar.gz
| Download URL | simple_mamba-0.0.4.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d5e02b1cb4d44a1209917b48afb5d33e6a73d2e0489753bca050cbe0e7a8d1c3
|
|
BLAKE2b-256 checksum How to use checksums |
a3019616137e14481932a59bac640618d88385b2dab63434066cd333ee05439a
|
| 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 / simple_mamba-0.0.4-py3-none-any.whl
| Download URL | simple_mamba-0.0.4-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bbe1ce017b7580452e47757121da810c472796ce9f088da6f3683609c7528e2b
|
|
BLAKE2b-256 checksum How to use checksums |
81ceb6f9b3e62ab44881df43f90580715867ada4ad22832d77a41b671d928e1c
|
| 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 simple-mamba 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.