Spaces:
Sleeping
Sleeping
File size: 4,760 Bytes
6baa3af | 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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const vitest_1 = require("vitest");
const local_apps_js_1 = require("./local-apps.js");
(0, vitest_1.describe)("local-apps", () => {
(0, vitest_1.it)("llama.cpp conversational", async () => {
const { snippet: snippetFunc } = local_apps_js_1.LOCAL_APPS["llama.cpp"];
const model = {
id: "bartowski/Llama-3.2-3B-Instruct-GGUF",
tags: ["conversational"],
inference: "",
};
const snippet = snippetFunc(model);
(0, vitest_1.expect)(snippet[0].content).toEqual([
`# Start a local OpenAI-compatible server with a web UI:
llama-server -hf bartowski/Llama-3.2-3B-Instruct-GGUF:{{QUANT_TAG}}`,
`# Run inference directly in the terminal:
llama-cli -hf bartowski/Llama-3.2-3B-Instruct-GGUF:{{QUANT_TAG}}`,
]);
});
(0, vitest_1.it)("llama.cpp non-conversational", async () => {
const { snippet: snippetFunc } = local_apps_js_1.LOCAL_APPS["llama.cpp"];
const model = {
id: "mlabonne/gemma-2b-GGUF",
tags: [],
inference: "",
};
const snippet = snippetFunc(model);
(0, vitest_1.expect)(snippet[0].content).toEqual([
`# Start a local OpenAI-compatible server with a web UI:
llama-server -hf mlabonne/gemma-2b-GGUF:{{QUANT_TAG}}`,
`# Run inference directly in the terminal:
llama-cli -hf mlabonne/gemma-2b-GGUF:{{QUANT_TAG}}`,
]);
});
(0, vitest_1.it)("vLLM conversational llm", async () => {
const { snippet: snippetFunc } = local_apps_js_1.LOCAL_APPS["vllm"];
const model = {
id: "meta-llama/Llama-3.2-3B-Instruct",
pipeline_tag: "text-generation",
tags: ["conversational"],
inference: "",
};
const snippet = snippetFunc(model);
(0, vitest_1.expect)(snippet[0].content.join("\n")).toEqual(`# Start the vLLM server:
vllm serve "meta-llama/Llama-3.2-3B-Instruct"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \\
-H "Content-Type: application/json" \\
--data '{
"model": "meta-llama/Llama-3.2-3B-Instruct",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'`);
});
(0, vitest_1.it)("vLLM non-conversational llm", async () => {
const { snippet: snippetFunc } = local_apps_js_1.LOCAL_APPS["vllm"];
const model = {
id: "meta-llama/Llama-3.2-3B",
tags: [""],
inference: "",
};
const snippet = snippetFunc(model);
(0, vitest_1.expect)(snippet[0].content.join("\n")).toEqual(`# Start the vLLM server:
vllm serve "meta-llama/Llama-3.2-3B"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \\
-H "Content-Type: application/json" \\
--data '{
"model": "meta-llama/Llama-3.2-3B",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'`);
});
(0, vitest_1.it)("vLLM conversational vlm", async () => {
const { snippet: snippetFunc } = local_apps_js_1.LOCAL_APPS["vllm"];
const model = {
id: "meta-llama/Llama-3.2-11B-Vision-Instruct",
pipeline_tag: "image-text-to-text",
tags: ["conversational"],
inference: "",
};
const snippet = snippetFunc(model);
(0, vitest_1.expect)(snippet[0].content.join("\n")).toEqual(`# Start the vLLM server:
vllm serve "meta-llama/Llama-3.2-11B-Vision-Instruct"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \\
-H "Content-Type: application/json" \\
--data '{
"model": "meta-llama/Llama-3.2-11B-Vision-Instruct",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Describe this image in one sentence."
},
{
"type": "image_url",
"image_url": {
"url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg"
}
}
]
}
]
}'`);
});
(0, vitest_1.it)("docker model runner", async () => {
const { snippet: snippetFunc } = local_apps_js_1.LOCAL_APPS["docker-model-runner"];
const model = {
id: "bartowski/Llama-3.2-3B-Instruct-GGUF",
tags: ["conversational"],
gguf: { total: 1, context_length: 4096 },
inference: "",
};
const snippet = snippetFunc(model);
(0, vitest_1.expect)(snippet).toEqual(`docker model run hf.co/bartowski/Llama-3.2-3B-Instruct-GGUF:{{QUANT_TAG}}`);
});
});
|