Instructions to use replicate/metal-flash-sdpa with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Kernels
How to use replicate/metal-flash-sdpa with Kernels:
# !pip install kernels from kernels import get_kernel # a version (or an explicit revision) is required; see the "Files and versions" tab for the available ones kernel = get_kernel("replicate/metal-flash-sdpa", version=1) - Notebooks
- Google Colab
- Kaggle
File size: 473 Bytes
364f72d | 1 2 3 4 5 6 7 8 9 10 11 12 | #include <torch/library.h>
#include "registration.h"
#include "torch_binding.h"
TORCH_LIBRARY_EXPAND(TORCH_EXTENSION_NAME, ops) {
ops.def("flash_attention_varlen(Tensor! out, Tensor query, Tensor key, Tensor value, Tensor cu_seqlens_q, Tensor cu_seqlens_k, int max_seqlen_q, int max_seqlen_k, bool do_causal, float scale, float softcapping) -> ()");
ops.impl("flash_attention_varlen", torch::kMPS, flash_attention_varlen);
}
REGISTER_EXTENSION(TORCH_EXTENSION_NAME)
|