Spaces:
Sleeping
Sleeping
File size: 1,295 Bytes
b2ea2b4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | import { describe, expect, it } from "vitest";
import type { ModelData } from "./model-data.js";
import { llama_cpp_python } from "./model-libraries-snippets.js";
describe("model-libraries-snippets", () => {
it("llama_cpp_python conversational", async () => {
const model: ModelData = {
id: "bartowski/Llama-3.2-3B-Instruct-GGUF",
pipeline_tag: "text-generation",
tags: ["conversational"],
inference: "",
};
const snippet = llama_cpp_python(model);
expect(snippet.join("\n")).toEqual(`# !pip install llama-cpp-python
from llama_cpp import Llama
llm = Llama.from_pretrained(
repo_id="bartowski/Llama-3.2-3B-Instruct-GGUF",
filename="{{GGUF_FILE}}",
)
llm.create_chat_completion(
messages = [
{
"role": "user",
"content": "What is the capital of France?"
}
]
)`);
});
it("llama_cpp_python non-conversational", async () => {
const model: ModelData = {
id: "mlabonne/gemma-2b-GGUF",
tags: [""],
inference: "",
};
const snippet = llama_cpp_python(model);
expect(snippet.join("\n")).toEqual(`# !pip install llama-cpp-python
from llama_cpp import Llama
llm = Llama.from_pretrained(
repo_id="mlabonne/gemma-2b-GGUF",
filename="{{GGUF_FILE}}",
)
output = llm(
"Once upon a time,",
max_tokens=512,
echo=True
)
print(output)`);
});
});
|