README.md
Browse files
README.md
CHANGED
|
@@ -52,11 +52,22 @@ STM32F4 serisi için HAL kütüphanesi kullanan gömülü sistem kodu üretir.
|
|
| 52 |
```python
|
| 53 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 54 |
from peft import PeftModel
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
-
base_model = AutoModelForCausalLM.from_pretrained("bigcode/starcoder2-3b")
|
| 57 |
model = PeftModel.from_pretrained(base_model, "MuratKomurcu/starcoder2-stm32-turkish")
|
| 58 |
tokenizer = AutoTokenizer.from_pretrained("MuratKomurcu/starcoder2-stm32-turkish")
|
| 59 |
|
|
|
|
|
|
|
|
|
|
| 60 |
prompt = '''### Instruction:
|
| 61 |
Write complete STM32F401RE LED blink code with main function
|
| 62 |
|
|
@@ -65,10 +76,6 @@ LED on PA5, blink every 1000ms, include SystemClock_Config
|
|
| 65 |
|
| 66 |
### Response:
|
| 67 |
'''
|
| 68 |
-
|
| 69 |
-
inputs = tokenizer(prompt, return_tensors="pt")
|
| 70 |
-
outputs = model.generate(**inputs, max_new_tokens=2048, temperature=0.1)
|
| 71 |
-
print(tokenizer.decode(outputs[0]))
|
| 72 |
```
|
| 73 |
|
| 74 |
## Eğitim Detayları
|
|
|
|
| 52 |
```python
|
| 53 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 54 |
from peft import PeftModel
|
| 55 |
+
import torch
|
| 56 |
+
|
| 57 |
+
print("🔄 Model yükleniyor...")
|
| 58 |
+
|
| 59 |
+
base_model = AutoModelForCausalLM.from_pretrained(
|
| 60 |
+
"bigcode/starcoder2-3b",
|
| 61 |
+
torch_dtype=torch.float16,
|
| 62 |
+
device_map="auto"
|
| 63 |
+
)
|
| 64 |
|
|
|
|
| 65 |
model = PeftModel.from_pretrained(base_model, "MuratKomurcu/starcoder2-stm32-turkish")
|
| 66 |
tokenizer = AutoTokenizer.from_pretrained("MuratKomurcu/starcoder2-stm32-turkish")
|
| 67 |
|
| 68 |
+
print("✅ Model hazır!")
|
| 69 |
+
|
| 70 |
+
# TEST
|
| 71 |
prompt = '''### Instruction:
|
| 72 |
Write complete STM32F401RE LED blink code with main function
|
| 73 |
|
|
|
|
| 76 |
|
| 77 |
### Response:
|
| 78 |
'''
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
```
|
| 80 |
|
| 81 |
## Eğitim Detayları
|