Skip to content

About

No description, website, or topics provided.

Resources

Stars

203 stars

Watchers

5 watching

Forks

Repository files navigation

Hyperserve

This repository contains the public implementations of the Megakernels generated by the Hyperkernel. This repository is in Alpha, and will be continuously updated over the next few weeks with more models and API simplifications, alongside performance improvements.

Requirements

The current megakernels are compiled for NVIDIA B300s: 4 for LLMs, 1 for driving, DNA, robotics and protein folding, 2 for world models, 8 for training. Each command runs on the first GPUs CUDA_VISIBLE_DEVICES lists. LLMs also need about 203 GB of host RAM for the Engram tables, mapped once for all 4 GPU processes.

The user must provide the model checkpoints as directories of .safetensors files; none is included in the repository. They are DeepSeek-V4.1-Flash with its tokenizer.json, openpilot v0.11.2's driving model, Evo 2 7B (arcinstitute/evo2_7b), Matrix-Game 3.0 (Skywork/Matrix-Game-3.0), ACT (lerobot/act_aloha_sim_transfer_cube_human), π₀-FAST (lerobot/pi0fast-base) and ESMFold (facebook/esmfold_v1).

Building needs Rust (see rust-toolchain.toml) and an NVIDIA driver R580 or newer:

cargo build --release

CLI format

The top level CLI branches on the type of host server you want to run:

hyperserve <llm | drive | dna | world | robot | fold> --model <name> --weights DIR [options]

Each command picks its kernels from kernels/b300/ and lists its options with --help.

LLMs

hyperserve llm --model deepseek-v4.1-flash --weights DIR [--preset c1] [--host 127.0.0.1] [--port 8000] [--api-key KEY]

Runs an OpenAI-compatible server on 4 GPUs. --weights is the checkpoint directory of deepseek-ai/DeepSeek-V4.1-Flash at revision 314113f8a7dadb388215396ba5fbee2c610a04d6, as published, which also holds the tokenizer. Requests are OpenAI chat or completion JSON; with --api-key (or HYPERSERVE_API_KEY) they must send Authorization: Bearer KEY.

There is one preset per maximum concurrency, all with a 1M-token context: c1, c2, c4, c5, c6, c7 and c8 (c6 and c7 run the c5 kernels). Each preset's prefill plan is tuned in the binary.

Driving

hyperserve drive --model openpilot --weights DIR --frames DIR [--count N] [--out DIR]

Runs openpilot's driving model over camera frames on 1 GPU and writes its outputs per frame. --frames holds new_img.u8: frames of 2 cameras by 6 planes of 128 by 256 bytes (the model's YUV 4:2:0 input), back to back. --weights is converted from openpilot v0.11.2's driving_supercombo.onnx (needs onnx, numpy and safetensors):

python scripts/openpilot_safetensors.py driving_supercombo.onnx DIR

DNA

hyperserve dna --model evo2-7b --weights DIR --sequence FILE [--steps 1500] [--top-k K] [--seed S]

Generates DNA with Evo 2 7B on 1 GPU from a prompt sequence: a FASTA or plain file of A, C, G and T, its header lines skipped, the prompt and its steps within 1,048,576 positions. --weights is converted from evo2_7b.pt of arcinstitute/evo2_7b (needs torch):

python scripts/evo2_safetensors.py evo2_7b.pt DIR

World models

hyperserve world --model mg3 --weights DIR [--steps 4] [--actions FILE] [--frames-out FILE]

Generates video with MG3 on 2 GPUs: a first clip of 57 frames, then --steps chunks of 40. --actions is a text file of one line per frame, w s a d pitch yaw. Frames are written, as raw 1280 by 704 RGB, only with --frames-out; otherwise only timings print. --weights is the base_distilled_model directory of Skywork/Matrix-Game-3.0, with MG-LightVAE_v2.pth's decoder converted into it (needs torch and safetensors):

python scripts/mg3_vae_safetensors.py MG-LightVAE_v2.pth DIR

Robotics

hyperserve robot --model act --weights DIR --images FILE [--states FILE] [--count N] [--out DIR]

Runs ACT (the Action Chunking Transformer) on 1 GPU, one control tick per camera image: the image and the joint state in, a chunk of 100 actions of 14 joints out, the whole tick in one kernel launch (the ResNet-18 backbone, the transformer encoder and decoder, the action head and the input and output normalization). --images holds raw u8 RGB images of 480 by 640, back to back, cycled when --count asks for more ticks. --states holds 14 f32 joint positions per tick (zeros if omitted). Each tick prints its time; with --out, actions.f32 holds every tick's chunk. --weights is converted from lerobot/act_aloha_sim_transfer_cube_human (needs torch, safetensors and lerobot 0.3.3; the backbone's batch norms are folded and the tick's input-independent tables computed once):

python scripts/act_safetensors.py CHECKPOINT_DIR DIR

π₀-FAST

hyperserve robot --model pi0-fast --weights DIR --images FILE --ids FILE (--lens N | --lens-file FILE) [--count 13] [--fixed60] [--out FILE]

Runs π₀-FAST on 1 GPU, one action chunk per request: the three cameras' SigLIP encoding, the PaliGemma prefill and the autoregressive FAST-token decode, all inside one resident kernel; the host pushes each observation through a ring and reads the chunk's tokens back. --images holds the 3 cameras' images as f32 [3, 3, 224, 224], each pixel x / 127.5 - 1; --ids the prompt's 200 ids (i32, padded with 0); --lens the prefix's real rows. Each chunk prints its time and token ids. --fixed60 runs the measured benchmark's kernel instead (exactly 60 tokens, end-of-sequence off). --weights is lerobot/pi0fast-base at revision 308eb844dabdf46cd9dcd5138c1988b7a234f1d9, as published (no conversion).

Protein folding

hyperserve fold --model esmfold --weights DIR (--sequence AA | --fasta FILE) [--folds 3] [--out FILE.pdb]

Folds a protein with ESMFold on 1 GPU, sequence in and structure out: the ESM-2 3B language model, 4 recycles of the 48-block folding trunk and the structure module, with the recycled states and distogram bins passed between them on the GPU. The kernels are compiled for each protein length: kernels/b300/esmfold/<residues>/ holds the lengths shipped, and a sequence of another length is refused with the list. Each fold prints its time and mean pLDDT; --out writes the last fold's backbone (N, CA, C) as PDB, with each residue's CA pLDDT as its B-factor. --weights is converted from facebook/esmfold_v1's pytorch_model.bin (needs torch and safetensors):

python scripts/esmfold_safetensors.py pytorch_model.bin config.json DIR

Training

scripts/qwen30b/qwen30b run --model DIR --out DIR [--tokens FILE] [--warmup 20] [--steps 60]

Trains Qwen3-30B-A3B (48 layers, BF16, global batch 64 by 2048) on 8 GPUs with one prebuilt kernel, kernels/b300/qwen30b-train, loaded by target/release/qwen30b_train. run fetches what is missing (Qwen/Qwen3-30B-A3B at revision ad44e777bcd18fa416d9da3bd8f70d33ebb85d39 and 400M tokens of FineWeb-Edu sample/10BT), trains and writes DIR/result.txt with the step time, tokens/s per GPU, MFU and the last loss. scripts/qwen30b/qwen30b with no arguments lists fetch, check and verify.

About

No description, website, or topics provided.

Resources

Stars

203 stars

Watchers

5 watching

Forks

Releases

Packages

Contributors

Languages