# Get all the sweep parameters and the corresponding results

**URL:** <https://community.wandb.ai/t/get-all-the-sweep-parameters-and-the-corresponding-results/8656>\
**Category:** W&B Help\
**Tags:** sweeps\
**Created:** [December 25, 2024, 5:33pm UTC](https://community.wandb.ai/t/get-all-the-sweep-parameters-and-the-corresponding-results/8656 "2024-12-25T17:33:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![qxcs](https://avatars.discourse-cdn.com/v4/letter/q/e9c0ed/32.png) [@qxcs](https://community.wandb.ai/u/qxcs)\
**Post date:** [December 25, 2024, 5:33pm UTC](https://community.wandb.ai/t/get-all-the-sweep-parameters-and-the-corresponding-results/8656/1 "2024-12-25T17:33:20Z")

</div>

Hi everyone,

I’m trying to use wand.sweep for hyperparameter tuning.  
I’m wondering if I can get all the hyperparameters and the corresponding results in my code.

The purpose is that I already saved the best model for each run automatically in my train() function.  
After the sweep finished, I’d like to validate the top 3 models on my isolated test dataset.  
So, I want to get the top 3 parameter groups so that I can get those models from my folder.

Here’s my code:

```auto
if __name__ == ' __main__':
    parser = get_parser()
    args = parser.parse_args()
    myConfig = MyConfig(**vars(args))
    print(myConfig.print_attr())

   
    """
    wandb configuration
    """
    sweep_config['parameters'] = {
        'LDs': {
            'distribution': 'uniform',
            'min': 0.6,
            'max': 1
        },
        'LRs': {
            'distribution': 'uniform',
            'min': 1e-6,
            'max': 1e-3
        },
        'WDs': {
            'distribution': 'uniform',
            'min': 1e-5,
            'max': 1e-1
        },
        'Bs': {
            'values': [32, 64, 128] # Explore other batch sizes
        },
    }

    sweep_id = wandb.sweep(sweep_config, project=myConfig.wandb_name)
    wandb.agent(sweep_id, train_each_hyperparameter, count=myConfig.num_samples)

    # todo
    run_params_results=getAllRuns() ?
    run_params_results.sort( run_params_results['results'] ) ?
    run_index=0
    for params, results in run_params_results.items():
        cur_model=getModelByParams(params) # don't worry about this. It should be my own function.
        run_index+=1
        if run_index>3:
              break
       

```

Basically, my main question would be this line:

```auto
 run_params_results=getAllRuns() ?

```

1. Will wandb.agent(sweep\_id, train\_func) block until the sweep is finished?
2. How can I get all runs to use like the getAllRuns() above?

Thanks for your time.
