Instructions to use replicate/megablocks with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Kernels
How to use replicate/megablocks 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/megablocks", version=1) - Notebooks
- Google Colab
- Kaggle
Download csrc/bak.ops.cu from replicate/megablocks: direct link, hf CLI and curl.
- Browser
- Download file 745 Bytes
-
https://huggingface.co/replicate/megablocks/resolve/main/csrc/bak.ops.cu
- Command line
-
hf download hf://replicate/megablocks/csrc/bak.ops.cu
-
curl -L -o bak.ops.cu https://huggingface.co/replicate/megablocks/resolve/main/csrc/bak.ops.cu
745 Bytes
| namespace megablocks { | |
| PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { | |
| m.def("exclusive_cumsum", &exclusive_cumsum, "batched exclusive cumsum."); | |
| m.def("histogram", &histogram, "even width histogram."); | |
| m.def("inclusive_cumsum", &inclusive_cumsum, "batched inclusive cumsum"); | |
| m.def("indices", &indices, "indices construction for sparse matrix."); | |
| m.def("replicate_forward", &replicate_forward, "(fwd) replicate a vector dynamically."); | |
| m.def("replicate_backward", &replicate_backward, "(bwd) replicate a vector dynamically."); | |
| m.def("sort", &sort, "key/value sort."); | |
| } | |
| } // namespace megablocks | |