Locutusque commited on
Commit
c507515
1 Parent(s): da3a2d5

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +67 -1
README.md CHANGED
@@ -1 +1,67 @@
1
- a work in progress...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: openrail
3
+ datasets:
4
+ - Locutusque/ColumnedChatCombined
5
+ - crumb/Clean-Instruct-440k
6
+ language:
7
+ - en
8
+ metrics:
9
+ - bleu
10
+ - perplexity
11
+ - loss
12
+ - reward
13
+ - penalty
14
+ pipeline_tag: text-generation
15
+ ---
16
+ # Model Card
17
+ * this model is deprecated, please see https://huggingface.co/Locutusque/gpt2-large-conversational-retrain for a better performing model.
18
+ ## Model Details
19
+ - Model Name: gpt2-xl-conversational
20
+ - Model Type: Language Modeling
21
+ - Task: Generating Conversational Responses
22
+ - Hardware: 1x Nvidia Titan V
23
+ - Description: This model is trained on a dataset of conversations between a user and an AI assistant, with the goal of generating a coherent and relevant response to the user's input. It uses the GPT-2 architecture, a state-of-the-art transformer-based language model that is capable of generating high-quality text with a wide range of styles and tones. The model is fine-tuned on the conversational data using maximum likelihood estimation, and is evaluated based on its ability to generate responses that are both grammatically correct and semantically relevant to the user's input.
24
+ ## Intended Use
25
+ This model is intended to be used for generating conversational responses in a variety of contexts, such as chatbots, virtual assistants, and customer service applications. It is designed to provide natural and engaging responses to user input, with a focus on maintaining a consistent tone and style throughout the conversation. The model is suitable for use in both text-based and voice-based interfaces, and can be easily integrated into existing applications using the PyTorch and Transformers frameworks.
26
+
27
+ ## Training Data
28
+ The model is trained on a large dataset of conversational data, consisting of interactions between users and an AI assistant. The data is preprocessed to remove any sensitive information and is formatted in a way that is suitable for training a language model. The training data is split into a training set and a validation set, with the training set used to update the model parameters and the validation set used to evaluate the model performance. The model was trained on 550,000 examples over 687,500 steps, it achieved decent metrics.
29
+ ## Model Architecture
30
+ The model architecture used in this model is GPT-2, a transformer-based language model that is capable of generating high-quality text with a wide range of styles and tones. The GPT-2 architecture consists of a multi-layered decoder-only transformer, with self-attention mechanisms that allow the model to capture long-term dependencies and generate coherent text.
31
+
32
+ ## Evaluation Metrics
33
+ The model is evaluated based on several metrics, including loss, reward, penalty, BLEU score, and perplexity. The loss metric is calculated during training and reflects the difference between the predicted output and the actual output. The reward metric is based on the number of correct words generated by the model, while the penalty metric penalizes the model for repeating words consecutively. The BLEU score measures the similarity between the generated text and the ground truth text, while the perplexity metric measures how well the model is able to predict the next word in a sequence. During validation, the model achieved the following metrics:
34
+
35
+ - BLEU score: 35
36
+ - perplexity: 4
37
+ - loss: 1.1
38
+
39
+ ## Limitations and Bias
40
+ This model is not suitable for all use cases due to its limited training time on a weak computer. As a result, it may produce irrelevant or nonsensical responses. For optimal performance, I recommend using a GPU with at least 12 GB of VRAM and downloading the model manually instead of using the Transformers library. Here's how you should deploy the model:
41
+
42
+ ```python
43
+ import torch
44
+ from transformers import GPT2LMHeadModel, AutoTokenizer
45
+ tokenizer = AutoTokenizer.from_pretrained("Locutusque/gpt2-xl-conversational")
46
+ model = GPT2LMHeadModel.from_pretrained("Locutusque/gpt2-xl-conversational", torch_dtype=torch.float16)
47
+ model.resize_token_embeddings(len(tokenizer))
48
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
49
+ model.to(device, dtype=torch.float32)
50
+ def generate_text(model: SENTIAForCausalLM, tokenizer, prompt, max_length=256):
51
+ prompt = f'<|USER|> {prompt} <|ASSISTANT|> '
52
+ input_ids = tokenizer.encode(prompt, add_special_tokens=True, max_length=max_length, truncation=True, return_tensors="pt").to(device)
53
+ output = model.generate(input_ids, do_sample=True, temperature=0.3, top_p=0.7, top_k=23, repetition_penalty=1.176, max_length=max_length, pad_token_id=tokenizer.pad_token_id, eos_token_id=tokenizer.eos_token_id)
54
+ output_ids = tokenizer.decode(output[0], skip_special_tokens=False)
55
+ return output_ids
56
+ # Loop to interact with the model
57
+ while True:
58
+ prompt = input("Enter a prompt (or 'q' to quit): ")
59
+ if prompt == "q":
60
+ break
61
+ output_text = generate_text(model, tokenizer, prompt, max_length=1022)
62
+ print(output_text)
63
+
64
+
65
+ ```
66
+ ## Deploying and training the model
67
+ The model has been fine-tuned on a specific input format that goes like this ```"<|USER|> {user prompt} <|ASSISTANT|> {model prediction} ".```