Skip to content

Commit d53a07e

Browse files
committed
test: fix tests
1 parent e65b839 commit d53a07e

File tree

2 files changed

+283
-268
lines changed

2 files changed

+283
-268
lines changed

test/modelDependent/llama3.1/controlledEvaluate.test.ts

Lines changed: 51 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,14 @@ describe("llama 3.1", () => {
6868

6969
// only keep the top 10 probabilities to not clutter the snapshot
7070
if (item.next?.probabilities != null)
71-
item.next.probabilities = new Map([...item.next.probabilities.entries()].slice(0, 10));
71+
item.next.probabilities = new Map(
72+
[...item.next.probabilities.entries()]
73+
.slice(0, 10)
74+
.map(([token, probability]) => [token, parseFloat(probability.toFixed(7))])
75+
);
76+
77+
if (item.next?.confidence != null)
78+
item.next.confidence = parseFloat(item.next.confidence.toFixed(7));
7279

7380
return item;
7481
});
@@ -85,73 +92,73 @@ describe("llama 3.1", () => {
8592
{
8693
"next": {
8794
"probabilities": Map {
88-
35308 => 0.5214946269989014,
89-
27096 => 0.24320587515830994,
90-
11 => 0.022182414308190346,
91-
198 => 0.011944590136408806,
92-
374 => 0.008361410349607468,
93-
863 => 0.008360812440514565,
94-
1131 => 0.006834662053734064,
95-
25 => 0.006243313197046518,
96-
7940 => 0.00540389958769083,
97-
1 => 0.005168775096535683,
95+
35308 => 0.5214946,
96+
27096 => 0.2432059,
97+
11 => 0.0221824,
98+
198 => 0.0119446,
99+
374 => 0.0083614,
100+
863 => 0.0083608,
101+
1131 => 0.0068347,
102+
25 => 0.0062433,
103+
7940 => 0.0054039,
104+
1 => 0.0051688,
98105
},
99106
},
100107
},
101108
{
102109
"next": {
103110
"probabilities": Map {
104-
927 => 0.9811904430389404,
105-
198 => 0.0033848676830530167,
106-
6288 => 0.0032705331686884165,
107-
279 => 0.0006552835111506283,
108-
1633 => 0.00031841936288401484,
109-
1035 => 0.0003114044084213674,
110-
13 => 0.0002916732046287507,
111-
264 => 0.00028948261751793325,
112-
297 => 0.0002833220351021737,
113-
720 => 0.00024898265837691724,
111+
927 => 0.9811904,
112+
198 => 0.0033849,
113+
6288 => 0.0032705,
114+
279 => 0.0006553,
115+
1633 => 0.0003184,
116+
1035 => 0.0003114,
117+
13 => 0.0002917,
118+
264 => 0.0002895,
119+
297 => 0.0002833,
120+
720 => 0.000249,
114121
},
115122
"token": 927,
116123
},
117124
},
118125
{
119126
"next": {
120-
"confidence": 0.9306728839874268,
127+
"confidence": 0.9306729,
121128
"token": 279,
122129
},
123130
},
124131
{
125132
"next": {
126-
"confidence": 0.9597684741020203,
133+
"confidence": 0.9597685,
127134
"probabilities": Map {
128-
16053 => 0.9597684741020203,
129-
1208 => 0.004750591237097979,
130-
198 => 0.0031827085185796022,
131-
5679 => 0.0029162338469177485,
132-
65536 => 0.00197240780107677,
133-
6435 => 0.0009124248754233122,
134-
2697 => 0.0006706250132992864,
135-
720 => 0.0005979162524454296,
136-
21811 => 0.0005516768433153629,
137-
45363 => 0.0005495203076861799,
135+
16053 => 0.9597685,
136+
1208 => 0.0047506,
137+
198 => 0.0031827,
138+
5679 => 0.0029162,
139+
65536 => 0.0019724,
140+
6435 => 0.0009124,
141+
2697 => 0.0006706,
142+
720 => 0.0005979,
143+
21811 => 0.0005517,
144+
45363 => 0.0005495,
138145
},
139146
},
140147
},
141148
{
142149
"next": {
143-
"confidence": 0.9871460199356079,
150+
"confidence": 0.987146,
144151
"probabilities": Map {
145-
5679 => 0.9871460199356079,
146-
21811 => 0.001438674982637167,
147-
198 => 0.0009368227329105139,
148-
8415 => 0.0007225279696285725,
149-
12875 => 0.00038032486918382347,
150-
4194 => 0.00034695648355409503,
151-
720 => 0.00028149448917247355,
152-
14588 => 0.00027612835401669145,
153-
9522 => 0.00024171460245270282,
154-
627 => 0.0002042166597675532,
152+
5679 => 0.987146,
153+
21811 => 0.0014387,
154+
198 => 0.0009368,
155+
8415 => 0.0007225,
156+
12875 => 0.0003803,
157+
4194 => 0.000347,
158+
720 => 0.0002815,
159+
14588 => 0.0002761,
160+
9522 => 0.0002417,
161+
627 => 0.0002042,
155162
},
156163
"token": 5679,
157164
},

0 commit comments

Comments
 (0)