Update README.md
Browse files
README.md
CHANGED
|
@@ -1,35 +1,37 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
base_model: Qwen/Qwen2.5-Coder-14B-Instruct
|
| 4 |
-
tags:
|
| 5 |
-
- rust
|
| 6 |
-
- code-generation
|
| 7 |
-
- lora
|
| 8 |
-
language:
|
| 9 |
-
- en
|
| 10 |
-
- zh
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
import
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: Qwen/Qwen2.5-Coder-14B-Instruct
|
| 4 |
+
tags:
|
| 5 |
+
- rust
|
| 6 |
+
- code-generation
|
| 7 |
+
- lora
|
| 8 |
+
language:
|
| 9 |
+
- en
|
| 10 |
+
- zh
|
| 11 |
+
datasets:
|
| 12 |
+
- Neloy262/rust_instruction_dataset
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# Qwen2.5-Coder-14B-Instruct Rust LoRA
|
| 16 |
+
|
| 17 |
+
LoRA fine-tuned version of Qwen2.5-Coder-14B-Instruct specifically optimized for Rust code generation. This model significantly improves Rust syntax understanding and generates 100% Rust code compared to the base model which sometimes generates Python/C++ code. Trained with Q-LoRA (4-bit quantization) on RTX 3090, achieving final loss of 0.5738.
|
| 18 |
+
|
| 19 |
+
## Usage
|
| 20 |
+
|
| 21 |
+
```python
|
| 22 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
|
| 23 |
+
from peft import PeftModel
|
| 24 |
+
import torch
|
| 25 |
+
|
| 26 |
+
bnb_config = BitsAndBytesConfig(
|
| 27 |
+
load_in_4bit=True,
|
| 28 |
+
bnb_4bit_use_double_quant=True,
|
| 29 |
+
bnb_4bit_quant_type="nf4",
|
| 30 |
+
bnb_4bit_compute_dtype=torch.bfloat16
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
base_model = "Qwen/Qwen2.5-Coder-14B-Instruct"
|
| 34 |
+
model = AutoModelForCausalLM.from_pretrained(base_model, quantization_config=bnb_config, device_map="auto")
|
| 35 |
+
model = PeftModel.from_pretrained(model, "huaiwuai/Qwen2.5-Coder-14B-Instruct-Rust-LoRA")
|
| 36 |
+
tokenizer = AutoTokenizer.from_pretrained(base_model)
|
| 37 |
+
```
|