Giter VIP home page Giter VIP logo

Comments (6)

exalate-issue-sync avatar exalate-issue-sync commented on July 18, 2024

Jason Davenport commented:
Hello! To make sure I can best assist you, may I please ask for more information? A copy of the code in question would be the best place to start, along with a detailed rundown of what environment you are running in.

Let me know! Thanks 🙂

from wandb.

LTayfaker avatar LTayfaker commented on July 18, 2024

Jason Davenport commented: Hello! To make sure I can best assist you, may I please ask for more information? A copy of the code in question would be the best place to start, along with a detailed rundown of what environment you are running in.

Let me know! Thanks 🙂
Hi, I've updated my question, can you look at it for me or is there any more information I need to provide?

from wandb.

exalate-issue-sync avatar exalate-issue-sync commented on July 18, 2024

Jason Davenport commented:
It sounds like you're encountering issues with multiple sweep IDs being created when using wandb.sweep in a multi-GPU setup with PyTorch's Distributed Data Parallel (DDP). This typically happens due to the way the wandb.sweep and wandb.agent functions are initialized within the distributed environment, causing each process to start its own sweep. Here's how you can address this:

  1. Centralize Sweep Initialization: To ensure that only one sweep ID is generated and used across all GPUs, initialize the wandb.sweep outside the distributed code execution. You can control this by checking if the process is the master process and then initializing the sweep. Here's a code snippet to illustrate this:

    import osimport wandbimport torch.distributed as distdef is_master():return dist.get_rank() == 0if name == "main":sweep_config = get_wandb_config()if is_master():sweep_id = wandb.sweep(sweep_config, project=sweep_config['project_name'])dist.barrier() # Make sure the master process has created the sweep before continuingwandb.agent(sweep_id, function=run, count=3)

In the above code:

  • is_master() checks if the current process is the master process.
  • dist.barrier() is used to synchronize all processes, ensuring the sweep is created before any agent starts.
  1. Configuration and Initialization within run(): Ensure that wandb.init() is called in a way that all processes can correctly log their outputs to the same project and sweep without creating new sweeps. This can be done by correctly passing the sweep_id and making sure wandb.init() uses parameters that do not vary by process unless intended:

    def run():if is_master():wandb.init(project=sweep_config['project_name'], config=sweep_config, group="DDP")else:wandb.init(project=sweep_config['project_name'], config=sweep_config, group="DDP", reinit=True)

In the code snippet above:

  • reinit=True is used for non-master processes to ensure that wandb.init() can be called multiple times across different processes.

3. **Correct Sweep Config Violations**: The warnings about malformed sweep config suggest that there are properties in your `sweep_config` that are not expected. Make sure that the configuration only contains fields that are recognized by the wandb.sweep API. Commonly recognized fields are things like `method`, `parameters`, etc. Avoid custom fields like `metrics` or `project_name` unless they are nested under a recognized category. Here's an example of a corrected config:
sweep_config = { 'method': 'bayes', # Example method 'metric': { 'name': 'loss', 'goal': 'minimize' }, 'parameters': { 'learning_rate': { 'min': 0.001, 'max': 0.1 }, 'optimizer': { 'values': ['adam', 'sgd'] } }}

By organizing your code to ensure the sweep is created and handled correctly across all GPU processes, you should be able to use Weights & Biases sweeps effectively in your multi-GPU training setup. This approach will minimize redundancy in sweep ID creation and make your hyperparameter tuning more efficient and easier to manage.

Hopefully, this helps! Let me know if there is anything else I can assist you with 🙂

from wandb.

exalate-issue-sync avatar exalate-issue-sync commented on July 18, 2024

Jason Davenport commented:
Hi Internal,

We wanted to follow up with you regarding your support request as we have not heard back from you. Please let us know if we can be of further assistance or if your issue has been resolved.

Best,
Weights & Biases

from wandb.

exalate-issue-sync avatar exalate-issue-sync commented on July 18, 2024

Jason Davenport commented:
Hi Internal, since we have not heard back from you we are going to close this request. If you would like to re-open the conversation, please let us know!

from wandb.

LTayfaker avatar LTayfaker commented on July 18, 2024

Jason Davenport commented: Hi Internal,

We wanted to follow up with you regarding your support request as we have not heard back from you. Please let us know if we can be of further assistance or if your issue has been resolved.

Best, Weights & Biases

Sorry about that, I'm busy with other things these days, I'll be the first to try out what you've suggested when it's done, and I'll be the first to let you know of any other problems or successful runs, thank you very much for your help!

from wandb.

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.