Skip to content

Commit 4734206

Browse files
Vaibhavs10julien-c
andauthored
add llama-cpp-python snippet. (#840)
Co-authored-by: Julien Chaumond <julien@huggingface.co>
1 parent dc7a4b6 commit 4734206

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

packages/tasks/src/model-libraries-snippets.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,24 @@ backbone = keras_nlp.models.Backbone.from_preset("hf://${model.id}")
261261
`,
262262
];
263263

264+
export const llama_cpp_python = (model: ModelData): string[] => [
265+
`from llama_cpp import Llama
266+
267+
llm = Llama.from_pretrained(
268+
repo_id="${model.id}",
269+
filename="{{GGUF_FILE}}",
270+
)
271+
272+
llm.create_chat_completion(
273+
messages = [
274+
{
275+
"role": "user",
276+
"content": "What is the capital of France?"
277+
}
278+
]
279+
)`,
280+
];
281+
264282
export const tf_keras = (model: ModelData): string[] => [
265283
`# Note: 'keras<3.x' or 'tf_keras' must be installed (legacy)
266284
# See https://github.com/keras-team/tf-keras for more details.

packages/tasks/src/model-libraries.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,12 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
314314
filter: false,
315315
countDownloads: `path:"liveportrait/landmark.onnx"`,
316316
},
317+
"llama-cpp-python": {
318+
prettyLabel: "llama-cpp-python",
319+
repoName: "llama-cpp-python",
320+
repoUrl: "https://github.com/abetlen/llama-cpp-python",
321+
snippets: snippets.llama_cpp_python,
322+
},
317323
mindspore: {
318324
prettyLabel: "MindSpore",
319325
repoName: "mindspore",

0 commit comments

Comments
 (0)