How to use GPT-2 for topic modelling?

1k Views Asked by At

I want to generate topics and subtopics from a corpus. It would be great if someone could share the python code.

1

There are 1 best solutions below

0
On

Well, the simplest way to do this would be by using the hugginface library. They already have scripts for generating text from several generative models, including gpt-2.The script you're looking for is run_generation.py.You can provide prompts of varying lengths and it can generate text using them.