Skip to content

Commit

Permalink
Add tiny-rwkv-7v0 test files
Browse files Browse the repository at this point in the history
Signed-off-by: Molly Sophia <[email protected]>
  • Loading branch information
MollySophia committed Jan 12, 2025
1 parent 1b72943 commit b016d3c
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 5 deletions.
6 changes: 6 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ file(COPY tiny-rwkv-6v0-3m-Q5_0.bin DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY tiny-rwkv-6v0-3m-Q5_1.bin DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY expected-logits-6v0-3m.bin DESTINATION ${CMAKE_CURRENT_BINARY_DIR})

file(COPY tiny-rwkv-7v0-834K-FP32.bin DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY tiny-rwkv-7v0-834K-FP16.bin DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY tiny-rwkv-7v0-834K-Q5_0.bin DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY tiny-rwkv-7v0-834K-Q5_1.bin DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY expected-logits-7v0-834K.bin DESTINATION ${CMAKE_CURRENT_BINARY_DIR})

rwkv_add_test(test_ggml_basics.c)
rwkv_add_test(test_quantized_matmul_on_gpu.c)
rwkv_add_test(test_tiny_rwkv.c)
Expand Down
Binary file added tests/expected-logits-7v0-834K.bin
Binary file not shown.
26 changes: 21 additions & 5 deletions tests/test_tiny_rwkv.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "logit_difference_validator.inc"

#define VERSION_COUNT 4
#define VERSION_COUNT 5
#define FORMAT_COUNT 7

int main(void) {
Expand All @@ -21,7 +21,8 @@ int main(void) {
"4v0-660K",
"5v1-730K",
"5v2-730K",
"6v0-3m"
"6v0-3m",
"7v0-834K"
};

const char * formats[FORMAT_COUNT] = {
Expand All @@ -46,7 +47,10 @@ int main(void) {
+0.455912F, // FP16
// 6v0
+0.001000F, // FP32
-0.416620F // FP16
-0.416620F, // FP16
// 7v0
+0.001000F, // FP32
+0.005766F // FP16
};

// *** Why the hell the expected logit difference sum for v4 models is < 1, and for v5 models it can be as high as 160? ***
Expand Down Expand Up @@ -87,7 +91,13 @@ int main(void) {
+021.939022F, // Q4_1
-027.332073F, // Q5_0
+003.576909F, // Q5_1
-009.539596F // Q8_0
-009.539596F, // Q8_0
// 7v0
+000.136785F, // Q4_0
+000.002614F, // Q4_1
-000.063645F, // Q5_0
-000.064663F, // Q5_1
+000.011924F // Q8_0
};

const float expected_difference_sum_quantized_FP16[VERSION_COUNT * (FORMAT_COUNT - 2)] = {
Expand All @@ -114,7 +124,13 @@ int main(void) {
+021.797060F, // Q4_1
-027.269241F, // Q5_0
+003.405264F, // Q5_1
-009.734720F // Q8_0
-009.734720F, // Q8_0
// 7v0
+000.136678F, // Q4_0
-000.005140F, // Q4_1
-000.064447F, // Q5_0
-000.063531F, // Q5_1
+000.010921F // Q8_0
};

for (int i_version = 0; i_version < VERSION_COUNT; i_version++) {
Expand Down
Binary file added tests/tiny-rwkv-7v0-834K-FP16.bin
Binary file not shown.
Binary file added tests/tiny-rwkv-7v0-834K-FP32.bin
Binary file not shown.
Binary file added tests/tiny-rwkv-7v0-834K-Q5_0.bin
Binary file not shown.
Binary file added tests/tiny-rwkv-7v0-834K-Q5_1.bin
Binary file not shown.

0 comments on commit b016d3c

Please sign in to comment.