{"id":28750525,"url":"https://github.com/agermanidis/opengpt-2","last_synced_at":"2025-06-16T21:39:40.107Z","repository":{"id":35188656,"uuid":"204040134","full_name":"agermanidis/OpenGPT-2","owner":"agermanidis","description":null,"archived":false,"fork":false,"pushed_at":"2023-05-22T22:29:16.000Z","size":2520,"stargazers_count":21,"open_issues_count":6,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-08T00:53:45.214Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/agermanidis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-23T17:13:06.000Z","updated_at":"2023-02-04T15:36:39.000Z","dependencies_parsed_at":"2022-09-09T07:30:11.534Z","dependency_job_id":null,"html_url":"https://github.com/agermanidis/OpenGPT-2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/agermanidis/OpenGPT-2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agermanidis%2FOpenGPT-2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agermanidis%2FOpenGPT-2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agermanidis%2FOpenGPT-2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agermanidis%2FOpenGPT-2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agermanidis","download_url":"https://codeload.github.com/agermanidis/OpenGPT-2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agermanidis%2FOpenGPT-2/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260246522,"owners_count":22980405,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-16T21:39:29.119Z","updated_at":"2025-06-16T21:39:39.765Z","avatar_url":"https://github.com/agermanidis.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Grover\n(aka, code for [Defending Against Neural Fake News](https://arxiv.org/abs/1905.12616))\n\nGrover is a model for Neural Fake News -- both generation and detection. However, it probably can also be used for other generation tasks. \n\nVisit our project page at [rowanzellers.com/grover](https://rowanzellers.com/grover), [the AI2 online demo](https://grover.allenai.org), or read the full paper at [arxiv.org/abs/1905.12616](https://arxiv.org/abs/1905.12616). \n\n![teaser](https://i.imgur.com/VAGFpBe.png \"teaser\")\n\n## What's in this repo?\n\nWe are releasing the following:\n* Code for the Grover generator (in [lm/](lm/)). This involves training the model as a language model across fields.\n* Code for the Grover discriminator in [discrimination/](discrimination/). Without much changing, you can run Grover as a discriminator to detect Neural Fake News.\n* Code for generating from a Grover model, in [sample/](sample/).\n* Code for making your own RealNews dataset in [realnews/](realnews/).\n* Model checkpoints freely available online for the Grover-Base and Grover-Large models. For Grover-Mega or the RealNews dataset, please [submit this form](https://docs.google.com/forms/d/1LMAUeUtHNPXO9koyAIlDpvyKsLSYlrBj3rYhC30a7Ak) and we will get back to you as soon as possible.\n\nScroll down 👇 for some easy-to-use instructions for setting up Grover to generate news articles.\n\n## Setting up your environment\n\n*NOTE*: If you just care about making your own RealNews dataset, you will need to set up your environment separately just for that, using an AWS machine (see [realnews/](realnews/).)\n\nThere are a few ways you can run Grover:\n* **Generation mode (inference)**. This requires a GPU because I wasn't able to get top-p sampling, or caching of transformer hidden states, to work on a TPU.\n* **LM Validation mode (perplexity)**. This could be run on a GPU or a TPU, but I've only tested this with TPU inference.\n* **LM Training mode**. This requires a large TPU pod.\n* **Discrimination mode (training)**. This requires a TPU pod.\n* **Discrimination mode (inference)**. This could be run on a GPU or a TPU, but I've only tested this with TPU inference.\n\nI used Python3.6 for everything. Usually I set it up using the following commands:\n```\ncurl -o ~/miniconda.sh -O  https://repo.continuum.io/miniconda/Miniconda3-4.5.4-Linux-x86_64.sh  \u0026\u0026 \\\n     chmod +x ~/miniconda.sh \u0026\u0026 \\\n     ~/miniconda.sh -b -p ~/conda \u0026\u0026 \\\n     rm ~/miniconda.sh \u0026\u0026 \\\n     ~/conda/bin/conda install -y python=3.6\n```\nThen `pip install -r requirements-gpu.txt` if you're installing on a GPU, or `pip install requirements-tpu.txt` for TPU.\n\nMisc notes/tips:\n* If you have a lot of projects on your machine, you might want to use an anaconda environment to handle them all. Use `conda create -n grover python=3.6` to create an environment named `grover`. To enter the environment use `source activate grover`. To leave use `source deactivate`.\n* I'm using tensorflow `1.13.1` which requires Cuda `10.0`. You'll need to install that from the nvidia website. I usually install it into `/usr/local/cuda-10.0/`, so you will need to run `export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64` so tensorflow knows where to find it. \n* I always have my pythonpath as the root directory. While in the `grover` directory, run `export PYTHONPATH=$(pwd)` to set it.\n\n## Quickstart: setting up Grover for generation!\n\n1. Set up your environment. Here's the easy way, assuming anaconda is installed: `conda create -y -n grover python=3.6 \u0026\u0026 source activate grover \u0026\u0026 pip install -r requirements-gpu.txt`\n2. Download the model using `python download_model.py base`\n3. Now generate: `PYTHONPATH=$(pwd) python sample/contextual_generate.py -model_config_fn lm/configs/base.json -model_ckpt models/base/model.ckpt -metadata_fn sample/april2019_set_mini.jsonl -out_fn april2019_set_mini_out.jsonl`\n\nCongrats! You can view the generations, conditioned on the domain/headline/date/authors, in `april2019_set_mini_out.jsonl`.\n\n\n### Bibtex\n\n```\n@inproceedings{zellers2019grover,\n    title={Defending Against Neural Fake News},\n    author={Zellers, Rowan and Holtzman, Ari and Rashkin, Hannah and Bisk, Yonatan and Farhadi, Ali and Roesner, Franziska and Choi, Yejin},\n    journal={arXiv preprint arXiv:1905.12616},\n    year={2019}\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagermanidis%2Fopengpt-2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagermanidis%2Fopengpt-2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagermanidis%2Fopengpt-2/lists"}