Text Generation
RWKV
English
maba-instant
maba
maba-instant-v1
architecture
custom-architecture
state-space-model
ssm
mamba
mamba-3
recurrent
dgda
decoupled-gated-delta-attention
gated-deltanet
linear-attention
linear-recurrence
mla
multi-head-latent-attention
deepseek
flow-matching
continuous-flow
non-autoregressive
speculative-decoding
low-latency
microsecond-latency
cpu-inference
avx-512
avx2
simd
cpp
c++
fast-exit
early-exit
rlcd
brier-score
calibration
hft
algorithmic-trading
order-book
real-time
on-device
edge-ai
efficient-inference
zero-kv-cache
arena-allocator
sub-quadratic
llm
nlp
Instructions to use AndrewThompson1233/maba-instant-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- RWKV
How to use AndrewThompson1233/maba-instant-v1 with RWKV:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Download src/endurance.cpp from AndrewThompson1233/maba-instant-v1: direct link, hf CLI and curl.
- Browser
- Download file 3.33 kB
-
https://huggingface.co/AndrewThompson1233/maba-instant-v1/resolve/main/src/endurance.cpp
- Command line
-
hf download hf://AndrewThompson1233/maba-instant-v1/src/endurance.cpp
-
curl -L -o endurance.cpp https://huggingface.co/AndrewThompson1233/maba-instant-v1/resolve/main/src/endurance.cpp
3.33 kB
| int main() { | |
| const size_t num_threads = 4; | |
| const size_t iters_per_thread = 25000; | |
| const size_t total_requests = num_threads * iters_per_thread; | |
| maba::Config base_cfg; | |
| base_cfg.dim_model = 256; | |
| base_cfg.canvas_len = 32; | |
| base_cfg.canvas_dim = 128; | |
| base_cfg.vocab_size = 512; | |
| base_cfg.recurrence = maba::RecurrenceKind::DGDA; | |
| base_cfg.dgda_heads = 4; | |
| base_cfg.dgda_dk = 32; | |
| base_cfg.dgda_dv = 32; | |
| base_cfg.mla_latent_dim = 64; | |
| std::vector<std::thread> workers; | |
| std::atomic<size_t> completed{0}; | |
| std::atomic<size_t> fast_exits{0}; | |
| std::vector<double> latencies_us(total_requests); | |
| auto start_wall = std::chrono::high_resolution_clock::now(); | |
| for (size_t t = 0; t < num_threads; ++t) { | |
| workers.emplace_back([t, iters_per_thread, base_cfg, &completed, &fast_exits, &latencies_us]() { | |
| maba::MabaPipeline pipe(base_cfg); | |
| std::vector<float> input(base_cfg.dim_model); | |
| for (size_t i = 0; i < iters_per_thread; ++i) { | |
| float freq = 0.01f * static_cast<float>(t + 1); | |
| for (size_t d = 0; d < base_cfg.dim_model; ++d) { | |
| input[d] = 0.05f * std::sin(freq * static_cast<float>(i + d)); | |
| } | |
| bool force_gen = (i % 5 == 0); | |
| const auto& res = pipe.process(input.data(), maba::SchemaKind::Choice, force_gen); | |
| size_t idx = completed.fetch_add(1, std::memory_order_relaxed); | |
| latencies_us[idx] = res.latency.total_us; | |
| if (res.decision.fast_exit && !force_gen) { | |
| fast_exits.fetch_add(1, std::memory_order_relaxed); | |
| } | |
| } | |
| }); | |
| } | |
| for (auto& w : workers) { | |
| w.join(); | |
| } | |
| auto end_wall = std::chrono::high_resolution_clock::now(); | |
| double total_wall_ms = std::chrono::duration<double, std::milli>(end_wall - start_wall).count(); | |
| std::sort(latencies_us.begin(), latencies_us.end()); | |
| double sum_lat = std::accumulate(latencies_us.begin(), latencies_us.end(), 0.0); | |
| double avg_lat = sum_lat / static_cast<double>(total_requests); | |
| double p50 = latencies_us[total_requests * 50 / 100]; | |
| double p90 = latencies_us[total_requests * 90 / 100]; | |
| double p99 = latencies_us[total_requests * 99 / 100]; | |
| double p999 = latencies_us[total_requests * 999 / 1000]; | |
| std::cout << std::fixed << std::setprecision(2); | |
| std::cout << "requests " << total_requests << "\n"; | |
| std::cout << "threads " << num_threads << "\n"; | |
| std::cout << "wall_time_ms " << total_wall_ms << "\n"; | |
| std::cout << "throughput_req_sec " << (static_cast<double>(total_requests) / (total_wall_ms / 1000.0)) << "\n"; | |
| std::cout << "latency_avg_us " << avg_lat << "\n"; | |
| std::cout << "latency_p50_us " << p50 << "\n"; | |
| std::cout << "latency_p90_us " << p90 << "\n"; | |
| std::cout << "latency_p99_us " << p99 << "\n"; | |
| std::cout << "latency_p999_us " << p999 << "\n"; | |
| std::cout << "fast_exit_pct " << (100.0 * fast_exits.load() / static_cast<double>(total_requests)) << "\n"; | |
| return 0; | |
| } | |