Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test gets skipped with pattern: asan OR debug OR os == 'android' OR tsan OR verify
- Manifest: toolkit/components/ml/tests/browser/browser.toml
/* Any copyright is dedicated to the Public Domain.
"use strict";
/// <reference path="head.js" />
// already waiting for its first chunk rejects run() instead of hanging it.
// "min-p" passes request validation but is refused by LlamaBackend::Generate,
// which is the earliest point where the consumer is already waiting.
add_task(async function test_llama_backend_error_rejects_run() {
const { cleanup } = await setup();
try {
const engine = await createEngine({
taskName: "text-generation",
modelId: "Mozilla/test-llama",
modelFile: "TinyStories-656K.Q8_0.gguf",
modelRevision: "main",
backend: "llama.cpp",
numContext: 128,
});
await Assert.rejects(
engine.run({
prompt: [{ role: "user", content: "Once upon a time there was" }],
nPredict: 4,
samplers: [{ type: "min-p" }, { type: "dist" }],
}),
/Unimplemented sampler type/,
"A backend failure inside the generation task rejects run()"
);
} finally {
await EngineProcess.destroyMLEngine();
await cleanup();
}
});