Download include/ling3/context_options.h from Sariel00/Ling-3.0-tiny-RKNN: direct link, hf CLI and curl.
- Browser
- Download file 900 Bytes
-
https://huggingface.co/Sariel00/Ling-3.0-tiny-RKNN/resolve/main/include/ling3/context_options.h
- Command line
-
hf download hf://Sariel00/Ling-3.0-tiny-RKNN/include/ling3/context_options.h
-
curl -L -o context_options.h https://huggingface.co/Sariel00/Ling-3.0-tiny-RKNN/resolve/main/include/ling3/context_options.h
900 Bytes
| namespace ling3 { | |
| inline constexpr std::array<std::size_t, 7> kContexts {4096, 8192, 16384, 32768, 65536, 131072, 262144}; | |
| // 6 MLA layers, 16 heads, FP16 K192/V128 + five FP32 score arrays. | |
| inline constexpr std::size_t kContextBytesPerToken = 6 * (16 * (192 + 128) * 2 + 5 * 4); | |
| inline double EstimateContextMiB(std::size_t context) { | |
| return 10034.0 + (static_cast<double>(context) - 4096) * kContextBytesPerToken / (1024 * 1024); | |
| } | |
| inline std::size_t ParseContext(std::string_view value) { | |
| for (auto context : kContexts) { | |
| const auto k = std::to_string(context / 1024); | |
| if (value == k + "K" || value == k + "k" || value == std::to_string(context)) return context; | |
| } | |
| throw std::invalid_argument("context must be 4K, 8K, 16K, 32K, 64K, 128K or 256K"); | |
| } | |
| } // namespace ling3 | |