Instructions to use SathishKumar89/my-python-coder with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use SathishKumar89/my-python-coder with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-Coder-1.5B-Instruct") model = PeftModel.from_pretrained(base_model, "SathishKumar89/my-python-coder") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
---
|
| 2 |
base_model: Qwen/Qwen2.5-Coder-1.5B-Instruct
|
| 3 |
library_name: peft
|
|
@@ -39,6 +40,13 @@ This model was fine-tuned as a learning project to demonstrate the full workflow
|
|
| 39 |
|
| 40 |
This model was trained with the following instruction format. Using the same format at inference time will give the best results:
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
## Usage
|
| 44 |
|
|
@@ -66,11 +74,20 @@ Write a Python function that checks if a number is prime.
|
|
| 66 |
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
| 67 |
outputs = model.generate(**inputs, max_new_tokens=200, do_sample=False)
|
| 68 |
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
|
|
|
| 69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
### Instruction:
|
| 71 |
Write a Python function that checks if a number is prime.
|
| 72 |
|
| 73 |
### Response:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
def is_prime(num):
|
| 75 |
# Check for 0 and 1
|
| 76 |
if num <= 1:
|
|
@@ -88,3 +105,24 @@ def is_prime(num):
|
|
| 88 |
if num % i == 0:
|
| 89 |
return False
|
| 90 |
return True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
---
|
| 3 |
base_model: Qwen/Qwen2.5-Coder-1.5B-Instruct
|
| 4 |
library_name: peft
|
|
|
|
| 40 |
|
| 41 |
This model was trained with the following instruction format. Using the same format at inference time will give the best results:
|
| 42 |
|
| 43 |
+
```
|
| 44 |
+
### Instruction:
|
| 45 |
+
<your task description>
|
| 46 |
+
|
| 47 |
+
### Response:
|
| 48 |
+
<model's answer>
|
| 49 |
+
```
|
| 50 |
|
| 51 |
## Usage
|
| 52 |
|
|
|
|
| 74 |
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
| 75 |
outputs = model.generate(**inputs, max_new_tokens=200, do_sample=False)
|
| 76 |
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 77 |
+
```
|
| 78 |
|
| 79 |
+
## Example Output
|
| 80 |
+
|
| 81 |
+
**Prompt:**
|
| 82 |
+
```
|
| 83 |
### Instruction:
|
| 84 |
Write a Python function that checks if a number is prime.
|
| 85 |
|
| 86 |
### Response:
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
**Model output:**
|
| 90 |
+
```python
|
| 91 |
def is_prime(num):
|
| 92 |
# Check for 0 and 1
|
| 93 |
if num <= 1:
|
|
|
|
| 105 |
if num % i == 0:
|
| 106 |
return False
|
| 107 |
return True
|
| 108 |
+
```
|
| 109 |
+
|
| 110 |
+
## Limitations
|
| 111 |
+
|
| 112 |
+
- Trained on a **small subset** (1,500 of 18,612 examples) for only 200 steps — this is a proof-of-concept, not a production model.
|
| 113 |
+
- May not generalize well to complex Python tasks (large refactors, multi-file projects, advanced libraries).
|
| 114 |
+
- Inherits any biases or limitations present in the base model and training dataset.
|
| 115 |
+
- Not evaluated against standard benchmarks.
|
| 116 |
+
|
| 117 |
+
## Future Improvements
|
| 118 |
+
|
| 119 |
+
- Train on the full dataset for multiple epochs
|
| 120 |
+
- Increase LoRA rank for greater capacity
|
| 121 |
+
- Evaluate on HumanEval or MBPP benchmarks
|
| 122 |
+
|
| 123 |
+
## Acknowledgements
|
| 124 |
+
|
| 125 |
+
- Base model: [Qwen2.5-Coder-1.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B-Instruct) by the Qwen team
|
| 126 |
+
- Dataset: [iamtarun/python_code_instructions_18k_alpaca](https://huggingface.co/datasets/iamtarun/python_code_instructions_18k_alpaca)
|
| 127 |
+
- Training framework: Hugging Face `transformers`, `peft`, `trl`
|
| 128 |
+
```
|