Git Product home page Git Product logo

Comments (7)

raulpuric avatar raulpuric commented on August 30, 2024

So my guess as to why this is happening is that the last dataloader batch is not being properly dropped or padded.
Some of the training workers get fed a batch while others do not get a batch. Because of this the ones that got fed a batch, wait to do an allreduce indefinitely.

Do you have your full command so I can reproduce?

from sentiment-discovery.

deepbrain avatar deepbrain commented on August 30, 2024

The issue happens regularly, almost every time, on a system with 3 1080Ti GPUs. On another system with 2 1080Tis and everything the same, the issue happens only in 10-20% of the time I use it with different size datasets. It happens at the end of the 1st epoch.

I would agree that it seems to be data size dependent and could be related to the size of the last batch.
Googling it reveals very similar issues in totally different settings, so it could be related to issues with DistributedDataParallel and pytorch. The batch size of 128 does not fit into 1080Ti memory, so I used a batch of 64 instead.

I am using the latest pre-built pytorch for conda:

Python 3.6.5 |Anaconda, Inc.| (default, Apr 29 2018, 16:14:56)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

import torch
torch.version
'0.4.1'

Here is the full command line I use:

python3 -m multiproc main.py --load imdb_clf.pt --batch_size 64 --epochs 20 --lr 2e-4 --data ./data/twits/train_json.json &> twitlog.txt

I have cuda 9.2 and cudnn7

from sentiment-discovery.

deepbrain avatar deepbrain commented on August 30, 2024

I changed the batch size from 64 to 100 and the issue disappeared on the 3 GPU system, so you are correct - it is definitely related to the size of the last batch. You can reproduce it with any small size dataset by varying the batch size.

from sentiment-discovery.

raulpuric avatar raulpuric commented on August 30, 2024

I wasn't able to reproduce this on our smallest datasets. Could you print out the number of entries in your dataset for me, so I can try and create some synthetic data of the same length?

Adding print(len(train_data.dataset), len(val_data.dataset), len(test_data.dataset)) to main.py should suffice.

from sentiment-discovery.

deepbrain avatar deepbrain commented on August 30, 2024

I changed my dataset size a bit and now I can't reproduce it too. Hopefully I will be able to get it to reproduce again if my data changes.

from sentiment-discovery.

deepbrain avatar deepbrain commented on August 30, 2024

I got it to reproduce on a 2 GPU system with data sizes:

DATASET length: 42243230 422951 422408

full command line:

python3 -u -m multiproc main.py --load lang_model.pt --batch_size 110 --epochs 2 --lr 6e-4 --data ./data/twitter/train_json.json &> med_log.txt

Please let me know if you need the data file, I can upload it somewhere.

On another note, the train_json.json that I use is 14.4 Gigabytes in size, yet the program requires 64GB of RAM + another 64 GB of swap space to run. Is there a way to improve its memory footprint to run it with larger data sets?

from sentiment-discovery.

raulpuric avatar raulpuric commented on August 30, 2024

Try the --lazy option. It will pull from disk and is meant to be used with large data files (such as the amazon reviews dataset).

If you could upload the file somewhere that would be very helpful. Even if you just replace the entries in the data file all with garbage text.

from sentiment-discovery.

Related Issues (20)

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.