Skip to main content

Hybrid Mamba-2 + Attention + MoE language models, easy to load and run.

Project description

qorva

Hybrid Mamba-2 + Attention + Mixture-of-Experts language models — easy to load, run, and fine-tune.

pip install qorva

Quick start

from qorva import load_pretrained, generate

model = load_pretrained("your_username/qorva-model-fast")
print(generate(model, "Once upon a time in a small village,", max_new_tokens=100))

Or, using the bound method directly:

from qorva import load_pretrained

model = load_pretrained("your_username/qorva-model-fast")
print(model.generate("Once upon a time", max_new_tokens=100, temperature=0.8))

Command line

qorva-generate --model your_username/qorva-model-fast --prompt "Once upon a time"

Build from scratch

from qorva import QorvaModel, QorvaConfig

cfg   = QorvaConfig.nano_full()      # ~370M, Mamba + Attention + MoE
model = QorvaModel(cfg)
print(f"{model.num_parameters()/1e6:.1f}M parameters")

Available presets:

  • QorvaConfig.micro() — ~32M, for fast experimentation
  • QorvaConfig.nano_full() — ~370M, Mamba + Attention + MoE
  • QorvaConfig.nano_baseline() — ~370M, Attention-only baseline

Push your trained model to HuggingFace

from qorva import push_to_hub

push_to_hub(model, "your_username/qorva-nano-370m", token="hf_...")

Perplexity evaluation

from qorva.utils.generation import compute_perplexity

ppl = compute_perplexity(model, "Some evaluation text here...")
print(f"PPL: {ppl:.2f}")

Architecture

Each layer mixes two branches with learnable weights:

x' = x + alpha * Mamba2(LN(x)) + beta * GQAttention(LN(x))
x  = x' + LatentMoE(LN(x'))      # stage="full" only
Stage Branches
attn_only Attention + FFN
mamba_only Mamba + FFN
hybrid Mamba + Attention + FFN
full Mamba + Attention + LatentMoE

License

Apache-2.0

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

qorva-0.1.0.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qorva-0.1.0-py3-none-any.whl (17.8 kB view details)

Uploaded Python 3

File details

Details for the file qorva-0.1.0.tar.gz.

File metadata

  • Download URL: qorva-0.1.0.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for qorva-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0d684b116102f213e138a417210930349ff84f8cbb4a58692b22048abd093db0
MD5 ad60838eaf8a6487e6a1b2e3d953ee2b
BLAKE2b-256 f4babe27199898eb2c17dddce97cee9e98c75730e8715418c161e5cacd809e98

See more details on using hashes here.

File details

Details for the file qorva-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: qorva-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for qorva-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 26d562488d7cf7c6b23ab6fd8afb54ad11ce2ca34f791bce2c54deb9a1b6d392
MD5 cda7b0aa34b6d70235a412e29f87629a
BLAKE2b-256 14f317a26dca2a4b7ef0194f77c2f48bc2a40c812f307c1dfca8591a27c4384c

See more details on using hashes here.

Supported by

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