--- library_name: keras-hub pipeline_tag: text-generation --- ### Model Overview # Model Summary Qwen2.5-Coder is the latest series of Code-Specific Qwen large language models (formerly known as CodeQwen). As of now, Qwen2.5-Coder has covered six mainstream model sizes, **0.5, 1.5, 3, 7, 14, 32** billion parameters, to meet the needs of different developers. Qwen2.5-Coder brings the following improvements upon CodeQwen1.5: Significantly improvements in **code generation**, **code reasoning** and **code fixing**. Base on the strong Qwen2.5, we scale up the training tokens into 5.5 trillion including source code, text-code grounding, Synthetic data, etc. Qwen2.5-Coder-32B has become the current state-of-the-art open-source codeLLM, with its coding abilities matching those of GPT-4o. A more comprehensive foundation for real-world applications such as **Code Agents**. Not only enhancing coding capabilities but also maintaining its strengths in mathematics and general competencies. **Long-context Support** up to 128K tokens. For more details, please refer to Qwen [Blog](https://qwenlm.github.io/blog/qwen2.5/), [GitHub](https://github.com/keras-team/keras-hub/tree/master/keras_hub/src/models/qwen), and [Documentation](https://qwen.readthedocs.io/en/latest/). Weights are released under the [Apache 2 License](https://github.com/keras-team/keras-hub/blob/master/LICENSE) . Keras model code is released under the [Apache 2 License](https://github.com/keras-team/keras-hub/blob/master/LICENSE). ## Links * [Qwen 2.5 Coder Quickstart Notebook](https://www.kaggle.com/code/laxmareddypatlolla/qwen2-5-coder-quickstart-notebook) * [Qwen 2.5 Coder API Documentation](https://keras.io/keras_hub/api/models/qwen/) * [Qwen 2.5 Coder Model Card](https://qwenlm.github.io/blog/qwen2.5/) * [KerasHub Beginner Guide](https://keras.io/guides/keras_hub/getting_started/) * [KerasHub Model Publishing Guide](https://keras.io/guides/keras_hub/upload/) ## Installation Keras and KerasHub can be installed with: ``` pip install -U -q keras-hub pip install -U -q keras ``` Jax, TensorFlow, and Torch come preinstalled in Kaggle Notebooks. For instructions on installing them in another environment see the [Keras Getting Started](https://keras.io/getting_started/) page. ## Presets The following model checkpoints are provided by the Keras team. Full code examples for each are available below. | Preset name | Parameters | Description | |---------------------------------------|------------|--------------------------------------------------------------------------------------------------------------| | qwen2.5_coder_0.5b | 0.5B | 24-layer with 0.5 billion parameters. Code-Specific large language models base on the strong Qwen2.5 | | qwen2.5_coder_instruct_0.5b | 0.5B | 24-layer with 0.5 billion parameters. Code-Specific large language models base on the strong Qwen2.5. | | qwen2.5_coder_1.5b | 1.5B | 28-layer with 1.5 billion parameters. Code-Specific large language models base on the strong Qwen2.5. | | qwen2.5_coder_instruct_1.5b | 1.5B | 28-layer with 1.5 billion parameters. Code-Specific large language models base on the strong Qwen2.5.| | qwen2.5_coder_3b | 3B | 36-layer with 3 billion parameters. Code-Specific large language models base on the strong Qwen2.5.| | qwen2.5_coder_instruct_3b | 3B | 36-layer with 3 billion parameters. Code-Specific large language models base on the strong Qwen2.5. | | qwen2.5_coder_7b | 7B | 28-layer with 7B billion parameters. Code-Specific large language models base on the strong Qwen2.5.| | qwen2.5_coder_instruct_7b | 7B | 28-layer with 7B billion parameters. Code-Specific large language models base on the strong Qwen2.5.| | qwen2.5_coder_14b | 14B | 48-layer with 14B billion parameters. Code-Specific large language models base on the strong Qwen2.5.| | qwen2.5_coder_instruct_14b | 14B | 48-layer with 14B billion parameters. Code-Specific large language models base on the strong Qwen2.5.| | qwen2.5_coder_32b | 32B | 64-layer with 32B billion parameters. Code-Specific large language models base on the strong Qwen2.5.| | qwen2.5_coder_instruct_32b | 32B | 64-layer with 32B billion parameters. Code-Specific large language models base on the strong Qwen2.5.| ## Example Usage ```Python import keras import keras_hub import numpy as np # Use generate() to do code generation. qwen_lm = keras_hub.models.QwenCausalLM.from_preset("qwen2.5_coder_7b") qwen_lm.generate(" write a quick sort algorithm in python.", max_length=512) ``` ## Example Usage with Hugging Face URI ```Python import keras import keras_hub import numpy as np # Use generate() to do code generation. qwen_lm = keras_hub.models.QwenCausalLM.from_preset("hf://keras/qwen2.5_coder_7b") qwen_lm.generate(" write a quick sort algorithm in python.", max_length=512) ```