8000 GitHub - mzpmzk/Qwen2.5-Coder: Qwen2.5-Coder is the code version of Qwen2.5, the large language model series developed by Qwen team, Alibaba Cloud.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Qwen2.5-Coder is the code version of Qwen2.5, the large language model series developed by Qwen team, Alibaba Cloud.

Notifications You must be signed in to change notification settings

mzpmzk/Qwen2.5-Coder

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ’œ Qwen Chatย ย  | ย ย ๐Ÿค— Hugging Faceย ย  | ย ย ๐Ÿค– ModelScopeย ย  | ย ย ๐Ÿ’ป Kaggleย ย  | ย ย  ๐Ÿ“‘ Blog ย ย  ๏ฝœ ย ย ๐Ÿ“– Documentation
๐Ÿ–ฅ๏ธ Demoย ย  | ๐Ÿ–ผ Artifactsย ย  | ย ย ๐Ÿ’ฌ WeChat (ๅพฎไฟก)ย ย  | ย ย ๐Ÿซจ Discordย ย  | ย ย  ๐Ÿ“„Arxivย ย  | ย ย ๐Ÿ–ฅ๏ธ PAI-DSWย ย 

Visit our Hugging Face or ModelScope organization (click links above), search checkpoints with names starting with Qwen2.5-Coder-, and you will find all you need! Enjoy!

Qwen2.5-Coder Series: Powerful, Diverse, Practical.

Introduction

Today, we are excited to open source the โ€œPowerfulโ€, โ€œDiverseโ€, and โ€œPracticalโ€ Qwen2.5-Coder series (formerly known as CodeQwen1.5), dedicated to continuously promoting the development of Open CodeLLMs.

๐Ÿ’ป Powerful: Qwen2.5-Coder-32B-Instruct has become the current SOTA open-source code model, matching the coding capabilities of GPT-4o. While demonstrating strong and comprehensive coding abilities, it also possesses good general and mathematical skills;

๐Ÿ“š Diverse: Building on the previously open-sourced two sizes of 1.5B / 7B, this release brings four model sizes, including 0.5B / 3B / 14B / 32B. As of now, Qwen2.5-Coder has covered six mainstream model sizes to meet the needs of different developers;

๐Ÿ›  Practical: We explore the practicality of Qwen2.5-Coder in two scenarios, including code assistants and Artifacts, with some examples showcasing the potential applications of Qwen2.5-Coder in real-world scenarios;

Basic information

  1. โœจ Supporting long context understanding and generation with the context length of 128K tokens;
  2. โœจ Supporting 92 coding languages;
['ada', 'agda', 'alloy', 'antlr', 'applescript', 'assembly', 'augeas', 'awk', 'batchfile', 'bluespec', 'c', 'c#', 'c++', 'clojure', 'cmake', 'coffeescript', 'common-lisp', 'css', 'cuda', 'dart', 'dockerfile', 'elixir', 'elm', 'emacs-lisp', 'erlang', 'f#', 'fortran', 'glsl', 'go', 'groovy', 'haskell', 'html', 'idris', 'isabelle', 'java', 'java-server-pages', 'javascript', 'json', 'julia', 'jupyter-notebook', 'kotlin', 'lean', 'literate-agda', 'literate-coffeescript', 'literate-haskell', 'lua', 'makefile', 'maple', 'markdown', 'mathematica', 'matlab', 'objectc++', 'ocaml', 'pascal', 'perl', 'php', 'powershell', 'prolog', 'protocol-buffer', 'python', 'r', 'racket', 'restructuredtext', 'rmarkdown', 'ruby', 'rust', 'sas', 'scala', 'scheme', 'shell', 'smalltalk', 'solidity', 'sparql', 'sql', 'stan', 'standard-ml', 'stata', 'swift', 'systemverilog', 'tcl', 'tcsh', 'tex', 'thrift', 'typescript', 'verilog', 'vhdl', 'visual-basic', 'vue', 'xslt', 'yacc', 'yaml', 'zig']
  1. โœจ Retain strengths in math and general capabilities from base model

Important

We updated both the special tokens and their corresponding token ids, in order to maintain consistency with Qwen2.5. The new special tokens are as the following:

{
  "<|fim_prefix|>": 151659, 
  "<|fim_middle|>": 151660, 
  "<|fim_suffix|>": 151661, 
  "<|fim_pad|>": 151662, 
  "<|repo_name|>": 151663, 
  "<|file_sep|>": 151664, 
  "<|im_start|>": 151644, 
  "<|im_end|>": 151645
}
model name type length Download
Qwen2.5-Coder-0.5B base 32k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-1.5B base 32k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-3B base 32k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-7B base 128k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-14B base 128k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-32B base 128k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-0.5B-instruct instruct 32k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-1.5B-instruct instruct 32k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-3B-instruct instruct 32k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-7B-instruct instruct 128k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-14B-instruct instruct 128k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-32B-instruct instruct 128k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-0.5B-Instruct-AWQ instruct 32k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-0.5B-Instruct-GGUF instruct 32k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-0.5B-Instruct-GPTQ-Int4 instruct 32k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-0.5B-Instruct-GPTQ-Int8 instruct 32k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-1.5B-Instruct-AWQ instruct 32k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-1.5B-Instruct-GGUF instruct 32k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-1.5B-Instruct-GPTQ-Int4 instruct 32k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-1.5B-Instruct-GPTQ-Int8 instruct 32k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-3B-Instruct-AWQ instruct 32k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-3B-Instruct-GGUF instruct 32k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-3B-Instruct-GPTQ-Int4 instruct 32k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-3B-Instruct-GPTQ-Int8 instruct 32k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-7B-Instruct-AWQ instruct 128k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-7B-Instruct-GGUF instruct 128k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-7B-Instruct-GPTQ-Int4 instruct 128k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-7B-Instruct-GPTQ-Int8 instruct 128k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-14B-Instruct-AWQ instruct 128k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-14B-Instruct-GGUF instruct 128k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-14B-Instruct-GPTQ-Int4 instruct 128k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-14B-Instruct-GPTQ-Int8 instruct 128k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-32B-Instruct-AWQ instruct 128k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-32B-Instruct-GGUF instruct 128k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-32B-Instruct-GPTQ-Int4 instruct 128k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope
Qwen2.5-Coder-32B-Instruct-GPTQ-Int8 instruct 128k ๐Ÿค— Hugging Face โ€ข ๐Ÿค– ModelScope

Detailed performance and introduction are shown in this ๐Ÿ“‘ blog.

Requirements

  • python>=3.9
  • transformers>4.37.0 for Qwen2.5 dense models.

Warning

๐Ÿšจ This is a must because `transformers` integrated Qwen2 codes since `4.37.0`.

You can install the required packages with the following command:

pip install -r requirements.txt

Quick Start

Important

Qwen2.5-Coder-[0.5-32]B-Instruct are instruction models for chatting;

Qwen2.5-Coder-[0.5-32]B is a base model typically used for completion, serving as a better starting point for fine-tuning.

๐Ÿ‘‰๐Ÿป Chat with Qwen2.5-Coder-32B-Instruct

You can just write several lines of code with transformers to chat with Qwen2.5-Coder-32B-Instruct. Essentially, we build the tokenizer and the model with from_pretrained method, and we use generate method to perform chatting with the help of chat template provided by the tokenizer. Below is an example of how to chat with Qwen2.5-Coder-32B-Instruct:

from transformers import AutoModelForCausalLM, AutoTokenizer

model_name = "Qwen/Qwen2.5-Coder-32B-Instruct"

model = AutoModelForCausalLM.from_pretrained(
    model_name,
    torch_dtype="auto",
    device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_name)

prompt = "write a quick sort algorithm."
messages = [
    {"role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant."},
    {"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)

generated_ids = model.generate(
    **model_inputs,
    max_new_tokens=512
)
generated_ids = [
    output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]

response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]

The apply_chat_template() function is used to convert the messages into a format that the model can understand. The add_generation_prompt argument is used to add a generation prompt, which refers to <|im_start|>assistant\n to the input. Notably, we apply ChatML template for chat models following our previous practice. The max_new_tokens argument is used to set the maximum length of the response. The tokenizer.batch_decode() function is used to decode the response. In terms of the input, the above messages is an example to show how to format your dialog history and system prompt. You can use the other size of instruct model in the same way.

๐Ÿ‘‰๐Ÿป Code with Qwen2.5-Coder-32B

1. Basic Usage