Sharathhebbar24 commited on
Commit
c4f42b5
1 Parent(s): 940fe55

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +40 -1
README.md CHANGED
@@ -5,4 +5,43 @@ datasets:
5
  language:
6
  - en
7
  pipeline_tag: text-generation
8
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  language:
6
  - en
7
  pipeline_tag: text-generation
8
+ ---
9
+
10
+ This model is a finetuned version of ```gpt2``` using ```HuggingFaceH4/ultrachat_200k```
11
+
12
+ ## Model description
13
+
14
+ GPT-2 is a transformers model pre-trained on a very large corpus of English data in a self-supervised fashion. This
15
+ means it was pre-trained on the raw texts only, with no humans labeling them in any way (which is why it can use lots
16
+ of publicly available data) with an automatic process to generate inputs and labels from those texts. More precisely,
17
+ it was trained to guess the next word in sentences.
18
+
19
+ More precisely, inputs are sequences of continuous text of a certain length and the targets are the same sequence,
20
+ shifting one token (word or piece of word) to the right. The model uses a masking mechanism to make sure the
21
+ predictions for the token `i` only use the inputs from `1` to `i` but not the future tokens.
22
+
23
+ This way, the model learns an inner representation of the English language that can then be used to extract features
24
+ useful for downstream tasks. The model is best at what it was trained for, however, which is generating texts from a
25
+ prompt.
26
+
27
+ ### To use this model
28
+
29
+ ```python
30
+ >>> from transformers import AutoTokenizer, AutoModelForCausalLM
31
+ >>> model_name = "Sharathhebbar24/chat_gpt2"
32
+ >>> model = AutoModelForCausalLM.from_pretrained(model_name)
33
+ >>> tokenizer = AutoTokenizer.from_pretrained("gpt2")
34
+ >>> def generate_text(prompt):
35
+ >>> inputs = tokenizer.encode(prompt, return_tensors='pt')
36
+ >>> outputs = mod1.generate(inputs, max_length=64, pad_token_id=tokenizer.eos_token_id)
37
+ >>> generated = tokenizer.decode(outputs[0], skip_special_tokens=True)
38
+ >>> return generated[:generated.rfind(".")+1]
39
+ >>> prompt = """
40
+ >>> user: what are you?
41
+ >>> assistant: I am a Chatbot intended to give a python program
42
+ >>> user: hmm, can you write a python program to print Hii Heloo
43
+ >>> assistant: Sure Here is a python code.\n print("Hii Heloo")
44
+ >>> user: Can you write a Linear search program in python
45
+ >>> """
46
+ >>> res = generate_text(prompt)
47
+ >>> res