DeepSpeech icon indicating copy to clipboard operation
DeepSpeech copied to clipboard

Out of memory issue when --train_batch_size is 100

Open harrypotter90 opened this issue 9 years ago • 11 comments

I get a Out of memory issue when i set train_batchsize = 100

I tensorflow/core/common_runtime/bfc_allocator.cc:696] 4 Chunks of size 252137728 totalling 961.83MiB
I tensorflow/core/common_runtime/bfc_allocator.cc:700] Sum Total of in-use chunks: 3.63GiB
I tensorflow/core/common_runtime/bfc_allocator.cc:702] Stats: 
Limit:                  3894804480
InUse:                  3894778368
MaxInUse:               3894803200
NumAllocs:                    7341
MaxAllocSize:            252137728

W tensorflow/core/common_runtime/bfc_allocator.cc:274] **********************************xx****************************************************************
W tensorflow/core/common_runtime/bfc_allocator.cc:275] Ran out of memory trying to allocate 193.0KiB.  See logs for memory state.
W tensorflow/core/framework/op_kernel.cc:993] Resource exhausted: OOM when allocating tensor with shape[100,494]

Same command and dataset but when --train_batch_size= 1 It works all fine..

D Sending Job (id: 56, worker: 0, epoch: 1, set_name: test)...
I Test of Epoch 1 - WER: 1.000000, loss: 142.373315187, mean edit distance: 0.936888
I --------------------------------------------------------------------------------
I WER: 1.000000, loss: 20.758251, mean edit distance: 1.000000
I  - src: "aaah"
I  - res: ""
I --------------------------------------------------------------------------------
I WER: 1.000000, loss: 21.429127, mean edit distance: 1.000000
I  - src: "aaah"
I  - res: ""
I --------------------------------------------------------------------------------
I WER: 1.000000, loss: 21.995270, mean edit distance: 1.000000
I  - src: "mmm"
I  - res: ""
I --------------------------------------------------------------------------------
I WER: 1.000000, loss: 22.327377, mean edit distance: 1.000000
I  - src: "mmm"
I  - res: ""
I --------------------------------------------------------------------------------
I WER: 1.000000, loss: 23.341921, mean edit distance: 1.000000
I  - src: "aaah"
I  - res: ""
I --------------------------------------------------------------------------------
I WER: 1.000000, loss: 23.498835, mean edit distance: 1.000000
I  - src: "aaah"
I  - res: ""
I --------------------------------------------------------------------------------
I WER: 1.000000, loss: 24.080647, mean edit distance: 1.000000
I  - src: "mmm"
I  - res: ""
I --------------------------------------------------------------------------------
I WER: 1.000000, loss: 24.106306, mean edit distance: 1.000000
I  - src: "aaah"
I  - res: ""
I --------------------------------------------------------------------------------
I WER: 1.000000, loss: 24.110025, mean edit distance: 1.000000
I  - src: "mmm"
I  - res: ""
I --------------------------------------------------------------------------------
I WER: 1.000000, loss: 24.185291, mean edit distance: 1.000000
I  - src: "mmm"
I  - res: ""
I --------------------------------------------------------------------------------
D Epochs - running: 1, done: 0
D Closing queues...
D Session closed.

Note that : Data set size is 90KB

Command i am using : python -u DeepSpeech.py --train_files /home/english/files/english-test.csv --dev_files /home/english/files/english-test.csv --test_files /home/english/files/english-test.csv --train_batch_size 1 --dev_batch_size 1 --n_hidden 494 --test_batch_size 1 --log_level 0 --fulltrace True --epoch 1 --checkpoint_dir /root/.local/share/deepspeech/english2344

harrypotter90 avatar May 26 '17 10:05 harrypotter90

I am sure, Experts here will be interested in Hardware configuration - 6 cores CPU ; 128GB ram ; 8 GPUS (2cards) NVidia M40

And 4GB ram on each GPU

Dataset size is roughly only 90Kb and i am wondering why i am getting memory issue

Is there a minimum hardware requirement for it to run?

harrypotter90 avatar May 26 '17 10:05 harrypotter90

You have to find a batch size that works for your hardware through, say, binary search.

For example, you know 100 doesn't work. Try 50. If that doesn't work, try 25. If that doesn't work, try 12. If that does work, try 18.... until you find that maximum value that does work.

kdavis-mozilla avatar May 26 '17 11:05 kdavis-mozilla

Sure, Thanks @kdavis-mozilla

harrypotter90 avatar May 26 '17 11:05 harrypotter90

When I set the train_batch_size to 12 and the n_hidden to 512, the GPU utilization is very low. Does someone have the problem with me?

helloWaterM avatar Dec 28 '17 07:12 helloWaterM

Try to use a highter value in batch size (highter value = better gpu usage) Tested myself and confirmed ! If you can't, due to OOM errors, you don't have enough gpu ram ?! (2×4go)

elpimous avatar Dec 28 '17 07:12 elpimous

But I when I try to use a higher value in batch size, the utilization of gpu become lowr. I set "--n_hidden 512, train_bathc_size 50", and in the training process, the gpu utilization will be 0% for a long time and then be 100% for a short time circularly. And It doesn't show any message about OOM errors.

helloWaterM avatar Dec 28 '17 11:12 helloWaterM

This is my input command: ./DeepSpeech.py --train_files ./data/CV/cv-valid-train.csv --dev_files ./data/CV/cv-valid-dev.csv --test_files ./data/CV/cv-valid-test.csv --export_dir ./export_model/ --validation_step 1 --display_step 1 --checkpoint_dir /disk2/hx-dir/IDE/deepspeech-venv/checkPoint512-50 --n_hidden 512 --trian_batch_size 50

helloWaterM avatar Dec 28 '17 11:12 helloWaterM

Remove display step Same issue for me

elpimous avatar Dec 28 '17 11:12 elpimous

Thank you! It really works!

helloWaterM avatar Dec 28 '17 12:12 helloWaterM

Happy for U.

elpimous avatar Dec 28 '17 12:12 elpimous

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Jan 03 '19 06:01 lock[bot]