Update README.md
Browse files
README.md
CHANGED
@@ -7,4 +7,69 @@ base_model:
|
|
7 |
- google/flan-t5-base
|
8 |
pipeline_tag: text-generation
|
9 |
library_name: adapter-transformers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
---
|
|
|
7 |
- google/flan-t5-base
|
8 |
pipeline_tag: text-generation
|
9 |
library_name: adapter-transformers
|
10 |
+
license: apache-2.0
|
11 |
+
---
|
12 |
+
|
13 |
+
# flan-python-expert 🚀
|
14 |
+
|
15 |
+
This model is a fine-tuned version of [`google/flan-t5-base`](https://huggingface.co/google/flan-t5-base) on the [`codeagent-python`](https://huggingface.co/datasets/Programming-Language/codeagent-python) dataset.
|
16 |
+
|
17 |
+
It is designed to generate Python code from natural language instructions.
|
18 |
+
|
19 |
+
---
|
20 |
+
|
21 |
+
## 🧠 Model Details
|
22 |
+
|
23 |
+
- **Base Model:** FLAN-T5 Base
|
24 |
+
- **Fine-tuned on:** Python code dataset (`codeagent-python`)
|
25 |
+
- **Task:** Text-to-code generation
|
26 |
+
- **Language:** English
|
27 |
+
- **Framework:** 🤗 Transformers
|
28 |
+
- **Library:** `adapter-transformers`
|
29 |
+
|
30 |
+
---
|
31 |
+
|
32 |
+
## 🏋️ Training
|
33 |
+
|
34 |
+
The model was trained using the following setup:
|
35 |
+
|
36 |
+
```python
|
37 |
+
from transformers import TrainingArguments
|
38 |
+
|
39 |
+
training_args = TrainingArguments(
|
40 |
+
output_dir="flan-python-expert",
|
41 |
+
evaluation_strategy="epoch",
|
42 |
+
learning_rate=2e-6,
|
43 |
+
per_device_train_batch_size=1,
|
44 |
+
per_device_eval_batch_size=1,
|
45 |
+
num_train_epochs=1,
|
46 |
+
weight_decay=0.01,
|
47 |
+
save_total_limit=2,
|
48 |
+
logging_steps=1,
|
49 |
+
push_to_hub=False,
|
50 |
+
)
|
51 |
+
|
52 |
+
```
|
53 |
+
|
54 |
+
|
55 |
+
Trained for 1 epoch
|
56 |
+
|
57 |
+
Optimized for low-resource fine-tuning
|
58 |
+
|
59 |
+
Training performed using Hugging Face Trainer
|
60 |
+
|
61 |
+
## Example Usage
|
62 |
+
```python
|
63 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
64 |
+
|
65 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("MalikIbrar/flan-python-expert")
|
66 |
+
tokenizer = AutoTokenizer.from_pretrained("MalikIbrar/flan-python-expert")
|
67 |
+
|
68 |
+
input_text = "Write a Python function to check if a number is prime."
|
69 |
+
inputs = tokenizer(input_text, return_tensors="pt")
|
70 |
+
|
71 |
+
outputs = model.generate(**inputs, max_length=256)
|
72 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
73 |
+
```
|
74 |
+
|
75 |
---
|