kaifkhaan commited on
Commit
53bb157
1 Parent(s): 74f6daf

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +128 -3
README.md CHANGED
@@ -1,3 +1,128 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ datasets:
4
+ - kaifkhaan/roast
5
+ base_model:
6
+ - mistralai/Mistral-7B-Instruct-v0.1
7
+ tags:
8
+ - not-for-all-audiences
9
+ ---
10
+ # Mistral Roast bot
11
+
12
+ Welcome to the Mistral Roastbot model repository! This model has been fine-tuned on custom Roast data and is designed to generate Uncensored Roasts in the context of any queries from the user.
13
+
14
+ ## Model Details
15
+
16
+ - **Model Name**: Mistral Roast bot
17
+ - **Model Architecture**: [Mistral](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1)
18
+ - **Model Type**: Causal Language Model
19
+ - **Training Data**: Fine-tuned on a custom dataset of kaifkhaan/roast.
20
+
21
+ ## Usage
22
+
23
+ ### Installation
24
+
25
+ To use this model, you will need the `transformers` and `llama_cpp` libraries installed. You can install them using pip:
26
+
27
+ ```bash
28
+ pip install transformers llama_cpp bitsandbytes accelerate
29
+ ```
30
+
31
+ ```bash
32
+ from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig , pipeline
33
+ import torch
34
+
35
+ # Configuration for the nf4 quantization
36
+ nf4_config = BitsAndBytesConfig(
37
+ load_in_4bit=True,
38
+ bnb_4bit_quant_type="nf4",
39
+ bnb_4bit_use_double_quant=True,
40
+ bnb_4bit_compute_dtype=torch.bfloat16
41
+ )
42
+
43
+
44
+
45
+ # Load the fine-tuned model and tokenizer
46
+ model = AutoModelForCausalLM.from_pretrained(
47
+ "kaifkhaan/Roast_Bot",
48
+ device_map='auto',
49
+ quantization_config=nf4_config,
50
+ use_cache=False
51
+ )
52
+
53
+ tokenizer = AutoTokenizer.from_pretrained("kaifkhaan/Roast_Bot" )
54
+
55
+ # Ensure pad token and padding side are correctly set
56
+ tokenizer.pad_token = tokenizer.eos_token
57
+ tokenizer.padding_side = "right"
58
+
59
+ def generate_response(prompt, model, tokenizer):
60
+ # Add the custom instruction and format the prompt
61
+ #try giving different instruction as per your need and have fun !
62
+ instruction = "You are a chatbot that will roast the user while also using uncensored curse words and offensive statements while simultaneously answering his queries. Use the provided input and create a roast response also use as many curse words in the response as possible ."
63
+ full_prompt = f"<s>### Instruction:\n{instruction}\n\n### Input:\n{prompt}\n\n### Response:"
64
+
65
+ # Encode the prompt
66
+ encoded_input = tokenizer(full_prompt, return_tensors="pt", add_special_tokens=True)
67
+ model_inputs = encoded_input.to('cuda')
68
+
69
+ # Generate text from the model
70
+ generated_ids = model.generate(
71
+ **model_inputs,
72
+ max_new_tokens=350, # Adjust as needed
73
+ do_sample=True,
74
+ temperature=0.6, # Control randomness
75
+ top_k=50, # Limits sampling to top k tokens
76
+ top_p=0.95, # Nucleus sampling
77
+ pad_token_id=tokenizer.eos_token_id
78
+ )
79
+
80
+ # Decode the generated text
81
+ decoded_output = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)
82
+
83
+ # Extract the response part
84
+ response = decoded_output[0]
85
+ response = response.split("### Response:")[1].strip() if "### Response:" in response else response.strip()
86
+
87
+ return response
88
+
89
+ # Example prompt
90
+
91
+
92
+ prompt = "am i pretty ?"
93
+
94
+ # Generate the response
95
+ response = generate_response(prompt, model, tokenizer)
96
+
97
+ print(response)
98
+ ```
99
+
100
+ ```bash
101
+ response = "you look like a sack of sh*t with a face."
102
+ ```
103
+
104
+ ### Training
105
+
106
+ The model was fine-tuned on a custom dataset consisting of Roasts between user and the bot. The fine-tuning process involved training the model for 15 epochs using a batch size of 16 on a single GPU.
107
+
108
+ ## Hyperparameters
109
+ - **Learning Rate**: 2e-4
110
+ - **Batch Size**: 16
111
+ - **Number of Epochs**: 15
112
+ - **Optimizer**: AdamW
113
+
114
+
115
+ ### Limitations and Biases
116
+
117
+ - **Domain Specific**: The model is fine-tuned specifically for fun and roast purpose.
118
+
119
+ ### Citation
120
+ ```bibtex
121
+ @misc{mistral_Roastbot_2024,
122
+ author = {kaifkhaan},
123
+ title = {Mistral Roast Model},
124
+ year = {2024},
125
+ publisher = {Hugging Face},
126
+ url = {https://huggingface.co/kaifkhaan/Roast_Bot}
127
+ }
128
+ ```