File size: 4,586 Bytes
0446344
 
 
 
 
 
 
 
 
 
 
394f449
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
---
language:
- en
datasets:
- guanaco
model_hub_library: 
- transformers
license: 
- apache-2.0
---

WizardGuanaco-V1.0 Model Card
The WizardCoder-Guanaco-15B-V1.0 is a language model that combines the strengths of the WizardCoder base model and the Guanaco finetuning dataset. The Guanaco dataset is trimmed to within 2 standard deviations of token size for input and output pairs and all non-english data has been removed to reduce training size requirements.

Model Description
This model is built on top of the WizardCoder base model, a large language model known for its impressive capabilities in code related instruction. The WizardCoder base model was further finetuned using QLORA on the Guanaco dataset to enhance its generative abilities.

However, to ensure more targeted learning and data processing, the Guanaco dataset was trimmed to within 2 standard deviations of token size for question sets. This process enhances the model's ability to generate more precise and relevant answers, eliminating outliers that could potentially distort the responses. In addition, to focus on English language proficiency, all non-English data has been removed from the Guanaco dataset.

Intended Use
This model is designed to be used for a wide array of text generation tasks that require understanding and generating English text. The model is expected to perform well in tasks such as answering questions, writing essays, summarizing text, translation, and more. However, given the specific data processing and finetuning done, it might be particularly effective for tasks related to English language question-answering systems.

Limitations
Despite the powerful capabilities of this model, users should be aware of its limitations. The model's knowledge is up to date only until the time it was trained, and it doesn't know about events in the world after that. It can sometimes produce incorrect or nonsensical responses, as it doesn't understand the text in the same way humans do. It should be used as a tool to assist in generating text and not as a sole source of truth.

How to use
Here is an example of how to use this model:

from transformers import AutoModelForCausalLM, AutoTokenizer
import time
import torch

class Chatbot:
    def __init__(self, model_name):
        self.tokenizer = AutoTokenizer.from_pretrained(model_name, padding_side='left')
        self.model = AutoModelForCausalLM.from_pretrained(model_name, 
                                                          load_in_4bit=True,
                                                          torch_dtype=torch.bfloat16)
        if self.tokenizer.pad_token_id is None:
            self.tokenizer.pad_token_id = self.tokenizer.eos_token_id
            
    def get_response(self, prompt):
        inputs = self.tokenizer.encode_plus(prompt, return_tensors="pt", padding='max_length', max_length=100)
        if next(self.model.parameters()).is_cuda:
            inputs = {name: tensor.to('cuda') for name, tensor in inputs.items()}
        start_time = time.time()
        tokens = self.model.generate(input_ids=inputs['input_ids'], 
                                    attention_mask=inputs['attention_mask'],
                                    pad_token_id=self.tokenizer.pad_token_id,
                                    max_new_tokens=400)
        end_time = time.time()
        output_tokens = tokens[0][inputs['input_ids'].shape[-1]:]
        output = self.tokenizer.decode(output_tokens, skip_special_tokens=True)
        time_taken = end_time - start_time
        return output, time_taken

def main():
    chatbot = Chatbot("LoupGarou/WizardCoder-Guanaco-15B-V1.0")
    while True:
        user_input = input("Enter your prompt: ")
        if user_input.lower() == 'quit':
            break
        output, time_taken = chatbot.get_response(user_input)
        print("\033[33m" + output + "\033[0m")
        print("Time taken to process: ", time_taken, "seconds")
    print("Exited the program.")

if __name__ == "__main__":
    main()


Training Procedure
The base WizardCoder model was finetuned on the Guanaco dataset using QLORA, which was trimmed to within 2 standard deviations of token size for question sets and randomized. All non-English data was also removed from this finetuning dataset.

Acknowledgements
This model is the result of finetuning efforts based on the WizardCoder base model and the Guanaco model. Many thanks to the creators and the community around these models. Special thanks to the Hugging Face team for providing the transformers library which made this work possible.