ktrapeznikov commited on
Commit
d048b57
·
1 Parent(s): 8cd96ce

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +44 -0
README.md ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ thumbnail:
5
+ widget:
6
+ - text: "topic climate source"
7
+ ---
8
+
9
+ # GPT2-medium-topic-news
10
+
11
+ ## Model description
12
+
13
+ GPT2-medium fine tuned on a small news corpus conditioned on a topic, source, title
14
+
15
+ ## Intended uses & limitations
16
+
17
+ #### How to use
18
+
19
+ To generate a news article text conditioned on a topic, source, title or some subsets, prompt model with:
20
+ ```python
21
+ f"topic {topic} source"
22
+ f"topic {topic} source {source} title"
23
+ f"topic {topic} source {source} title {title} body"
24
+ ```
25
+
26
+ Try the following tags for `topic: climate, weather, vaccination`.
27
+
28
+ Zero shot generation works pretty well as long as `topic` is a single word and not too specific.
29
+
30
+ ```python
31
+ device = "cuda:0"
32
+ tokenizer = AutoTokenizer.from_pretrained("ktrapeznikov/gpt2-medium-topic-small-set")
33
+ model = AutoModelWithLMHead.from_pretrained("ktrapeznikov/gpt2-medium-topic-small-set")
34
+ model.to(device)
35
+ topic = "climate"
36
+ prompt = tokenizer(f"topic {topics} source straitstimes title", return_tensors="pt")
37
+ out = model.generate(prompt["input_ids"].to(device), do_sample=True,max_length=500, early_stopping=True, top_p=.9)
38
+ print(tokenizer.decode(out[0].cpu(), skip_special_tokens=True))
39
+ ```
40
+
41
+ ## Training data
42
+
43
+
44
+ ## Training procedure