ymcui / Chinese-XLNet

Pre-Trained Chinese XLNet(中文XLNet预训练模型)
http://xlnet.hfl-rc.com
Apache License 2.0
1.65k stars 280 forks source link

prediction example長度和實際example長度不同 #20

Closed allenyummy closed 5 years ago

allenyummy commented 5 years ago

想請問為何我的prediction example長度和實際example長度不同。 是因為以下程式碼的關係嗎? 我沒有使用TPU,而是使用GPU。

  if FLAGS.do_eval:
    # TPU requires a fixed batch size for all batches, therefore the number
    # of examples must be a multiple of the batch size, or else examples
    # will get dropped. So we pad with fake examples which are ignored
    # later on. These do NOT count towards the metric (all tf.metrics
    # support a per-instance weight, and these get a weight of 0.0).
    #
    # Modified in XL: We also adopt the same mechanism for GPUs.
    while len(eval_examples) % FLAGS.eval_batch_size != 0:
      eval_examples.append(PaddingInputExample())
ymcui commented 5 years ago

是的,要求整除eval_batch_size,不够的部分会用PaddingInputExample()补齐。

allenyummy commented 5 years ago

在產出prediction之後,是否可以直接把後面幾項針對fake examples做出的prediciton直接刪除即可? 感謝回覆!

ymcui commented 5 years ago

of course