Git Product home page Git Product logo

bert-gen's Introduction

bert-gen

see https://sites.google.com/site/deepernn/home/blog/amistakeinwangchoberthasamouthanditmustspeakbertasamarkovrandomfieldlanguagemodel for the description of a mistake in the paper. BERT seems to be a non-equilibrium language model, not an MRF language model.

see https://arxiv.org/abs/1902.04094 for details.

@article{wang2019bert,
  title={BERT has a Mouth, and It Must Speak: BERT as a Markov Random Field Language Model},
  author={Wang, Alex and Cho, Kyunghyun},
  journal={arXiv preprint arXiv:1902.04094},
  year={2019}
}

bert-gen's People

Contributors

kyunghyuncho avatar w4ngatang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bert-gen's Issues

How about Perplexity? (in addition to BLEU)

The colab example using BLEU is helpful & thanks. I'm wondering whether there is any plan to measure by PPL (Perplexity). Or any pointer showing how to measure the performance of generative models by PPL in general?

Strange output from unchanged generate.py

When I run generate.py with no changes (except removing pdb) this is the output I see:

The pre-trained model you are loading is a cased model but you have not set `do_lower_case` to False. We are setting `do_lower_case=False` for you but you may want to check this behavior.
Decoding strategy sequential, argmax at each step
Iteration 0: this is a sentence .
	BERT prediction: . is a . .
Iteration 1: . is a sentence .
	BERT prediction: . is a . .
Iteration 2: . is a sentence .
	BERT prediction: . is a . .
Iteration 3: . is a sentence .
	BERT prediction: . is a . .
Iteration 4: . is a . .
	BERT prediction: . . a . .
Final: . is a . .

That doesn't seem to be the desired result. Why so many periods? If this is expected, can you give me an example of an input and configuration that will find the correct answer?

How to use?

Hello,

Your work looks interesting.

Could you provide some instructions as to how to start generating sample sentences?

IndexError: list index out of range in detokenize

I get an error after running

for temp in [1.0]:
    bert_sents = generate(n_samples, seed_text=seed_text, batch_size=batch_size, max_len=max_len,
                          sample=sample, top_k=top_k, temperature=temp, burnin=burnin, max_iter=max_iter,
                          cuda=True)
    out_file = "data/%s-len%d-burnin%d-topk%d-temp%.3f.txt" % (model_version, max_len, burnin, top_k, temp)
    write_sents(out_file, bert_sents, should_detokenize=True)

Stacktrace:

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-23-776125cadf25> in <module>()
     18                           cuda=True)
     19     out_file = "data/%s-len%d-burnin%d-topk%d-temp%.3f.txt" % (model_version, max_len, burnin, top_k, temp)
---> 20     write_sents(out_file, bert_sents, should_detokenize=True)

<ipython-input-19-027cb8b83cc4> in write_sents(out_file, sents, should_detokenize)
     15     with open(out_file, "w") as out_fh:
     16         for sent in sents:
---> 17             sent = detokenize(sent[1:-1]) if should_detokenize else sent
     18             out_fh.write("%s\n" % " ".join(sent))

<ipython-input-16-beace4564740> in detokenize(sent)
     20     for i, tok in enumerate(sent):
     21         if tok.startswith("##"):
---> 22             new_sent[len(new_sent) - 1] = new_sent[len(new_sent) - 1] + tok[2:]
     23         else:
     24             new_sent.append(tok)

IndexError: list index out of range

The saved file head

$ head -n3 bert-base-uncased-len40-burnin250-topk100-temp1.000.txt 
sammy harves [ " baby candy " / " dream of baby candy " ( gas station theme ) ) mary ford and baby candy . ( gas station theme ) concept album , featuring mary ford .
3 . contemporary art review ( 2nd ed . october 2008 ) , review with essays on contemporary art , ( london : bateman & partners , february 2009 ) sculpture and the minimalist movement , part .
the truth outside ( matthew greengrass ) psycho ( 1964 ? ) psycho ( orson welles ) monster show ( orson welles ) ( barnacles ) part 3 ( the snare drum ) - narration ;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.