|
--- |
|
datasets: |
|
- fka/awesome-chatgpt-prompts |
|
language: |
|
- en |
|
base_model: |
|
- unsloth/Llama-3.2-3B |
|
pipeline_tag: text-generation |
|
license: mit |
|
--- |
|
|
|
|
|
### Model Description |
|
|
|
This model is a fine-tuned version of **`unsloth/Meta-Llama-3.2-3B`** optimized for **Prompt Generation** tasks when given a act. The fine-tuning was done using the **Unsloth library** with LoRA (Low-Rank Adaptation) for parameter-efficient fine-tuning. The training was done on **fka/awesome-chatgpt-prompts** dataset. |
|
|
|
- **Developed by**: Vedant Rajpurohit |
|
- **Model type**: Causal Language Model |
|
- **Language(s)**: English |
|
- **Fine-tuned from model**: `unsloth/Meta-Llama-3.2-3B` |
|
- **Precision**: F32 |
|
|
|
### Direct Use |
|
|
|
```python |
|
|
|
# !pip install bitsandbytes peft |
|
|
|
from transformers import AutoModelForCausalLM, AutoTokenizer |
|
from peft import PeftModel |
|
|
|
# Load the tokenizer for the base model |
|
tokenizer = AutoTokenizer.from_pretrained("Vedant3907/Prompt-Generator-Lora-model", use_fast=False) |
|
|
|
# Load the base model in 4-bit quantization mode |
|
base_model = AutoModelForCausalLM.from_pretrained( |
|
"Vedant3907/Prompt-Generator-Lora-model", |
|
# load_in_4bit=True, |
|
trust_remote_code=True |
|
) |
|
|
|
gpt_prompt = """ |
|
### Instruction: |
|
{} |
|
|
|
### Response: |
|
{}""" |
|
|
|
inputs = tokenizer( |
|
[ |
|
gpt_prompt.format( |
|
"Rapper", # instruction |
|
"", # output - leave this blank for generation! |
|
) |
|
], return_tensors = "pt").to("cuda") |
|
|
|
outputs = base_model.generate(**inputs, max_new_tokens = 200, use_cache = True) |
|
tokenizer.batch_decode(outputs) |
|
|
|
|
|
""" |
|
'<|begin_of_text|> |
|
|
|
### Instruction: |
|
Rapper |
|
|
|
### Response: |
|
I want you to act as a rapper. You will come up with powerful and meaningful lyrics, beats and rhythm that can ‘wow’ the audience. |
|
Your lyrics should have an intriguing meaning and message that people can relate too. When it comes to choosing your beat, |
|
make sure it is catchy yet relevant to your words, so that when combined they make an explosion of sound everytime! |
|
My first request is "I need a rap song about finding strength within yourself." |
|
<|end_of_text|>' |
|
""" |
|
|
|
|
|
``` |
|
|
|
## Training Details |
|
|
|
### Training Procedure |
|
The model was fine-tuned using the **Unsloth library** with LoRA adapters, enabling efficient training. Below are the hyperparameters used: |
|
|
|
```python |
|
args = TrainingArguments( |
|
per_device_train_batch_size = 2, |
|
gradient_accumulation_steps = 4, |
|
warmup_steps = 5, |
|
num_train_epochs = 8, |
|
# max_steps = 60, |
|
learning_rate = 2e-4, |
|
fp16 = not is_bfloat16_supported(), |
|
bf16 = is_bfloat16_supported(), |
|
logging_steps = 1, |
|
optim = "adamw_8bit", |
|
weight_decay = 0.01, |
|
lr_scheduler_type = "linear", |
|
seed = 3407, |
|
output_dir = "outputs", |
|
report_to = "none", |
|
) |
|
``` |
|
|
|
|
|
#### Hardware |
|
|
|
- Trained on google colab with its T4 GPU |