huggingface / huggingface/blog

Having trouble finding generate method from how-to-generate post

Open
#63 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
3.5k
Forks
1k
Avg merge
1d 20h
Merged PRs (30d)
19

Description

Hello,

I want to generate text with GPT-2 and I read the post

**How to generate text: using different decoding methods for language generation with Transformers**

which provides different decoding methods to experiment with.
In the post, the method that generates texts is the `generate()` method of the model object which is a `TFGPT2LMHeadModel`.
Instead of TensorFlow I use PyTorch and looking at the documentation of GPT-2 in Hugging Face [docs](https://huggingface.co/transformers/model_doc/gpt2.html#transformers.models.gpt2.modeling_gpt2.GPT2LMHeadModel.forward), and in particular the documentation of `GPT2LMHeadModel` I cannot find the `generate()` method used in the post, to see how it works, its parameters, etc.

Where can I find details about the `generate()` method?

Thank you in advance.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.