Skip to content

Kyojin: open-source engine that runs 100 GB-class open models (GLM-5.3, Qwen3.8, DeepSeek V4.1) on one desktop machine. AMD Strix Halo, NVIDIA RTX and Apple Mac. OpenAI API, built on ExLlamaV3.

2.8 KB
Raw Blame
py::class_<BC_BlockSparseMLP, std::shared_ptr<BC_BlockSparseMLP>>(m, "BC_BlockSparseMLP").def
(
    py::init<
        at::Tensor,
        at::Tensor,
        at::Tensor,
        at::Tensor,
        at::Tensor,
        at::Tensor,
        at::Tensor,
        at::Tensor,
        at::Tensor,
        c10::optional<at::Tensor>,
        at::Tensor,
        at::Tensor,
        at::Tensor,
        at::Tensor,
        int,
        int,
        at::Tensor,
        at::Tensor,
        at::Tensor,
        int,
        bool,
        bool,
        at::Tensor,
        at::Tensor,
        at::Tensor,
        int,
        bool,
        bool,
        at::Tensor,
        at::Tensor,
        at::Tensor,
        int,
        bool,
        bool,
        bool,
        bool,
        bool,
        std::shared_ptr<BC_GatedMLP>,
        std::shared_ptr<BC_LinearFP16>,
        float,
        std::vector<std::shared_ptr<BC_LinearEXL3>>,
        std::vector<std::shared_ptr<BC_LinearEXL3>>,
        std::vector<std::shared_ptr<BC_LinearEXL3>>,
        at::Tensor,
        at::Tensor,
        at::Tensor,
        at::Tensor,
        c10::optional<at::Tensor>,
        c10::optional<at::Tensor>,
        c10::optional<at::Tensor>,
        bool
    >(),
    py::arg("yh2"),
    py::arg("yh"),
    py::arg("interm_gu"),
    py::arg("interm_g"),
    py::arg("interm_u"),
    py::arg("interm_a"),
    py::arg("interm_a2"),
    py::arg("out_d"),
    py::arg("out_d2"),
    py::arg("out_d_sh"),
    py::arg("coop_ctr"),
    py::arg("had_u"),
    py::arg("dq_temp_up"),
    py::arg("dq_temp_down"),
    py::arg("min_expert"),
    py::arg("max_expert"),
    py::arg("gate_ptrs_trellis"),
    py::arg("gate_ptrs_suh"),
    py::arg("gate_ptrs_svh"),
    py::arg("gate_K"),
    py::arg("gate_mcg"),
    py::arg("gate_mul1"),
    py::arg("up_ptrs_trellis"),
    py::arg("up_ptrs_suh"),
    py::arg("up_ptrs_svh"),
    py::arg("up_K"),
    py::arg("up_mcg"),
    py::arg("up_mul1"),
    py::arg("down_ptrs_trellis"),
    py::arg("down_ptrs_suh"),
    py::arg("down_ptrs_svh"),
    py::arg("down_K"),
    py::arg("down_mcg"),
    py::arg("down_mul1"),
    py::arg("act_silu"),
    py::arg("act_gelu"),
    py::arg("act_silu_oai"),
    py::arg("shared_experts"),
    py::arg("shared_gate"),
    py::arg("act_limit"),
    py::arg("gates"),
    py::arg("ups"),
    py::arg("downs"),
    py::arg("gu_trellis_ptr"),
    py::arg("gu_suh_ptr"),
    py::arg("gu_svh_ptr"),
    py::arg("out_bszn"),
    py::arg("gate_bias_ptrs") = py::none(),
    py::arg("up_bias_ptrs") = py::none(),
    py::arg("down_bias_ptrs") = py::none(),
    py::arg("act_relu2") = false
)
.def("run_bszN", &BC_BlockSparseMLP::run_bszN, py::arg("y"), py::arg("selected_experts"), py::arg("routing_weights"), py::arg("with_shared") = true)
.def("run_single_expert", &BC_BlockSparseMLP::run_single_expert)
.def("run_single_expert_dq", &BC_BlockSparseMLP::run_single_expert_dq);