danyaljj commited on
Commit
76cc480
1 Parent(s): 8214e4e

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +28 -0
README.md ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ West et al.'s model from their "reflective decoding" paper.
2
+
3
+ Sample usage:
4
+
5
+ ```python
6
+ import torch
7
+ from modeling_opengpt2 import OpenGPT2LMHeadModel
8
+ from padded_encoder import Encoder
9
+
10
+ path_to_forward = 'danyaljj/opengpt2_pytorch_forward'
11
+
12
+ encoder = Encoder()
13
+ model_backward = OpenGPT2LMHeadModel.from_pretrained(path_to_forward)
14
+
15
+ input = "She tried to win but"
16
+ input_ids = encoder.encode(input)
17
+ input_ids = torch.tensor([input_ids ], dtype=torch.int)
18
+ print(input_ids)
19
+
20
+ output = model_backward.generate(input_ids)
21
+
22
+ output_text = encoder.decode(output.tolist()[0])
23
+
24
+ print(output_text)
25
+ ```
26
+
27
+ Download the additional files from here: https://github.com/peterwestuw/GPT2ForwardBackward
28
+