{"id":13641110,"url":"https://github.com/rowanz/grover","last_synced_at":"2025-04-20T07:31:59.255Z","repository":{"id":39737372,"uuid":"190279949","full_name":"rowanz/grover","owner":"rowanz","description":"Code for Defending Against Neural Fake News, https://rowanzellers.com/grover/","archived":false,"fork":false,"pushed_at":"2023-05-22T22:28:43.000Z","size":673,"stargazers_count":921,"open_issues_count":41,"forks_count":219,"subscribers_count":35,"default_branch":"master","last_synced_at":"2025-04-19T12:55:44.760Z","etag":null,"topics":["fake-news-classification","text-generation"],"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/rowanz.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,"governance":null}},"created_at":"2019-06-04T21:10:55.000Z","updated_at":"2025-03-21T14:11:40.000Z","dependencies_parsed_at":"2023-01-22T10:00:18.549Z","dependency_job_id":"217573b5-9df2-43a9-8d24-2c1e52bd6f21","html_url":"https://github.com/rowanz/grover","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rowanz%2Fgrover","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rowanz%2Fgrover/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rowanz%2Fgrover/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rowanz%2Fgrover/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rowanz","download_url":"https://codeload.github.com/rowanz/grover/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249864281,"owners_count":21336721,"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":["fake-news-classification","text-generation"],"created_at":"2024-08-02T01:01:17.853Z","updated_at":"2025-04-20T07:31:58.869Z","avatar_url":"https://github.com/rowanz.png","language":"Python","readme":"# Grover\n##### UPDATE, Sept 17 2019. We got into NeurIPS (camera ready coming soon!) and we've made Grover-Mega publicly available without you needing to fill out the form. You can download it using [download_model.py](download_model.py).\n\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 *all* of the Grover models. For using the RealNews dataset for research, please [submit this form](https://docs.google.com/forms/d/1LMAUeUtHNPXO9koyAIlDpvyKsLSYlrBj3rYhC30a7Ak) and message me on [contact me on Twitter](https://twitter.com/rown) or [through email](https://scr.im/rowan). You will need to use a valid account that has google cloud enabled, otherwise, I won't be able to give you access 😢\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\n**NOTE**: You might be able to get things to work using different hardware. However, it might be a lot of work engineering wise and I don't recommend it if possible. Please don't contact me with requests like this, as there's not much help I can give you.\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## FAQ: What's the deal with the release of Grover?\n\nOur core position is that [it is important to release possibly-dangerous models to researchers](https://thegradient.pub/why-we-released-grover/). At the same time, we believe Grover-Mega isn't particularly useful to anyone who isn't doing research in this area, particularly as [we have an online web demo available](https://grover.allenai.org/) and the model is computationally expensive. We previously were a bit stricter and limited initial use of Grover-Mega to researchers. Now that several months have passed since we put the paper on arxiv, and since several other large-scale language models have been publicly released, we figured that there is little harm in fully releasing Grover-Mega.\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    booktitle={Advances in Neural Information Processing Systems 32},\n    year={2019}\n}\n```\n","funding_links":[],"categories":["🛡️ Adversarial Testing","Deepfake Texts","Industrial Strength NLP","AutoML NLP","Industry Strength NLP","Python","5. Generation of synthetic content"],"sub_categories":["Codes Mainly on Detection","5.1 Generation Text"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frowanz%2Fgrover","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frowanz%2Fgrover","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frowanz%2Fgrover/lists"}