Code Monkey home page Code Monkey logo

im2latex's People

Contributors

arminkmz 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

Watchers

 avatar  avatar

im2latex's Issues

Crash during train

During training I got:

[Trainer.py], 2020-10-24 22:51:56: start training one epoch
/usr/local/lib/python3.6/dist-packages/torch/nn/functional.py:1614: UserWarning: nn.functional.tanh is deprecated. Use torch.tanh instead.
  warnings.warn("nn.functional.tanh is deprecated. Use torch.tanh instead.")
[Trainer.py], 2020-10-24 22:51:58: Batch 0: loss=4.466525077819824, acc=0.04311377245508982, lr=0.001
[Trainer.py], 2020-10-24 22:52:01: Epoch finished, loss=4.300304094950358 acc=0.1813689656592087, lr=0.001
[Trainer.py], 2020-10-24 22:52:01: training one epoch finished.
[Trainer.py], 2020-10-24 22:52:01: Epoch 1 saved.
/usr/local/lib/python3.6/dist-packages/nltk/translate/bleu_score.py:490: UserWarning: 
Corpus/Sentence contains 0 counts of 2-gram overlaps.
BLEU scores might be undesirable; use SmoothingFunction().
  warnings.warn(_msg)
/usr/local/lib/python3.6/dist-packages/nltk/translate/bleu_score.py:490: UserWarning: 
Corpus/Sentence contains 0 counts of 3-gram overlaps.
BLEU scores might be undesirable; use SmoothingFunction().
  warnings.warn(_msg)
[Training.train], 2020-10-24 19:22:02: BLEU Score: 0.219257
[Training.train], 2020-10-24 19:22:02: Edit Distance Accuracy: 0.023256
[Trainer.py], 2020-10-24 22:52:03: checkpoints/snapshot-01.pt loaded.
[Trainer.py], 2020-10-24 22:52:03: evaluation starts.
[Trainer.py], 2020-10-24 22:52:04: evaluation finished.
[Training.evaluate], 2020-10-24 19:22:04: loss=3.8671720027923584, acc=0.16326530612244897
[Training.evaluate], 2020-10-24 19:22:05: BLEU Score: 0.000188
[Training.evaluate], 2020-10-24 19:22:05: Edit Distance Accuracy: 0.054217
[Trainer.py], 2020-10-24 22:52:05: start training one epoch
Traceback (most recent call last):
  File "main.py", line 171, in <module>
    train(config)
  File "main.py", line 89, in train
    predictions, epoch_loss, epoch_acc = _trainer.train_one_epoch()
  File "/content/im2latex-1/src/trainer.py", line 59, in train_one_epoch
    logits = self.model(x_train, y_train, self.teacher_forcing_ratio)
  File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 722, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/content/im2latex-1/src/model.py", line 116, in forward
    next_token = output.multinomial(1).squeeze(1) # (batch)
RuntimeError: probability tensor contains either `inf`, `nan` or element < 0

What can be a problem?

vocab.pkl is missing

line 64, in load
with open(os.path.join('vocab', 'vocab.pkl'), 'rb') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'vocab/vocab.pkl'

How can i train the model with multi-GPU?

I tried to use DataParallel wrapper for the _model but failed with massive memory warning. The warning is like below.

/pytorch/aten/src/ATen/native/cudnn/RNN.cpp:1266: UserWarning: RNN module weights are not part of single contiguous chunk of memory. This means they need to be compacted at every call, possibly greatly increasing memory usage. To compact weights again call flatten_parameters().
/pytorch/aten/src/ATen/native/cudnn/RNN.cpp:1266: UserWarning: RNN module weights are not part of single contiguous chunk of memory. This means they need to be compacted at every call, possibly greatly increasing memory usage. To compact weights again call flatten_parameters().
/pytorch/aten/src/ATen/native/cudnn/RNN.cpp:1266: UserWarning: RNN module weights are not part of single contiguous chunk of memory. This means they need to be compacted at every call, possibly greatly increasing memory usage. To compact weights again call flatten_parameters().
/pytorch/aten/src/ATen/native/cudnn/RNN.cpp:1266: UserWarning: RNN module weights are not part of single contiguous chunk of memory. This means they need to be compacted at every call, possibly greatly increasing memory usage. To compact weights again call flatten_parameters().
...

I put `self.lstm.flatten_parameters()' to the every self.lstm call, but didn't work.

Do you have any idea for using multi-GPU?

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.