Skip to content

Example script for Basic GGUF model execution(without quantized weights) #368

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions examples/basic_gguf_models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -----------------------------------------------------------------------------
#
# Copyright (c) 2025 Qualcomm Innovation Center, Inc. All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
#
# -----------------------------------------------------------------------------

# This is the work example of the GGUF models with the AI 100

from transformers import AutoTokenizer

from QEfficient import QEFFAutoModelForCausalLM as AutoModelForCausalLM

# Load the model and tokenizer
model_name = "MaziyarPanahi/Mistral-7B-Instruct-v0.3-GGUF"
gguf_file = "Mistral-7B-Instruct-v0.3.fp16.gguf"
# org_model_name = "mistralai/Mistral-7B-Instruct-v0.3"

tokenizer = AutoTokenizer.from_pretrained(model_name, gguf_file=gguf_file)
model = AutoModelForCausalLM.from_pretrained(model_name, gguf_file=gguf_file)

generated_qpc_path = model.compile(prefill_seq_len=32, ctx_len=128, num_cores=16, num_devices=1)
model.generate(prompts=["How are you?"], tokenizer=tokenizer)
Loading