Downloads · 30 days
77
1% of all-time downloads
danyaljj/opengpt2_pytorch_backward
opengpt2_pytorch_backward is a machine learning model from danyaljj. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers.
West et al.'s model from their "reflective decoding" paper.
Downloads · 30 days
77
1% of all-time downloads
All-time downloads
10.5K
Public
Repo size
11.9 GB
Likes
1
Public
Click a slice to open those files.
.bin6 GB · 100%
From the Hugging Face model README
West et al.'s model from their "reflective decoding" paper.
Sample usage:
import torch
from modeling_opengpt2 import OpenGPT2LMHeadModel
from padded_encoder import Encoder
path_to_backward = 'danyaljj/opengpt2_pytorch_backward'
encoder = Encoder()
model_backward = OpenGPT2LMHeadModel.from_pretrained(path_to_backward)
input = "until she finally won."
input_ids = encoder.encode(input)
input_ids = torch.tensor([input_ids[::-1] ], dtype=torch.int)
print(input_ids)
output = model_backward.generate(input_ids)
output_text = encoder.decode(output.tolist()[0][::-1])
print(output_text)
Download the additional files from here: https://github.com/peterwestuw/GPT2ForwardBackward