# Wandb sweep not working

**URL:** <https://community.wandb.ai/t/wandb-sweep-not-working/6121>\
**Category:** W&B Help\
**Created:** [March 17, 2024, 2:18pm UTC](https://community.wandb.ai/t/wandb-sweep-not-working/6121 "2024-03-17T14:18:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jkooi23](https://avatars.discourse-cdn.com/v4/letter/j/59ef9b/32.png) [@jkooi23](https://community.wandb.ai/u/jkooi23)\
**Post date:** [March 17, 2024, 2:18pm UTC](https://community.wandb.ai/t/wandb-sweep-not-working/6121/1 "2024-03-17T14:18:11Z")

</div>

I have been using wandb sweeps for a long time, but I am getting a sweep bug now that I have not seen before.  
This is my yaml file:

> # Program to run
> 
> program: main\_minatar.py
> 
> # project name
> 
> project: jax\_meta
> 
> # Method
> 
> method: grid
> 
> # metric to optimize
> 
> metric:  
> name: average\_reward  
> goal: maximize
> 
> # Hyperparameters
> 
> parameters:  
> ENV\_NAME:  
> values: [“Breakout-MinAtar”, “SpaceInvaders-MinAtar”, “Freeway-MinAtar”, “Asterix-MinAtar”]  
> ACTIVATIONS:  
> values: [“11111111\_+00”, “01010101\_+00”, “02020202\_+00”, “03030303\_+00”, “04040404\_+00”,  
> “14141414\_+00”, “04040404\_+02”, “14141414\_+02”, “04040404\_+05”, “14141414\_+05”,  
> “04040404\_+10”, “14141414\_+10”, “04040404\_-02”, “14141414\_-02”, “01040104\_+05”,  
> “01140114\_+05”, “01040101\_+05”, “01010104\_+05”, “01040104\_+02”, “01140114\_+02”,  
> “01040101\_+02”, “01010104\_+02”, “14141414\_+15”, “14141414\_-10”, “01010404\_+05”,  
> “04010401\_+05”, “01010404\_+02”, “04010401\_+02”]  
> TOTAL\_TIMESTEPS:  
> values: [1e7, 2e7]

For some reason, it keeps sweeping the first 2 activation values: “11111111\_+00”, “01010101\_+00”, all the time.  
For example, it is now running TOTAL\_TIMESTEPS: 1e7, Freeway-MinAtar, “11111111\_+00” for the 4th time already.

The logging is done here after training a RL agent:

> data = outs[“metrics”][“returned\_episode\_returns”][0].mean(0).mean(-1).reshape(-1)  
> chunk\_size = 500 # Or 1000, depending on your preference
> 
> # Calculate number of chunks
> 
> num\_chunks = len(data) // chunk\_size  
> time\_per\_chunk = args.TOTAL\_TIMESTEPS / num\_chunks
> 
> # Logging
> 
> for i in range(num\_chunks + 1):  
> start\_idx = i \* chunk\_size  
> end\_idx = start\_idx + chunk\_size  
> chunk = data[start\_idx:end\_idx]
> 
> ```
> # Compute summary statistics for the chunk
> mean = np.mean(chunk)
> std = np.std(chunk)
> min_val = np.min(chunk)
> max_val = np.max(chunk)
> 
> # Log summary statistics to wandb
> wandb.log({
> "returns_mean": mean,
> "returns_std" : std,
> "global_step": i*time_per_chunk
> })
> 
> ```

Does anyone know what could be the problem? (Ubuntu 22.04, Wandb 0.16.4)

-Update: It is still running, only sweeping the first two entries of ACTIVATIONS for an infinite amount of times.

---

<div class="post-metadata">

**Author:** ![nathank](https://avatars.discourse-cdn.com/v4/letter/n/7ea924/32.png) [@nathank](https://community.wandb.ai/u/nathank)\
**Post date:** [March 19, 2024, 9:43pm UTC](https://community.wandb.ai/t/wandb-sweep-not-working/6121/2 "2024-03-19T21:43:08Z")

</div>

Hi @jkooi23, could you possibly send me a link to the sweep and I’ll take a look?

That certainly looks like unexpected behavior since you are using a grid search.

Thank you,  
Nate

---

<div class="post-metadata">

**Author:** ![jkooi23](https://avatars.discourse-cdn.com/v4/letter/j/59ef9b/32.png) [@jkooi23](https://community.wandb.ai/u/jkooi23)\
**Post date:** [March 20, 2024, 7:54am UTC](https://community.wandb.ai/t/wandb-sweep-not-working/6121/3 "2024-03-20T07:54:42Z")

</div>

Hi @nathank,

Thanks for taking the time. I deleted that old sweep but just created a new one to recreate the problems: It is still running certain activations over and over.

> **[Untitled Report](https://links-cdn.wandb.ai/wandb-public-images/links/jkooi23/pyg76ypa.html)**

Please let me know if you need more information.

---

<div class="post-metadata">

**Author:** ![nathank](https://avatars.discourse-cdn.com/v4/letter/n/7ea924/32.png) [@nathank](https://community.wandb.ai/u/nathank)\
**Post date:** [March 28, 2024, 6:15pm UTC](https://community.wandb.ai/t/wandb-sweep-not-working/6121/4 "2024-03-28T18:15:33Z")

</div>

Hi @jkooi23, sorry for the delay on this. I’ve gone ahead and reported this to the engineering team since your sweep config looks correct and shouldn’t be just sweeping over those first 3 activation values. I’ll be able to follow up once I have an update from the team

---

<div class="post-metadata">

**Author:** ![claushofmann](https://avatars.discourse-cdn.com/v4/letter/c/a88e57/32.png) [@claushofmann](https://community.wandb.ai/u/claushofmann)\
**Post date:** [April 18, 2024, 7:54am UTC](https://community.wandb.ai/t/wandb-sweep-not-working/6121/5 "2024-04-18T07:54:12Z")

</div>

I think I’m having the same issue when running a sweep via W&B. For me, W&B starts the same run multiple times. They are then also logged to the same run on W&B, causing that the logs are a mix of the last and the current run. See this screenshot, where the relative Wall time is suddenly negative?  
 ![Screenshot from 2024-04-18 09-47-54](https://us1.discourse-cdn.com/flex020/uploads/wandb/original/2X/7/7e1fa22b83caac0ab1794a0c9b2bd5f8fdf1663d.png)  
I used W&B 0.16.3

---

<div class="post-metadata">

**Author:** ![mohammadbakir](https://avatars.discourse-cdn.com/v4/letter/m/a9a28c/32.png) [@mohammadbakir](https://community.wandb.ai/u/mohammadbakir)\
**Post date:** [June 5, 2024, 9:04pm UTC](https://community.wandb.ai/t/wandb-sweep-not-working/6121/6 "2024-06-05T21:04:32Z")

</div>

Hi @claushofmann , I wanted to inform you this is now fixed and will be released with the next version of our sdk. In the event you still encounter and issues, please let us know.
