Skip to content

Commit

Permalink
test: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
giladgd committed Jan 5, 2025
1 parent e65b839 commit d53a07e
Show file tree
Hide file tree
Showing 2 changed files with 283 additions and 268 deletions.
95 changes: 51 additions & 44 deletions test/modelDependent/llama3.1/controlledEvaluate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,14 @@ describe("llama 3.1", () => {

// only keep the top 10 probabilities to not clutter the snapshot
if (item.next?.probabilities != null)
item.next.probabilities = new Map([...item.next.probabilities.entries()].slice(0, 10));
item.next.probabilities = new Map(
[...item.next.probabilities.entries()]
.slice(0, 10)
.map(([token, probability]) => [token, parseFloat(probability.toFixed(7))])
);

if (item.next?.confidence != null)
item.next.confidence = parseFloat(item.next.confidence.toFixed(7));

return item;
});
Expand All @@ -85,73 +92,73 @@ describe("llama 3.1", () => {
{
"next": {
"probabilities": Map {
35308 => 0.5214946269989014,
27096 => 0.24320587515830994,
11 => 0.022182414308190346,
198 => 0.011944590136408806,
374 => 0.008361410349607468,
863 => 0.008360812440514565,
1131 => 0.006834662053734064,
25 => 0.006243313197046518,
7940 => 0.00540389958769083,
1 => 0.005168775096535683,
35308 => 0.5214946,
27096 => 0.2432059,
11 => 0.0221824,
198 => 0.0119446,
374 => 0.0083614,
863 => 0.0083608,
1131 => 0.0068347,
25 => 0.0062433,
7940 => 0.0054039,
1 => 0.0051688,
},
},
},
{
"next": {
"probabilities": Map {
927 => 0.9811904430389404,
198 => 0.0033848676830530167,
6288 => 0.0032705331686884165,
279 => 0.0006552835111506283,
1633 => 0.00031841936288401484,
1035 => 0.0003114044084213674,
13 => 0.0002916732046287507,
264 => 0.00028948261751793325,
297 => 0.0002833220351021737,
720 => 0.00024898265837691724,
927 => 0.9811904,
198 => 0.0033849,
6288 => 0.0032705,
279 => 0.0006553,
1633 => 0.0003184,
1035 => 0.0003114,
13 => 0.0002917,
264 => 0.0002895,
297 => 0.0002833,
720 => 0.000249,
},
"token": 927,
},
},
{
"next": {
"confidence": 0.9306728839874268,
"confidence": 0.9306729,
"token": 279,
},
},
{
"next": {
"confidence": 0.9597684741020203,
"confidence": 0.9597685,
"probabilities": Map {
16053 => 0.9597684741020203,
1208 => 0.004750591237097979,
198 => 0.0031827085185796022,
5679 => 0.0029162338469177485,
65536 => 0.00197240780107677,
6435 => 0.0009124248754233122,
2697 => 0.0006706250132992864,
720 => 0.0005979162524454296,
21811 => 0.0005516768433153629,
45363 => 0.0005495203076861799,
16053 => 0.9597685,
1208 => 0.0047506,
198 => 0.0031827,
5679 => 0.0029162,
65536 => 0.0019724,
6435 => 0.0009124,
2697 => 0.0006706,
720 => 0.0005979,
21811 => 0.0005517,
45363 => 0.0005495,
},
},
},
{
"next": {
"confidence": 0.9871460199356079,
"confidence": 0.987146,
"probabilities": Map {
5679 => 0.9871460199356079,
21811 => 0.001438674982637167,
198 => 0.0009368227329105139,
8415 => 0.0007225279696285725,
12875 => 0.00038032486918382347,
4194 => 0.00034695648355409503,
720 => 0.00028149448917247355,
14588 => 0.00027612835401669145,
9522 => 0.00024171460245270282,
627 => 0.0002042166597675532,
5679 => 0.987146,
21811 => 0.0014387,
198 => 0.0009368,
8415 => 0.0007225,
12875 => 0.0003803,
4194 => 0.000347,
720 => 0.0002815,
14588 => 0.0002761,
9522 => 0.0002417,
627 => 0.0002042,
},
"token": 5679,
},
Expand Down
Loading

0 comments on commit d53a07e

Please # to comment.