Instructions to use replicate/flashinfer-draft with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Kernels
How to use replicate/flashinfer-draft with Kernels:
# !pip install kernels from kernels import get_kernel kernel = get_kernel("replicate/flashinfer-draft") - Notebooks
- Google Colab
- Kaggle
File size: 1,292 Bytes
57c3a10 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | # NOTE: Torch needs to be imported before the custom
# extensions. Otherwise libc10.so cannot be found.
import torch
from ._ops import ops
def gelu_and_mul(out, input, enable_pdl):
return ops.gelu_and_mul(out, input, enable_pdl)
def gelu_tanh_and_mul(out, input, enable_pdl):
return ops.gelu_tanh_and_mul(out, input, enable_pdl)
def silu_and_mul(out, input, enable_pdl):
return ops.silu_and_mul(out, input, enable_pdl)
# def batch_decode_with_paged_kv_cache_plan_swa_false(
# float_workspace_buffer,
# int_workspace_buffer,
# page_locked_int_workspace_buffer,
# indptr,
# batch_size,
# num_qo_heads,
# num_kv_heads,
# page_size,
# enable_cuda_graph,
# window_left,
# logits_soft_cap,
# head_dim_qk,
# head_dim_vo,
# empty_q_data,
# empty_kv_data
# ):
# return ops.BatchDecodeWithPagedKVCachePlan_swa_false(
# float_workspace_buffer,
# int_workspace_buffer,
# page_locked_int_workspace_buffer,
# indptr,
# batch_size,
# num_qo_heads,
# num_kv_heads,
# page_size,
# enable_cuda_graph,
# window_left,
# logits_soft_cap,
# head_dim_qk,
# head_dim_vo,
# empty_q_data,
# empty_kv_data
# )
|