Views
No views yet
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.unsloth/Meta-Llama-3.2-3B1
2# !pip install bitsandbytes peft
3
4from transformers import AutoModelForCausalLM, AutoTokenizer
5from peft import PeftModel
6
7# Load the tokenizer for the base model
8tokenizer = AutoTokenizer.from_pretrained("Vedant3907/Prompt-Generator-Lora-model", use_fast=False)
9
10# Load the base model in 4-bit quantization mode
11base_model = AutoModelForCausalLM.from_pretrained(
12 "Vedant3907/Prompt-Generator-Lora-model",
13 # load_in_4bit=True,
14 trust_remote_code=True
15)
16
17gpt_prompt = """
18### Instruction:
19{}
20
21### Response:
22{}"""
23
24inputs = tokenizer(
25[
26 gpt_prompt.format(
27 "Rapper", # instruction
28 "", # output - leave this blank for generation!
29 )
30], return_tensors = "pt").to("cuda")
31
32outputs = base_model.generate(**inputs, max_new_tokens = 200, use_cache = True)
33tokenizer.batch_decode(outputs)
34
35
36"""
37'<|begin_of_text|>
38
39### Instruction:
40 Rapper
41
42### Response:
43 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.
44 Your lyrics should have an intriguing meaning and message that people can relate too. When it comes to choosing your beat,
45 make sure it is catchy yet relevant to your words, so that when combined they make an explosion of sound everytime!
46 My first request is "I need a rap song about finding strength within yourself."
47<|end_of_text|>'
48"""
49
501args = TrainingArguments(
2 per_device_train_batch_size = 2,
3 gradient_accumulation_steps = 4,
4 warmup_steps = 5,
5 num_train_epochs = 8,
6 # max_steps = 60,
7 learning_rate = 2e-4,
8 fp16 = not is_bfloat16_supported(),
9 bf16 = is_bfloat16_supported(),
10 logging_steps = 1,
11 optim = "adamw_8bit",
12 weight_decay = 0.01,
13 lr_scheduler_type = "linear",
14 seed = 3407,
15 output_dir = "outputs",
16 report_to = "none",
17 )