Views
No views yet
meta-llama/Llama-3.1-8B-Instruct at load time (subject to Meta's Llama 3.1 license — you must accept it on the base model's page). Built with Llama.kernels/RMSNorm, kernels/MLP, and kernels/Attention ship as precompiled .so binaries only — the CUDA source (kernel.cu) is not included in this release. They will only load on a matching stack:cp312)pip install will succeed but importing the extension will fail or crash. If you need a different environment, you'll need to rebuild from source — source is not currently published here.pip install -r requirements.txt1pip install kernels/RMSNorm
2pip install kernels/MLP
3pip install kernels/Attentionmodeling_llama.py (RMSNorm/MLP/Attention forward methods only, verified by diff against the upstream release). Install upstream transformers at that version, then drop in the patched file from patched_transformers/:1pip install transformers==5.8.1
2python -c "import transformers, os, shutil; d = os.path.dirname(transformers.__file__) + '/models/llama'; shutil.copy('patched_transformers/modeling_llama.py', d)"MAX_JOBS for parallel compilation (otherwise the build can take 8+ hours):1# Install build dependencies (ninja enables parallel C++ compilation — required)
2pip install packaging psutil ninja
3
4# Verify ninja is working before proceeding
5ninja --version && echo $?
6# Must print a version string and exit code 0.
7# If exit code is non-zero, re-run: pip install --force-reinstall ninja
8
9# Install flash-attn with parallel jobs (takes 60–90 min on first install)
10MAX_JOBS=8 pip install flash-attn --no-build-isolation
11
12# Verify
13python -c "import flash_attn; print('flash-attn OK, version:', flash_attn.__version__)"transformers library — the CUDA kernels are injected transparently:1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-3.1-8B-Instruct")
4tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-3.1-8B-Instruct")
5
6inputs = tokenizer("Hello, how are you?", return_tensors="pt").to("cuda")
7model = model.cuda()
8outputs = model.generate(**inputs, max_new_tokens=200)
9print(tokenizer.decode(outputs[0], skip_special_tokens=True))transformers serve:transformers serve --model meta-llama/Llama-3.1-8B-Instruct --port 8000patched_transformers/ contains targeted modifications only to the RMSNorm, MLP, and Attention forward methods, based on transformers v5.8.1.meta-llama/Llama-3.1-8B-Instruct weights is gated — you must accept Meta's Llama 3.1 license on the base model's page before from_pretrained will succeed.