malteos commited on
Commit
40465eb
1 Parent(s): d755b32

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +30 -0
README.md CHANGED
@@ -17,6 +17,36 @@ widget:
17
  - zero stage 0
18
  - tp/pp = 1
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  ## Evaluation
21
 
22
  | Model (size) | PPL |
 
17
  - zero stage 0
18
  - tp/pp = 1
19
 
20
+
21
+ ### How to use
22
+
23
+ You can use this model directly with a pipeline for text generation. Since the generation relies on some randomness, we
24
+ set a seed for reproducibility:
25
+
26
+ ```python
27
+ >>> from transformers import pipeline, set_seed
28
+ >>> generator = pipeline('text-generation', model='malteos/gpt2-xl-wechsel-german')
29
+ >>> set_seed(42)
30
+ >>> generator("Hello, I'm a language model,", max_length=30, num_return_sequences=5)
31
+
32
+ [{'generated_text': "Hello, I'm a language model, a language for thinking, a language for expressing thoughts."},
33
+ {'generated_text': "Hello, I'm a language model, a compiler, a compiler library, I just want to know how I build this kind of stuff. I don"},
34
+ {'generated_text': "Hello, I'm a language model, and also have more than a few of your own, but I understand that they're going to need some help"},
35
+ {'generated_text': "Hello, I'm a language model, a system model. I want to know my language so that it might be more interesting, more user-friendly"},
36
+ {'generated_text': 'Hello, I\'m a language model, not a language model"\n\nThe concept of "no-tricks" comes in handy later with new'}]
37
+ ```
38
+
39
+ Here is how to use this model to get the features of a given text in PyTorch:
40
+
41
+ ```python
42
+ from transformers import GPT2Tokenizer, GPT2Model
43
+ tokenizer = GPT2Tokenizer.from_pretrained('malteos/gpt2-xl-wechsel-german')
44
+ model = GPT2Model.from_pretrained('malteos/gpt2-xl-wechsel-german')
45
+ text = "Replace me by any text you'd like."
46
+ encoded_input = tokenizer(text, return_tensors='pt')
47
+ output = model(**encoded_input)
48
+ ```
49
+
50
  ## Evaluation
51
 
52
  | Model (size) | PPL |