Update README.md
Browse files
README.md
CHANGED
|
@@ -11,10 +11,93 @@ pipeline_tag: text-generation
|
|
| 11 |
|
| 12 |
### Model Description
|
| 13 |
|
| 14 |
-
This model is a fine-tuned version of **`unsloth/Meta-Llama-3.
|
| 15 |
|
| 16 |
- **Developed by**: Vedant Rajpurohit
|
| 17 |
- **Model type**: Causal Language Model
|
| 18 |
- **Language(s)**: English
|
| 19 |
- **Fine-tuned from model**: `unsloth/Meta-Llama-3.2-3B`
|
| 20 |
-
- **Precision**:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
### Model Description
|
| 13 |
|
| 14 |
+
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.
|
| 15 |
|
| 16 |
- **Developed by**: Vedant Rajpurohit
|
| 17 |
- **Model type**: Causal Language Model
|
| 18 |
- **Language(s)**: English
|
| 19 |
- **Fine-tuned from model**: `unsloth/Meta-Llama-3.2-3B`
|
| 20 |
+
- **Precision**: F32
|
| 21 |
+
|
| 22 |
+
### Direct Use
|
| 23 |
+
|
| 24 |
+
```python
|
| 25 |
+
|
| 26 |
+
# !pip install bitsandbytes peft
|
| 27 |
+
|
| 28 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 29 |
+
from peft import PeftModel
|
| 30 |
+
|
| 31 |
+
# Load the tokenizer for the base model
|
| 32 |
+
tokenizer = AutoTokenizer.from_pretrained("Vedant3907/Prompt-Generator-Lora-model", use_fast=False)
|
| 33 |
+
|
| 34 |
+
# Load the base model in 4-bit quantization mode
|
| 35 |
+
base_model = AutoModelForCausalLM.from_pretrained(
|
| 36 |
+
"Vedant3907/Prompt-Generator-Lora-model",
|
| 37 |
+
# load_in_4bit=True,
|
| 38 |
+
trust_remote_code=True
|
| 39 |
+
)
|
| 40 |
+
|
| 41 |
+
gpt_prompt = """
|
| 42 |
+
### Instruction:
|
| 43 |
+
{}
|
| 44 |
+
|
| 45 |
+
### Response:
|
| 46 |
+
{}"""
|
| 47 |
+
|
| 48 |
+
inputs = tokenizer(
|
| 49 |
+
[
|
| 50 |
+
gpt_prompt.format(
|
| 51 |
+
"Rapper", # instruction
|
| 52 |
+
"", # output - leave this blank for generation!
|
| 53 |
+
)
|
| 54 |
+
], return_tensors = "pt").to("cuda")
|
| 55 |
+
|
| 56 |
+
outputs = base_model.generate(**inputs, max_new_tokens = 200, use_cache = True)
|
| 57 |
+
tokenizer.batch_decode(outputs)
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
"""
|
| 61 |
+
'<|begin_of_text|>
|
| 62 |
+
|
| 63 |
+
### Instruction:\nChatGPT
|
| 64 |
+
|
| 65 |
+
### Response:
|
| 66 |
+
I want you to act as ChatGPT, the artificial intelligence that can mimic the tone and language of a human being.
|
| 67 |
+
Your task is to engage in a conversation with me, and respond with what ChatGPT would say in the given situation.
|
| 68 |
+
Do not write any explanations or other words, just reply with what ChatGPT would say. My first sentence is "Hi, what are your thoughts on politics?"
|
| 69 |
+
<|end_of_text|>'
|
| 70 |
+
"""
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
## Training Details
|
| 76 |
+
|
| 77 |
+
### Training Procedure
|
| 78 |
+
The model was fine-tuned using the **Unsloth library** with LoRA adapters, enabling efficient training. Below are the hyperparameters used:
|
| 79 |
+
|
| 80 |
+
```python
|
| 81 |
+
args = TrainingArguments(
|
| 82 |
+
per_device_train_batch_size = 2,
|
| 83 |
+
gradient_accumulation_steps = 4,
|
| 84 |
+
warmup_steps = 5,
|
| 85 |
+
num_train_epochs = 8,
|
| 86 |
+
# max_steps = 60,
|
| 87 |
+
learning_rate = 2e-4,
|
| 88 |
+
fp16 = not is_bfloat16_supported(),
|
| 89 |
+
bf16 = is_bfloat16_supported(),
|
| 90 |
+
logging_steps = 1,
|
| 91 |
+
optim = "adamw_8bit",
|
| 92 |
+
weight_decay = 0.01,
|
| 93 |
+
lr_scheduler_type = "linear",
|
| 94 |
+
seed = 3407,
|
| 95 |
+
output_dir = "outputs",
|
| 96 |
+
report_to = "none",
|
| 97 |
+
)
|
| 98 |
+
```
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
#### Hardware
|
| 102 |
+
|
| 103 |
+
- Trained on google colab with its T4 GPU
|