Jamba
PyTorch Implementation of Jamba: "Jamba: A Hybrid Transformer-Mamba Language Model"
install
$ pip install jamba
usage
# Import the torch library, which provides tools for machine learning
import torch
# Import the Jamba model from the jamba.model module
from jamba.model import Jamba
# Create a tensor of random integers between 0 and 100, with shape (1, 100)
# This simulates a batch of tokens that we will pass through the model
x = torch.randint(0, 100, (1, 100))
# Initialize the Jamba model with the specified parameters
# dim: dimensionality of the input data
# depth: number of layers in the model
# num_tokens: number of unique tokens in the input data
# d_state: dimensionality of the hidden state in the model
# d_conv: dimensionality of the convolutional layers in the model
# heads: number of attention heads in the model
# num_experts: number of expert networks in the model
# num_experts_per_token: number of experts used for each token in the input data
model = Jamba(
dim=512,
depth=6,
num_tokens=100,
d_state=256,
d_conv=128,
heads=8,
num_experts=8,
num_experts_per_token=2,
)
# Perform a forward pass through the model with the input data
# This will return the model's predictions for each token in the input data
output = model(x)
# Print the model's predictions
print(output)
License
MIT
Metadata
Release files for jamba 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| jamba-0.0.2.tar.gz | 8.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jamba-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.9 kB
Release files / jamba-0.0.2.tar.gz
| Download URL | jamba-0.0.2.tar.gz |
|---|---|
| Size | 8.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9fb7d3b5501351f297cae924a8b3efc241c37d949f20858b1241b16162275fa1
|
|
BLAKE2b-256 checksum How to use checksums |
10285bc6245545c7be050685d887e8e034a70054ce390db81ba197316266d1ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.2 CPython/3.11.0 Darwin/23.3.0
|
Release files / jamba-0.0.2-py3-none-any.whl
| Download URL | jamba-0.0.2-py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d1d918498812a5f748ad18b3d94eccbb4c9ebb0b1e997755837a721f62844eb2
|
|
BLAKE2b-256 checksum How to use checksums |
d66879333062974aaaed75ecd950821b13f62fbd2852f7ef08076124c4614436
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.2 CPython/3.11.0 Darwin/23.3.0
|