Support MoE sigmoid scoring - #1472
Conversation
Signed-off-by: catswe <212922539+catswe@users.noreply.github.com>
Signed-off-by: catswe <212922539+catswe@users.noreply.github.com>
Signed-off-by: catswe <212922539+catswe@users.noreply.github.com>
Signed-off-by: catswe <212922539+catswe@users.noreply.github.com>
Signed-off-by: catswe <212922539+catswe@users.noreply.github.com>
a4f0917 to
c389796
Compare
Signed-off-by: catswe <212922539+catswe@users.noreply.github.com>
Signed-off-by: catswe <212922539+catswe@users.noreply.github.com>
Signed-off-by: catswe <212922539+catswe@users.noreply.github.com>
Signed-off-by: catswe <212922539+catswe@users.noreply.github.com>
Signed-off-by: catswe <212922539+catswe@users.noreply.github.com>
Signed-off-by: catswe <212922539+catswe@users.noreply.github.com>
Signed-off-by: catswe <212922539+catswe@users.noreply.github.com>
|
The newly written unit test failed since bf16 input causes a def apply_scoring_fn(scoring_fn: str, x):
match scoring_fn:
case "softmax":
return jax.nn.softmax(x, axis=-1)
case "sigmoid":
# TODO(catswe): switch to jax.nn.sigmoid once bf16 Mosaic lowering bug is fixed
ones = jnp.ones_like(x)
return ones / (ones + jnp.exp(-x))
case _:
raise NotImplementedError(
f"Unsupported scoring function: {scoring_fn}")Let me know what direction we want to move towards (e.g., move forward with the workaround, or wait for the bug fix to land and upgrade Jax version) |
thanks for identifying this issue! I'll run some tests myself as well and get back to you if i find anything. |
|
I pushed up a small change to manually implement sigmoid. Edit: Apologies for the mass reviewers ping. Messed up my force push 😅 |
400c0cb to
330359c
Compare
Signed-off-by: catswe <212922539+catswe@users.noreply.github.com>
5ac93c6 to
b518d92
Compare
just ran a quick test with latest jax version and it still triggered error. so current approach seems good to me. current approach of manually implementing sigmoid lgtm. thank you for the contribution! |
Signed-off-by: catswe <212922539+catswe@users.noreply.github.com> Signed-off-by: Xing Fang <xing.fang@anyscale.com>
Description
This enables running GLM models #1104. I referenced this commit from Kyuyeun 652318d
Tests
Updated tpu-inference/tests/kernels/fused_moe_v1_test.py
Checklist
Before submitting this PR, please make sure: