Giter Site home page Giter Site logo

Comments (8)

black0017 avatar black0017 commented on June 2, 2024 17

Here is an example, in case you were looking for that sort of thing (2 gpus used here):

python -m torch.distributed.launch --nproc_per_node=2 main_pretrain.py  --batch_size 16 \
    --world_size 2 \
    --accum_iter 4
    --model mae_vit_base_patch16 \
    --norm_pix_loss \
    --mask_ratio 0.75 \
    --epochs 800 \
    --warmup_epochs 40 \
    --blr 1.5e-4 --weight_decay 0.05 

PS: works with pytorch 1.8.X

from mae.

black0017 avatar black0017 commented on June 2, 2024 4

@kalyani7195

Node 1:

python -m torch.distributed.launch --nproc_per_node=8 --nnodes=2 --node_rank=0 main_pretrain.py  --batch_size 16 \
    --world_size 2 \
    --accum_iter 4
    --model mae_vit_base_patch16 \
    --norm_pix_loss \
    --mask_ratio 0.75 \
    --epochs 800 \
    --warmup_epochs 40 \
    --blr 1.5e-4 --weight_decay 0.05 

Node 2:

python -m torch.distributed.launch --nproc_per_node=8 --nnodes=2 --node_rank=1  main_pretrain.py  --batch_size 16 \
    --world_size 2 \
    --accum_iter 4
    --model mae_vit_base_patch16 \
    --norm_pix_loss \
    --mask_ratio 0.75 \
    --epochs 800 \
    --warmup_epochs 40 \
    --blr 1.5e-4 --weight_decay 0.05 

Modify batch size according to your hardware.

PS: For pytorch >= 1.9 : replace python -m torch.distributed.launch with torchrun
PS2: I haven't tried multi-node multi GPU training myself.

from mae.

BIGBALLON avatar BIGBALLON commented on June 2, 2024

submitit is used for "Multi-node Multi-gpu distributed training"

from mae.

JIAOJIAYUASD avatar JIAOJIAYUASD commented on June 2, 2024

Allright, maybe the submitit script is for some Server cluster different from I am used,I am solve the problem use the main_pretrain.py script with the torch.distributed.launch. And thanks for answer my question.

from mae.

BIGBALLON avatar BIGBALLON commented on June 2, 2024

Allright, maybe the submitit script is for some Server cluster different from I am used,I am solve the problem use the main_pretrain.py script with the torch.distributed.launch. And thanks for answer my question.

sure,submitit is used for Slurm cluster. and torch.distributed.launch is another common way.

from mae.

kalyani7195 avatar kalyani7195 commented on June 2, 2024

What changes should I make to the command above if I have two nodes with 8 gpus each and I also want to keep the batch size the same?

from mae.

Walnutes avatar Walnutes commented on June 2, 2024

Here is an example, in case you were looking for that sort of thing (2 gpus used here):

python -m torch.distributed.launch --nproc_per_node=2 main_pretrain.py  --batch_size 16 \
    --world_size 2 \
    --accum_iter 4
    --model mae_vit_base_patch16 \
    --norm_pix_loss \
    --mask_ratio 0.75 \
    --epochs 800 \
    --warmup_epochs 40 \
    --blr 1.5e-4 --weight_decay 0.05 

PS: works with pytorch 1.8.X

Thanks for your sharing!
I want to raise another question about the different performance (the speed of loss decreasing) between this two different implementation.
As what I have tested on the completely same model, original implementation (based on submitit )performs much better than another implementation w.r.t the speed of loss decreasing in the case of Single V100 and Single node.
Maybe you can also test this interesting thing. Thanks a lot.

from mae.

JiaxuanFelixLiUNNC avatar JiaxuanFelixLiUNNC commented on June 2, 2024

Hi, May I ask how to do the pre-training on single GPU?

from mae.

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.