PEFT
Safetensors
Generated from Trainer
khushimalik53 commited on
Commit
5a3ec20
·
verified ·
1 Parent(s): e1af8c3

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +73 -8
README.md CHANGED
@@ -20,17 +20,59 @@ This model is a fine-tuned version of [bigcode/starcoder2-3b](https://huggingfac
20
 
21
  ## Model description
22
 
23
- More information needed
24
 
25
- ## Intended uses & limitations
26
 
27
- More information needed
 
 
 
 
 
28
 
29
- ## Training and evaluation data
30
 
31
- More information needed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
- ## Training procedure
34
 
35
  ### Training hyperparameters
36
 
@@ -45,7 +87,18 @@ The following hyperparameters were used during training:
45
  - mixed_precision_training: Native AMP
46
 
47
  ### Training results
48
-
 
 
 
 
 
 
 
 
 
 
 
49
 
50
 
51
  ### Framework versions
@@ -54,4 +107,16 @@ The following hyperparameters were used during training:
54
  - Transformers 4.52.4
55
  - Pytorch 2.6.0+cu124
56
  - Datasets 3.6.0
57
- - Tokenizers 0.21.1
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
  ## Model description
22
 
23
+ It’s designed to serve as an intelligent coding copilot: generate code, explain functions, refactor logic, and complete partial implementations.
24
 
25
+ ## 🚀 Features
26
 
27
+ - 🔍 **Multi-task formatting**: Instruction-tuned samples with tasks like code generation, docstring generation, function completion, and code improvement.
28
+ - ⚡ **Efficient LoRA training** using `PEFT` and `transformers`.
29
+ - 🧠 Token-level preprocessing with Hugging Face's tokenizer and trainer utilities.
30
+ - 📊 Training tracked via Weights & Biases (W&B).
31
+ - 🔬 Dataset sampling + tokenization to stay memory-efficient.
32
+ - 🛠️ Ready for inference integration and API deployment.
33
 
34
+ ## 🧪 Dataset
35
 
36
+ - **Source**: `code_search_net` (Python split)
37
+ - **Fields Used**: `func_code_string`, `func_documentation_string`
38
+ - **Size after sampling**:
39
+ - Train: 1000 samples
40
+ - Validation: 200 samples
41
+ - Test: 200 samples
42
+
43
+ ## 🧪 Format: Multi-Task Examples
44
+
45
+ Examples were formatted into prompts like:
46
+
47
+ Instruction:
48
+ Write a function for this description:
49
+ "Calculate factorial recursively."
50
+
51
+ Response:
52
+ def factorial(n):
53
+ return 1 if n == 0 else n * factorial(n - 1)
54
+
55
+ ## 🧠 Model
56
+
57
+ - **Base**: `bigcode/starcoder2-3b`
58
+ - **PEFT Config**:
59
+ - `r=8`, `lora_alpha=16`
60
+ - `target_modules=["q_proj", "v_proj"]`
61
+ - `dropout=0.05`, `bias="none"`
62
+
63
+ - **Training Config**:
64
+ - `per_device_train_batch_size=4`
65
+ - `num_train_epochs=3`
66
+ - `learning_rate=2e-4`
67
+ - `save_steps=100`
68
+ - `logging_dir=./logs`
69
+
70
+ ## 🧰 Dependencies
71
+
72
+ ```bash
73
+ pip install transformers peft datasets accelerate wandb
74
+ pip install bitsandbytes
75
 
 
76
 
77
  ### Training hyperparameters
78
 
 
87
  - mixed_precision_training: Native AMP
88
 
89
  ### Training results
90
+ Step Training Loss
91
+ 500 1.700700
92
+ 1000 1.305100
93
+ 1500 1.234500
94
+ [3000/3000 1:11:12, Epoch 3/3]
95
+ Step Training Loss
96
+ 500 1.700700
97
+ 1000 1.305100
98
+ 1500 1.234500
99
+ 2000 1.229400
100
+ 2500 1.185200
101
+ 3000 1.203400
102
 
103
 
104
  ### Framework versions
 
107
  - Transformers 4.52.4
108
  - Pytorch 2.6.0+cu124
109
  - Datasets 3.6.0
110
+ - Tokenizers 0.21.1
111
+
112
+ ### Run Locally
113
+
114
+ from transformers import AutoTokenizer, AutoModelForCausalLM
115
+
116
+ tokenizer = AutoTokenizer.from_pretrained("path/to/your/fine-tuned-model")
117
+ model = AutoModelForCausalLM.from_pretrained("path/to/your/fine-tuned-model")
118
+
119
+ prompt = "### Instruction:\nExplain what this function does:\ndef reverse_string(s): return s[::-1]\n\n### Response:\n"
120
+ inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
121
+ output = model.generate(**inputs, max_new_tokens=100)
122
+ print(tokenizer.decode(output[0], skip_special_tokens=True))