Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,85 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
datasets:
|
| 4 |
+
- pacovaldez/stackoverflow-questions
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
base_model:
|
| 8 |
+
- google/flan-t5-base
|
| 9 |
+
library_name: transformers
|
| 10 |
+
tags:
|
| 11 |
+
- Stackoverflow
|
| 12 |
+
- flan-t5
|
| 13 |
+
- peft
|
| 14 |
+
- lora
|
| 15 |
+
- seq2seq
|
| 16 |
+
---
|
| 17 |
+
# 🤖 FLAN-T5 Base Fine-Tuned on Stack Overflow Questions (LoRA)
|
| 18 |
+
This is a fine-tuned version of [`google/flan-t5-base`](https://huggingface.co/google/flan-t5-base) on a curated dataset of Stack Overflow programming questions. It was trained using [LoRA](https://arxiv.org/abs/2106.09685) (Low-Rank Adaptation) for parameter-efficient fine-tuning, making it compact, efficient, and effective at modeling developer-style Q&A tasks.
|
| 19 |
+
---
|
| 20 |
+
## 🧠 Model Objective
|
| 21 |
+
The model is trained to:
|
| 22 |
+
- Rewrite or improve unclear programming questions
|
| 23 |
+
- Generate relevant clarifying questions or answers
|
| 24 |
+
- Summarize long developer queries
|
| 25 |
+
- Serve as a code-aware Q&A assistant
|
| 26 |
+
---
|
| 27 |
+
## 📚 Training Data
|
| 28 |
+
- **Source**: Stack Overflow public questions dataset (cleaned)
|
| 29 |
+
- **Format**: Instruction-like examples, Q&A pairs, summarization prompts
|
| 30 |
+
- **Cleaning**: HTML stripping, markdown-to-text, code-preserved
|
| 31 |
+
- **Size**: ~15k examples
|
| 32 |
+
---
|
| 33 |
+
## 🏗️ Training Details
|
| 34 |
+
- **Base Model**: `google/flan-t5-base`
|
| 35 |
+
- **Adapter Format**: LoRA using [`peft`](https://github.com/huggingface/peft)
|
| 36 |
+
- **Files**:
|
| 37 |
+
- `adapter_model.safetensors`
|
| 38 |
+
- `adapter_config.json`
|
| 39 |
+
- **Hyperparameters**:
|
| 40 |
+
- `r`: 8
|
| 41 |
+
- `lora_alpha`: 16
|
| 42 |
+
- `lora_dropout`: 0.1
|
| 43 |
+
- `bias`: "none"
|
| 44 |
+
- `task_type`: "SEQ_2_SEQ_LM"
|
| 45 |
+
- **Inference Mode**: Enabled
|
| 46 |
+
---
|
| 47 |
+
## 💡 How to Use
|
| 48 |
+
```python
|
| 49 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
| 50 |
+
from peft import PeftModel
|
| 51 |
+
|
| 52 |
+
# Load tokenizer and base model
|
| 53 |
+
tokenizer = AutoTokenizer.from_pretrained("google/flan-t5-base")
|
| 54 |
+
base_model = AutoModelForSeq2SeqLM.from_pretrained("google/flan-t5-base")
|
| 55 |
+
|
| 56 |
+
# Load LoRA adapter
|
| 57 |
+
model = PeftModel.from_pretrained(base_model, "your-model-folder")
|
| 58 |
+
model.eval()
|
| 59 |
+
|
| 60 |
+
# Inference
|
| 61 |
+
prompt = "Rewrite this question more clearly: why is my javascript function undefined?"
|
| 62 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
| 63 |
+
outputs = model.generate(**inputs)
|
| 64 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
🧪 Intended Use
|
| 68 |
+
This model is best suited for:
|
| 69 |
+
Code-aware chatbot assistants
|
| 70 |
+
Prompt engineering for developer tools
|
| 71 |
+
Developer-focused summarization / rephrasing
|
| 72 |
+
Auto-moderation / clarification of tech questions
|
| 73 |
+
|
| 74 |
+
⚠️ Limitations
|
| 75 |
+
Not trained for code generation or long-form answers
|
| 76 |
+
May hallucinate incorrect or generic responses
|
| 77 |
+
Finetuned only on Stack Overflow — domain-specific
|
| 78 |
+
|
| 79 |
+
✨ Acknowledgements
|
| 80 |
+
Hugging Face Transformers
|
| 81 |
+
LoRA (PEFT)
|
| 82 |
+
Stack Overflow for open data
|
| 83 |
+
FLAN-T5: Scaling Instruction-Finetuned Models
|
| 84 |
+
|
| 85 |
+
🛠️ Created with love by Kunj | Model suggestion & guidance by ChatGPT
|