Views
No views yet
wget https://huggingface.co/Mozilla/Qwen2.5.1-Coder-7B-Instruct-llamafile/resolve/main/Qwen2.5.1-Coder-7B-Instruct-Q6_K.llamafile
chmod +x Qwen2.5.1-Coder-7B-Instruct-Q6_K.llamafile
./Qwen2.5.1-Coder-7B-Instruct-Q6_K.llamafile/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.--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../Qwen2.5.1-Coder-7B-Instruct-Q6_K.llamafile --server--cli flag. For additional help on how it
may be used, pass the --help flag../Qwen2.5.1-Coder-7B-Instruct-Q6_K.llamafile --cli -p 'four score and seven' --log-disable1sudo wget -O /usr/bin/ape https://cosmo.zip/pub/cosmos/bin/ape-$(uname -m).elf
2sudo chmod +x /usr/bin/ape
3sudo sh -c "echo ':APE:M::MZqFpD::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register"
4sudo sh -c "echo ':APE-jart:M::jartsr::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register"-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.-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.--recompile flag to
build a GGML CUDA library just for your system that uses cuBLAS. This
ensures you get maximum performance.transformers and we advise you to use the latest version of transformers.transformers<4.37.0, you will encounter the following error:KeyError: 'qwen2'apply_chat_template to show you how to load the tokenizer and model and how to generate contents.1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3model_name = "Qwen/Qwen2.5-Coder-7B-Instruct"
4
5model = AutoModelForCausalLM.from_pretrained(
6 model_name,
7 torch_dtype="auto",
8 device_map="auto"
9)
10tokenizer = AutoTokenizer.from_pretrained(model_name)
11
12prompt = "write a quick sort algorithm."
13messages = [
14 {"role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant."},
15 {"role": "user", "content": prompt}
16]
17text = tokenizer.apply_chat_template(
18 messages,
19 tokenize=False,
20 add_generation_prompt=True
21)
22model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
23
24generated_ids = model.generate(
25 **model_inputs,
26 max_new_tokens=512
27)
28generated_ids = [
29 output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
30]
31
32response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]config.json is set for context length up to 32,768 tokens.
To handle extensive inputs exceeding 32,768 tokens, we utilize YaRN, a technique for enhancing model length extrapolation, ensuring optimal performance on lengthy texts.config.json to enable YaRN:1{
2 ...,
3 "rope_scaling": {
4 "factor": 4.0,
5 "original_max_position_embeddings": 32768,
6 "type": "yarn"
7 }
8}rope_scaling configuration only when processing long contexts is required.@article{hui2024qwen2,
title={Qwen2. 5-Coder Technical Report},
author={Hui, Binyuan and Yang, Jian and Cui, Zeyu and Yang, Jiaxi and Liu, Dayiheng and Zhang, Lei and Liu, Tianyu and Zhang, Jiajun and Yu, Bowen and Dang, Kai and others},
journal={arXiv preprint arXiv:2409.12186},
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}
}