rowanz / grover

Code for Defending Against Neural Fake News, https://rowanzellers.com/grover/
Apache License 2.0
917 stars 222 forks source link

Unable to run discriminator #42

Open Leo-0906 opened 4 years ago

Leo-0906 commented 4 years ago

Hello there! Great job with this model!

However, I am getting an error while running a run_discrminator of 'utf-8' codec can't decode byte 0xf8 in position 1: invalid start byte' . Can you help me with that? And also I am a little confused about how to run this discriminator so can you guide me with that? Thank You.

grantnelson commented 4 years ago

+1 A Guide/more documentation on running the discriminator would be awesome!

AiliAili commented 4 years ago

Hi there,

I've successfully made it runnable.Script I've used is:

python ./discrimination/run_discrimination.py --input_data=./generator=mega~dataset=p0.94.jsonl --do_train=True --output_dir=./tem --config_file=./lm/configs/base.json

I am running in the root directory of grover, without using pretrained discriminators.

Hope it can help.

ecrows commented 3 years ago

For those trying to use the pretrained models, here's some basic steps (I used the medium* model as an example).

  1. Use gsutil to download the following files:
    gs://grover-models/discrimination/generator=medium~discriminator=grover~discsize=medium~dataset=p=0.96/model.ckpt-1562.data-00000-of-00001
    gs://grover-models/discrimination/generator=medium~discriminator=grover~discsize=medium~dataset=p=0.96/model.ckpt-1562.index
    gs://grover-models/discrimination/generator=medium~discriminator=grover~discsize=medium~dataset=p=0.96/model.ckpt-1562.meta

You will also need this one (which isn't currently listed):

gs://grover-models/discrimination/generator=medium~discriminator=grover~discsize=medium~dataset=p=0.96/checkpoint
  1. If you need some sample input data download it from the below GCS file.
gs://grover-models/generation_examples/generator=mega~dataset=p0.94.jsonl

Note that each record has a "split" key that determines whether it is "train", "val", or "test" data. When you call the run_discrimination.py script, you can set "predict_val" or "predict_test" to true.

  1. Call the script. Remember you need to set your PYTHONPATH first (as in the main README file).

For example:

python ./discrimination/run_discrimination.py --input_data ./generator_mega_dataset_p0.94.jsonl --output_dir out/ --predict_val true --config_file lm/configs/large.json

*One final note, in the "discrimination.py" script, the model called "medium" is actually Grover-Large from the paper, and therefore uses the "lm/configs/large.json" configuration file. The development name is likely because the size corresponds to GPT-2 medium at 355M parameters.

Hope this helps some people!