Qwen2.5-1.5B-Instruct-GGUF - llamafile
The Repo is wrongly named 1.6b, but well at least it will be easier to spot it!
- Model creator: Fabio Matricardi
- Original model: Qwen/Qwen2.5-1.5B-Instruct-GGUF
Fabio Matricardi packaged the Qwen 2.5 models into executable weights that we call llamafiles. This gives you the easiest fastest way to use the model on Linux, MacOS, Windows, FreeBSD, OpenBSD and NetBSD systems you control on both AMD64 and ARM64.
Software Last Updated: 2025-03-31
Llamafile Version: 0.9.2
The executable will start with a context window set to 24k tokens
Quickstart
To get started, you need both the Qwen 2.5 weights, and the llamafile software. Both of them are included in a single file, which can be downloaded and run as follows:
wget https://huggingface.co/FM-1976/Qwen2.5-1.6b-llamafile/resolve/main/QwenPortable.llamafile
chmod +x QwenPortable.llamafile
./QwenPortable.llamafile
For Windows user:
simply rename the extension from QwenPortable.llamafile
to QwenPortable.exe
The default mode of operation for these llamafiles is our new command
line chatbot interface.
At the same time a Web interface is available at http://127.0.0.1:8080/
and also exposed to your internal Network.
An OpenAI compatible API endpoint server will be listening at http://localhost:8080/v1
Usage
You can use triple quotes to ask questions on multiple lines. You can
pass commands like /stats
and /context
to see runtime status
information. You can change the system prompt by passing the -p "new system prompt"
flag. You can press CTRL-C to interrupt the model.
Finally CTRL-D may be used to exit.
If you prefer to use a web GUI, then a --server
mode is provided, that
will open a tab with a chatbot and completion interface in your browser.
For additional help on how it may be used, pass the --help
flag. The
server also has an OpenAI API compatible completions endpoint that can
be accessed via Python using the openai
pip package.
When you launch the executable the oepnAI API server is started automatically
An advanced CLI mode is provided that's useful for shell scripting. You
can use it by passing the --cli
flag. For additional help on how it
may be used, pass the --help
flag.
Quickstart with python and openAI API endpoint
Here provides a code snippet with apply_chat_template
to show you how to load the tokenizer and model and how to generate contents.
# Chat with an intelligent assistant in your terminal
from openai import OpenAI
import sys
# Point to the local server
client = OpenAI(base_url="http://localhost:8080/v1", api_key="not-needed")
history = [
{"role": "system", "content": "You are QWEN-PORTABLE, an intelligent assistant. You always provide well-reasoned answers that are both correct and helpful. Always reply in the language of the instructions."},
{"role": "user", "content": "Hello, introduce yourself to someone opening this program for the first time. Be concise."},
]
print("\033[92;1m")
while True:
userinput = ""
completion = client.chat.completions.create(
model="local-model", # this field is currently unused
messages=history,
temperature=0.3,
frequency_penalty = 1.4,
max_tokens = 600,
stream=True,
)
new_message = {"role": "assistant", "content": ""}
for chunk in completion:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
new_message["content"] += chunk.choices[0].delta.content
history.append(new_message)
print("\033[1;30m") #dark grey
print("Enter your text (end input with Ctrl+D on Unix or Ctrl+Z on Windows) - type quit! to exit the chatroom:")
print("\033[91;1m") #red
lines = sys.stdin.readlines()
for line in lines:
userinput += line + "\n"
if "quit!" in lines[0].lower():
print("\033[0mBYE BYE!")
break
history = [
{"role": "system", "content": "You are an intelligent assistant. You always provide well-reasoned answers that are both correct and helpful."},
]
history.append({"role": "user", "content": userinput})
print("\033[92;1m")
Context Window
This model has a max context window size of 128k tokens. By default, a
context window size of 8192 tokens is used. You can ask llamafile
to use the maximum context size by passing the -c 0
flag. That's big
enough for a small book. If you want to be able to have a conversation
with your book, you can use the -f book.txt
flag.
GPU Acceleration
On GPUs with sufficient RAM, the -ngl 999
flag may be passed to use
the system's NVIDIA or AMD GPU(s). On Windows, only the graphics card
driver needs to be installed if you own an NVIDIA GPU. On Windows, if
you have an AMD GPU, you should install the ROCm SDK v6.1 and then pass
the flags --recompile --gpu amd
the first time you run your llamafile.
On NVIDIA GPUs, by default, the prebuilt tinyBLAS library is used to
perform matrix multiplications. This is open source software, but it
doesn't go as fast as closed source cuBLAS. If you have the CUDA SDK
installed on your system, then you can pass the --recompile
flag to
build a GGML CUDA library just for your system that uses cuBLAS. This
ensures you get maximum performance.
For further information, please see the llamafile README.
About llamafile
llamafile is a new format introduced by Mozilla on Nov 20th 2023. It uses Cosmopolitan Libc to turn LLM weights into runnable llama.cpp binaries that run on the stock installs of six OSes for both ARM64 and AMD64.
Qwen2.5-1.5B-Instruct-GGUF
Introduction
Qwen2.5 is the latest series of Qwen large language models. For Qwen2.5, we release a number of base language models and instruction-tuned language models ranging from 0.5 to 72 billion parameters. Qwen2.5 brings the following improvements upon Qwen2:
- Significantly more knowledge and has greatly improved capabilities in coding and mathematics, thanks to our specialized expert models in these domains.
- Significant improvements in instruction following, generating long texts (over 8K tokens), understanding structured data (e.g, tables), and generating structured outputs especially JSON. More resilient to the diversity of system prompts, enhancing role-play implementation and condition-setting for chatbots.
- Long-context Support up to 128K tokens and can generate up to 8K tokens.
- Multilingual support for over 29 languages, including Chinese, English, French, Spanish, Portuguese, German, Italian, Russian, Japanese, Korean, Vietnamese, Thai, Arabic, and more.
This repo contains the instruction-tuned 1.5B Qwen2.5 model in the GGUF Format, which has the following features:
- Type: Causal Language Models
- Training Stage: Pretraining & Post-training
- Architecture: transformers with RoPE, SwiGLU, RMSNorm, Attention QKV bias and tied word embeddings
- Number of Parameters: 1.54B
- Number of Paramaters (Non-Embedding): 1.31B
- Number of Layers: 28
- Number of Attention Heads (GQA): 12 for Q and 2 for KV
- Context Length: Full 32,768 tokens and generation 8192 tokens
For more details, please refer to our blog, GitHub, and Documentation.
Evaluation & Performance
Detailed evaluation results are reported in this ๐ blog.
For quantized models, the benchmark results against the original bfloat16 models can be found here
For requirements on GPU memory and the respective throughput, see results here.
Citation
If you find our work helpful, feel free to give us a cite.
@misc{qwen2.5,
title = {Qwen2.5: A Party of Foundation Models},
url = {https://qwenlm.github.io/blog/qwen2.5/},
author = {Qwen Team},
month = {September},
year = {2024}
}
@article{qwen2,
title={Qwen2 Technical Report},
author={An Yang and Baosong Yang and Binyuan Hui and Bo Zheng and Bowen Yu and Chang Zhou and Chengpeng Li and Chengyuan Li and Dayiheng Liu and Fei Huang and Guanting Dong and Haoran Wei and Huan Lin and Jialong Tang and Jialin Wang and Jian Yang and Jianhong Tu and Jianwei Zhang and Jianxin Ma and Jin Xu and Jingren Zhou and Jinze Bai and Jinzheng He and Junyang Lin and Kai Dang and Keming Lu and Keqin Chen and Kexin Yang and Mei Li and Mingfeng Xue and Na Ni and Pei Zhang and Peng Wang and Ru Peng and Rui Men and Ruize Gao and Runji Lin and Shijie Wang and Shuai Bai and Sinan Tan and Tianhang Zhu and Tianhao Li and Tianyu Liu and Wenbin Ge and Xiaodong Deng and Xiaohuan Zhou and Xingzhang Ren and Xinyu Zhang and Xipin Wei and Xuancheng Ren and Yang Fan and Yang Yao and Yichang Zhang and Yu Wan and Yunfei Chu and Yuqiong Liu and Zeyu Cui and Zhenru Zhang and Zhihao Fan},
journal={arXiv preprint arXiv:2407.10671},
year={2024}
}
- Downloads last month
- 15