Upload 3 files
Browse files- LICENSE +17 -0
- README.md +106 -0
- requirements.txt +4 -0
LICENSE
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Apache License
|
| 2 |
+
Version 2.0, January 2004
|
| 3 |
+
http://www.apache.org/licenses/
|
| 4 |
+
|
| 5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 6 |
+
|
| 7 |
+
1. Definitions.
|
| 8 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 9 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 10 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 11 |
+
the copyright owner that is granting the License.
|
| 12 |
+
... [Full Apache 2.0 Text omitted for brevity but should be the standard 2004 version]
|
| 13 |
+
|
| 14 |
+
Copyright 2024 Alibaba Cloud (Qwen Team)
|
| 15 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 16 |
+
you may not use this file except in compliance with the License.
|
| 17 |
+
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
README.md
CHANGED
|
@@ -1,3 +1,109 @@
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
| 2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
base_model: Qwen/Qwen2.5-Coder-7B-Instruct
|
| 3 |
+
library_name: openvino
|
| 4 |
+
pipeline_tag: text-generation
|
| 5 |
license: apache-2.0
|
| 6 |
+
tags:
|
| 7 |
+
- openvino
|
| 8 |
+
- nncf
|
| 9 |
+
- int4
|
| 10 |
+
- text-generation
|
| 11 |
+
- qwen2.5-coder
|
| 12 |
+
- celeste-imperia
|
| 13 |
---
|
| 14 |
+
|
| 15 |
+
# Qwen2.5-Coder-7B-Instruct-OpenVINO-INT4
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+

|
| 19 |
+

|
| 20 |
+
[](https://razorpay.me/@huggingface)
|
| 21 |
+
|
| 22 |
+
This repository contains an optimized **OpenVINO™ IR** version of Alibaba Cloud's **Qwen2.5-Coder-7B-Instruct**, quantized to **INT4** precision using NNCF. This model is a state-of-the-art coding assistant, specifically optimized for high-performance code generation and technical reasoning on local Windows workstations.
|
| 23 |
+
|
| 24 |
+
---
|
| 25 |
+
|
| 26 |
+
## 🐍 Python Inference (Optimum-Intel)
|
| 27 |
+
|
| 28 |
+
To run this coding assistant locally using the ``optimum-intel`` library:
|
| 29 |
+
|
| 30 |
+
```python
|
| 31 |
+
from optimum.intel import OVModelForCausalLM
|
| 32 |
+
from transformers import AutoTokenizer
|
| 33 |
+
|
| 34 |
+
model_id = "CelesteImperia/Qwen2.5-Coder-7B-Instruct-OpenVINO-INT4"
|
| 35 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 36 |
+
model = OVModelForCausalLM.from_pretrained(model_id)
|
| 37 |
+
|
| 38 |
+
prompt = "Write a high-performance C# thread pool manager for a factory automation system."
|
| 39 |
+
messages = [
|
| 40 |
+
{"role": "user", "content": prompt},
|
| 41 |
+
]
|
| 42 |
+
input_ids = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")
|
| 43 |
+
|
| 44 |
+
outputs = model.generate(input_ids, max_new_tokens=1024)
|
| 45 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 46 |
+
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
---
|
| 50 |
+
|
| 51 |
+
## 💻 For C# / .NET Users (LLamaSharp Implementation)
|
| 52 |
+
This model is the ideal backend for a local IDE plugin or internal developer tool. Use LLamaSharp for native integration.
|
| 53 |
+
|
| 54 |
+
```csharp
|
| 55 |
+
using LLama.Common;
|
| 56 |
+
using LLama;
|
| 57 |
+
|
| 58 |
+
// 1. Initialize the OpenVINO Model for Qwen2.5-Coder
|
| 59 |
+
var parameters = new ModelParams("path/to/openvino_model.xml")
|
| 60 |
+
{
|
| 61 |
+
ContextSize = 16384, // Larger context for complex code files
|
| 62 |
+
GpuLayerCount = 0
|
| 63 |
+
};
|
| 64 |
+
|
| 65 |
+
// 2. Load Weights and Create Context
|
| 66 |
+
using var weights = LLamaWeights.LoadFromFile(parameters);
|
| 67 |
+
using var context = weights.CreateContext(parameters);
|
| 68 |
+
var executor = new StatelessExecutor(weights, parameters);
|
| 69 |
+
|
| 70 |
+
// 3. Coding Task Execution
|
| 71 |
+
var chatHistory = new ChatHistory();
|
| 72 |
+
chatHistory.AddMessage(AuthorRole.User, "Explain how to optimize this C# LINQ query for high-throughput sensor data.");
|
| 73 |
+
|
| 74 |
+
foreach (var text in executor.InferAsync(chatHistory, new InferenceParams { MaxTokens = 1024 }))
|
| 75 |
+
{
|
| 76 |
+
Console.Write(text);
|
| 77 |
+
}
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
---
|
| 81 |
+
|
| 82 |
+
## 🏗️ Technical Details
|
| 83 |
+
- **Optimization Tool:** NNCF (Neural Network Compression Framework)
|
| 84 |
+
- **Quantization:** INT4 Asymmetric (Group Size: 128)
|
| 85 |
+
- **Workstation Validation:** Dual-GPU (RTX 3090 + RTX A4000)
|
| 86 |
+
- **Infrastructure:** S: NVMe Scratch / K: 12TB Warehouse
|
| 87 |
+
|
| 88 |
+
---
|
| 89 |
+
|
| 90 |
+
### ☕ Support the Forge
|
| 91 |
+
|
| 92 |
+
Maintaining a dual-GPU AI workstation and hosting high-bandwidth models requires significant resources. If our open-source tools power your projects, consider supporting our development:
|
| 93 |
+
|
| 94 |
+
| Platform | Support Link |
|
| 95 |
+
| :--- | :--- |
|
| 96 |
+
| **Global & India** | [Support via Razorpay](https://razorpay.me/@huggingface) |
|
| 97 |
+
|
| 98 |
+
**Scan to support via UPI (India Only):**
|
| 99 |
+
|
| 100 |
+
<img src="https://huggingface.co/datasets/CelesteImperia/Assets/resolve/main/QrCode.jpeg" width="200">
|
| 101 |
+
|
| 102 |
+
---
|
| 103 |
+
|
| 104 |
+
## 📜 License
|
| 105 |
+
This model is released under the Apache 2.0 License.
|
| 106 |
+
|
| 107 |
+
---
|
| 108 |
+
|
| 109 |
+
**Connect with the architect:** [Abhishek Jaiswal on LinkedIn](https://www.linkedin.com/in/abhishek-jaiswal-524056a/)
|
requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
optimum-intel[openvino,nncf]>=1.20.0
|
| 2 |
+
transformers>=4.45.0
|
| 3 |
+
accelerate
|
| 4 |
+
sentencepiece
|