Skip to content

Commit a07451e

Browse files
committed
test: fix test due to context size alignment
1 parent ddf4958 commit a07451e

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

test/modelDependent/llama3.2/sequenceState.test.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,14 @@ describe("llama 3.2", () => {
195195
});
196196
const contextSequence1 = context1.getSequence();
197197
const contextSequence2 = context2.getSequence();
198+
expect(context2.contextSize).to.eql(256); // the context is actually bigger due to `llama.cpp`'s padding
198199

199200
const chatSession1 = new LlamaChatSession({
200201
contextSequence: contextSequence1
201202
});
202203

203-
const res1 = await chatSession1.prompt("Remember: locks are not doors", {maxTokens: 4});
204-
expect(res1).to.toMatchInlineSnapshot("\"That's a clever\"");
204+
const res1 = await chatSession1.prompt("Remember: locks are not doors. Also, write a long poem about it", {maxTokens: 154});
205+
expect(res1).toMatch(/^A clever reminder indeed./);
205206

206207

207208
const stateFile1Path = await getTempTestFilePath("state1");
@@ -211,12 +212,12 @@ describe("llama 3.2", () => {
211212
const contextSequence1TokensState = contextSequence1.tokenMeter.getState();
212213

213214
expect(contextSequence1.contextTokens).to.eql(state1Tokens);
214-
expect(contextSequence1.contextTokens.length).toMatchInlineSnapshot("103");
215-
expect(toBytes((await fs.stat(stateFile1Path)).size)).to.toMatchInlineSnapshot('"11.27MB"');
215+
expect(contextSequence1.contextTokens.length).toMatchInlineSnapshot("262");
216+
expect(toBytes((await fs.stat(stateFile1Path)).size)).to.toMatchInlineSnapshot('"28.66MB"');
216217
expect(contextSequence1TokensState).to.toMatchInlineSnapshot(`
217218
{
218-
"usedInputTokens": 99,
219-
"usedOutputTokens": 4,
219+
"usedInputTokens": 108,
220+
"usedOutputTokens": 154,
220221
}
221222
`);
222223

0 commit comments

Comments
 (0)