永远训练NLP深度学习模型

时间:2020-02-05 19:30:20

标签: python tensorflow

我是python中NLP深度学习模型的新手,我正在尝试根据以下内容提供的可靠教程来训练一个: Deep Learning for NLP tutorial

我当前面临的问题是,当我尝试使用以下代码训练模型时:

# Train Model
for epoch in range(1, 6):
    loss = 0.
    i = 0
    for x, y in generate_context_word_pairs(corpus=wids, window_size=window_size, vocab_size=vocab_size):
        i += 1
        loss += cbow.train_on_batch(x, y)
        if i % 100000 == 0:
            print('Processed {} (context, word) pairs'.format(i))

    print('Epoch:', epoch, '\tLoss:', loss)
    print()

我得到以下警告,并且该模型从未完成执行:

C:\Users\dbamp\Anaconda3\lib\site-packages\tensorflow_core\python\framework\indexed_slices.py:424: UserWarning: Converting sparse IndexedSlices to a dense Tensor of unknown shape. This may consume a large amount of memory.
  "Converting sparse IndexedSlices to a dense Tensor of unknown shape. "

任何有关如何解决此问题的想法将非常有帮助!

0 个答案:

没有答案