Downloads · 30 days
0
Leli1024/GPT2-ChainOfThought
GPT2-ChainOfThought is a machine learning model from Leli1024. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This model was created using GPT-2 as a base, and fine-tuned upon a dataset of elementary school problems requiring logic and reasoning. Requires Pytorch
Downloads · 30 days
0
Access
Public
Updated Apr 22, 2022
Repo size
—
Likes
1
Public
Click a slice to open those files.
Other1.2 KB · 53%
From the Hugging Face model README
This model was created using GPT-2 as a base, and fine-tuned upon a dataset of elementary school problems requiring logic and reasoning. Requires Pytorch
How to use to infer text
from transformers import AutoTokenizer, AutoModelForCasualLM
import torch
type = "gpt2-large"
tokenizer = AutoTokenizer.from_pretrained(type)
model = AutoModelForCausalLM.from_pretrained(type)
model_path = '../model.pt'
model = torch.load(model_path)
your_text = "A courier received 50 packages yesterday and twice as many today. All of these should be delivered tomorrow. How many packages should be delivered tomorrow?"
encoded_text = self.tokenizer.encode(your_text, return_tensors='pt')
outputs = model.generate(encoded_text, max_length=64, do_sample=True, temperature=0.5, top_p=1)
outputs = [tokenizer.decode(output) for output in outputs]