Download code/flash-linear-attention/tests/models/test_modeling_bitnet.py from amonshano/echo: direct link, hf CLI and curl.
- Browser
- Download file 1.57 kB
-
https://huggingface.co/amonshano/echo/resolve/main/code/flash-linear-attention/tests/models/test_modeling_bitnet.py
- Command line
-
hf download hf://amonshano/echo/code/flash-linear-attention/tests/models/test_modeling_bitnet.py
-
curl -L -o test_modeling_bitnet.py https://huggingface.co/amonshano/echo/resolve/main/code/flash-linear-attention/tests/models/test_modeling_bitnet.py
1.57 kB
| import pytest | |
| import torch | |
| from fla.models import BitNetConfig | |
| from .test_modeling_base import run_test_generation, run_test_model_forward_backward | |
| # =================================================================================== | |
| # Test for Modeling (Forward/Backward Pass) | |
| # =================================================================================== | |
| def test_modeling( | |
| L: int, | |
| B: int, | |
| T: int, | |
| H: int, | |
| D: int, | |
| use_l2warp: bool, | |
| dtype: torch.dtype, | |
| ): | |
| run_test_model_forward_backward(L, B, T, H, D, BitNetConfig, use_l2warp=use_l2warp, dtype=dtype) | |
| # =================================================================================== | |
| # Test for Generation | |
| # =================================================================================== | |
| def test_generation( | |
| L: int, | |
| B: int, | |
| T: int, | |
| H: int, | |
| D: int, | |
| dtype: torch.dtype, | |
| ): | |
| run_test_generation(L, B, T, H, D, BitNetConfig, dtype) | |