GithubHelp home page GithubHelp logo

Comments (8)

tjruwase avatar tjruwase commented on July 19, 2024 1

This is correct, it is the responsibility of the custom loader to load the appropriate dataset portion based on local rank (or whatever else the client finds appropriate) into GPU memory. DeepSpeed does not impose any restrictions on the custom dataloader, and does not perform any sanity checks.

Hope that clears things up.

from deepspeed.

tjruwase avatar tjruwase commented on July 19, 2024
  1. Passing training_data to deepspeed.initialize is optional, and not required. Some models can benefit from deepspeed's i/o optimizations. However, using torch trainloader is fine.

  2. In our experience, deepspeed works well with custom trainloaders and datasets. So I suspect the answer to that is yes, but please share any issues you run into.

  3. The train_batch_size in json file is used to perform gradient accumulation and compute progress statistics, so a mismatch could result in incorrect training and confusing statistics.

  4. Yes, this is supported.

from deepspeed.

msdejong avatar msdejong commented on July 19, 2024

@tjruwase could you clarify - how does the parallelization work with a custom dataloader? Do you need to make sure the dataloader uses the local rank as input to load a separate portion of the dataset manually?

from deepspeed.

agemagician avatar agemagician commented on July 19, 2024

@tjruwase Thanks for the clarification.
Just one more question.

Assuming I have a custom data generator like that:

for batch_idx, batch in enumerate(DatasetGenerator):
            data, target,src_padding = batch['input'].to(model_engine.local_rank), batch['target'].to(model_engine.local_rank), batch['padding_mask'].to(model_engine.local_rank)

Does this mean:

  1. The batch size should be equal to train_micro_batch_size_per_gpu ?
  2. It should provide different/random batch for each gpu/node ?

from deepspeed.

tjruwase avatar tjruwase commented on July 19, 2024
  1. Yes, batch_size should be equal to train_micro_batch_size_per_gpu, which is batch size for a single step on one gpu.

  2. Assuming DatasetGenerator is returning the correct batch for each gpu, then this would be correct since the .to() is simply moving the data bits into gpu memory.

from deepspeed.

agemagician avatar agemagician commented on July 19, 2024

@tjruwase Thanks a lot that answers all my questions for now :)

from deepspeed.

tnq177 avatar tnq177 commented on July 19, 2024

@tjruwase assuming I'm using some customer data loader as @agemagician above but in a multi-node, multi-gpu settings, how would I go about and send tensors to the right GPU? Do I still do tensor.to(engine.local_rank) or global_rank please? Thanks.

from deepspeed.

tjruwase avatar tjruwase commented on July 19, 2024

@tnq177, I believe you want local_rank as crossing node boundaries requires communication collectives, like broadcast.

from deepspeed.

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.