初始化项目,由ModelHub XC社区提供模型

Model: Qiskit/Qwen2.5-Coder-14B-Qiskit
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-05-15 12:19:26 +08:00
commit 5622ee2957
18 changed files with 151660 additions and 0 deletions

36
.gitattributes vendored Normal file
View File

@@ -0,0 +1,36 @@
*.7z filter=lfs diff=lfs merge=lfs -text
*.arrow filter=lfs diff=lfs merge=lfs -text
*.bin filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.ckpt filter=lfs diff=lfs merge=lfs -text
*.ftz filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.h5 filter=lfs diff=lfs merge=lfs -text
*.joblib filter=lfs diff=lfs merge=lfs -text
*.lfs.* filter=lfs diff=lfs merge=lfs -text
*.mlmodel filter=lfs diff=lfs merge=lfs -text
*.model filter=lfs diff=lfs merge=lfs -text
*.msgpack filter=lfs diff=lfs merge=lfs -text
*.npy filter=lfs diff=lfs merge=lfs -text
*.npz filter=lfs diff=lfs merge=lfs -text
*.onnx filter=lfs diff=lfs merge=lfs -text
*.ot filter=lfs diff=lfs merge=lfs -text
*.parquet filter=lfs diff=lfs merge=lfs -text
*.pb filter=lfs diff=lfs merge=lfs -text
*.pickle filter=lfs diff=lfs merge=lfs -text
*.pkl filter=lfs diff=lfs merge=lfs -text
*.pt filter=lfs diff=lfs merge=lfs -text
*.pth filter=lfs diff=lfs merge=lfs -text
*.rar filter=lfs diff=lfs merge=lfs -text
*.safetensors filter=lfs diff=lfs merge=lfs -text
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
*.tar.* filter=lfs diff=lfs merge=lfs -text
*.tar filter=lfs diff=lfs merge=lfs -text
*.tflite filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.wasm filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text
*tfevents* filter=lfs diff=lfs merge=lfs -text
*.json filter=lfs diff=lfs merge=lfs -text

140
README.md Normal file
View File

@@ -0,0 +1,140 @@
---
license: apache-2.0
language:
- en
base_model:
- Qwen/Qwen2.5-Coder-14B-Instruct
pipeline_tag: text-generation
library_name: transformers
tags:
- code
- codeqwen
- Qwen-Coder
- Qwen2.5-Coder-14B-Qiskit
---
![image/png](https://cdn-uploads.huggingface.co/production/uploads/66376b02dd21d441c54d57c6/n5teCQjzmDFdxEp57w_su.png)
# Qwen-2.5-Coder-14B-Qiskit
## Introduction
Qwen-2.5-Coder-14B-Qiskit is a model specialized in Qiskit coding and based on code-specific Qwen large language models. Particularly, this model is based on Qwen2.5-Coder 14 billion parameters model.
The model has been trained with **Qiskit version 2.0**, ensuring compatibility with its APIs and syntax.
Main features compared to previous models specialized on Qiskit code:
- Significant improvements in **code generation**, **code reasoning** and **code fixing**.
- 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.
The model **Qwen-2.5-Coder-14B-Qiskit** has the following features:
- Type: Causal Language Models
- Training Stage: Pretraining & Post-training
- Architecture: transformers with RoPE, SwiGLU, RMSNorm, and Attention QKV bias
- Number of Parameters: 14.7B
- Number of Paramaters (Non-Embedding): 13.1B
- Number of Layers: 48
- Number of Attention Heads (GQA): 40 for Q and 8 for KV
- Context Length: Full 131,072 tokens
## Requirements
Qwen-2.5-Coder-14B-Qiskit is compatible with the latest HuggingFace `transformers` and we advise you to use the latest version of `transformers`.
With `transformers<4.37.0`, you will encounter the following error:
```
KeyError: 'qwen2'
```
## Quickstart
Here we provide a code snippet with `apply_chat_template` to show you how to load the tokenizer and model and how to generate content.
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "Qiskit/Qwen-2.5-Coder-14B-Qiskit"
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
prompt = "Generate a random quantum circuit with 5 qubits."
messages = [
{"role": "system", "content": "You are Qiskit Code Assistant. You are a helpful coding 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]
```
### Processing Long Texts
The current `config.json` is set for context length up to 32,768 tokens.
To handle extensive inputs exceeding 32,768 tokens, we utilize [YaRN](https://arxiv.org/abs/2309.00071), a technique for enhancing model length extrapolation, ensuring optimal performance on lengthy texts.
For supported frameworks, you could add the following to `config.json` to enable YaRN:
```json
{
...,
"rope_scaling": {
"factor": 4.0,
"original_max_position_embeddings": 32768,
"type": "yarn"
}
}
```
For deployment, we recommend using vLLM.
Please refer to [Qwen Documentation](https://qwen.readthedocs.io/en/latest/deployment/vllm.html) for usage if you are not familar with vLLM.
Presently, vLLM only supports static YARN, which means the scaling factor remains constant regardless of input length, **potentially impacting performance on shorter texts**.
We advise adding the `rope_scaling` configuration only when processing long contexts is required.
### Comparison of Qiskit models across benchmarks
| **Model** | **QiskitHumanEval-Hard** | **QiskitHumanEval** | **HumanEval** | **ASDiv** | **MathQA** | **SciQ** | **MBPP** | **IFEval** | **CrowsPairs (English)** | **TruthfulQA (MC1 acc)** |
|-----------|---------------------------|----------------------|---------------|-----------|------------|----------|----------|------------|---------------------------|---------------------------|
| **qwen2.5-coder-14b-qiskit** | 25.17 | **49.01** | **91.46** | **4.21** | **53.90** | 97.00 | **77.60** | 49.64 | 65.18 | 37.82 |
| mistral-small-3.2-24b-qiskit | **32.45** | 47.02 | 77.49 | 3.77 | 49.68 | **97.50** | 64.00 | 48.44 | 67.08 | 39.41 |
| granite-3.3-8b-qiskit | 14.57 | 27.15 | 62.80 | 0.48 | 38.66 | 93.30 | 52.40 | 59.71 | **59.75** | 39.05 |
| granite-3.2-8b-qiskit | 9.93 | 24.50 | 57.32 | 0.09 | 41.41 | 96.30 | 51.80 | **60.79** | 66.79 | **40.51** |
*Note: All models listed in the benchmark table were evaluated using their respective system prompt, defined in their Hugging Face model.*
## Training Data
- **Data Collection and Filtering:** Our code data is sourced from a combination of publicly available datasets (e.g., Code available on <https://github.com>), and additional synthetic data generated at IBM Quantum. We exclude code that is older than 2023.
- **Exact and Fuzzy Deduplication:** We use both exact and fuzzy deduplication to remove documents having (near) identical code content.
- **PII:** We redact Personally Identifiable Information (PII) in our datasets by replacing PII content (e.g., names, email addresses, keys, passwords) with corresponding tokens (e.g., ⟨NAME⟩, ⟨EMAIL⟩, ⟨KEY⟩, ⟨PASSWORD⟩).
## Infrastructure
We train Qwen-2.5-Coder-14B-Qiskit using IBM's super computing cluster (Vela) using NVIDIA A100 GPUs. The cluster provides a scalable and efficient infrastructure for training.
## Ethical Considerations and Limitations
The use of Large Language Models involves risks and ethical considerations people must be aware of. Regarding code generation, caution is urged against complete reliance on specific code models for crucial decisions or impactful information as the generated code is not guaranteed to work as intended. **Qwen-2.5-Coder-14B-Qiskit** model is not the exception in this regard. Even though this model is suited for multiple code-related tasks, it has not undergone any safety alignment, there it may produce problematic outputs. Additionally, it remains uncertain whether smaller models might exhibit increased susceptibility to hallucination in generation scenarios by copying source code verbatim from the training dataset due to their reduced sizes and memorization capacities. This aspect is currently an active area of research, and we anticipate more rigorous exploration, comprehension, and mitigations in this domain. Regarding ethics, a latent risk associated with all Large Language Models is their malicious utilization. We urge the community to use **Qwen-2.5-Coder-14B-Qiskit** model with ethical intentions and in a responsible way.

BIN
added_tokens.json (Stored with Git LFS) Normal file

Binary file not shown.

54
chat_template.jinja Normal file

File diff suppressed because one or more lines are too long

3
config.json Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b85b04711952a4313f50bcc924c350be737ec388e9f0a267136433419b4e33a1
size 686

3
generation_config.json Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:16a6f600d712ebc691516c1d20bdbd6baaebb94d1792a8da1de47c44bbe6889a
size 121

151388
merges.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:81e9ca09ccdc932515a86bcc64d6cd041e6838ff1f58f044c46e761ca9e09654
size 4986211200

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:926a7c1c634af7938954ed8635753d72430aff954d89f6f681a43cd652751b2a
size 4954847240

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:dbbd680f36d84ba78ee35eeab30a95eb30aed86973a02a241f7678360a80c1bf
size 4954847280

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a3775cf2d47ca8ad7b2f730bd6c5b3d98aff9f02b4169e9b57c2f56a17346098
size 4954847280

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a7915458d0d5b3e8fa377b85b9d4ff30b0e95d199d12a45a8f197a978d1dc2af
size 4954847280

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:57575dd37ee2a534e86974c96eff549af3a7756509561613750e8746cc48913e
size 4734533096

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:425811015c8708208c9efc04c4cfae250c7927a1b04c99dda5a9121caf4bf77a
size 47472

BIN
special_tokens_map.json (Stored with Git LFS) Normal file

Binary file not shown.

3
tokenizer.json Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9c5ae00e602b8860cbd784ba82a8aa14e8feecec692e7076590d014d7b7fdafa
size 11421896

3
tokenizer_config.json Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:60bf17d6543b028dbd97ac7f4847418c96502006b80b4b1c57427c241c818224
size 4685

BIN
vocab.json (Stored with Git LFS) Normal file

Binary file not shown.