# How to get the sequential id for the experiment

**URL:** <https://community.wandb.ai/t/how-to-get-the-sequential-id-for-the-experiment/3619>\
**Category:** W&B Help\
**Tags:** projects, wandb\
**Created:** [December 29, 2022, 8:08pm UTC](https://community.wandb.ai/t/how-to-get-the-sequential-id-for-the-experiment/3619 "2022-12-29T20:08:11Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![hafizprecisionai](https://avatars.discourse-cdn.com/v4/letter/h/c77e96/32.png) [@hafizprecisionai](https://community.wandb.ai/u/hafizprecisionai)\
**Post date:** [December 29, 2022, 8:08pm UTC](https://community.wandb.ai/t/how-to-get-the-sequential-id-for-the-experiment/3619/1 "2022-12-29T20:08:12Z")

</div>

Hi I am trying to name the experiment as per my project as well as a sequential id, for example my Project name is Semantic Segmentation and I have 3 runs, I want to name them something like SEM-1,SEM-2 and so on,  
Essentially I need to log the new experiment by getting the previous experiment id and incrementing it by 1, if it is the first experiment then just start by first three letters of project and then append 1 and so on

---

<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:** [December 29, 2022, 8:48pm UTC](https://community.wandb.ai/t/how-to-get-the-sequential-id-for-the-experiment/3619/2 "2022-12-29T20:48:38Z")

</div>

Hi @hafizprecisionai , thank you for writing in. `wandb.init()` allows you to assign unique names to your experiments via the `name` [argument](https://docs.wandb.ai/ref/python/init). You can additionally assign unique run ids to an experiment run using the `id` argument. Hope this helps and please let me know if you have any questions.

---

<div class="post-metadata">

**Author:** ![sydholl](https://avatars.discourse-cdn.com/v4/letter/s/eb8c5e/32.png) [@sydholl](https://community.wandb.ai/u/sydholl)\
**Post date:** [December 29, 2022, 8:48pm UTC](https://community.wandb.ai/t/how-to-get-the-sequential-id-for-the-experiment/3619/3 "2022-12-29T20:48:50Z")

</div>

Hi @hafizprecisionai , thank you for writing in. `wandb.init()` allows you to assign unique names to your experiments via the `name` argument. You can additionally assign unique run ids to an experiment run using the `id` argument. Hope this helps and please let me know if you have any questions.

[Discourse post]

---

<div class="post-metadata">

**Author:** ![hafizprecisionai](https://avatars.discourse-cdn.com/v4/letter/h/c77e96/32.png) [@hafizprecisionai](https://community.wandb.ai/u/hafizprecisionai)\
**Post date:** [December 29, 2022, 9:24pm UTC](https://community.wandb.ai/t/how-to-get-the-sequential-id-for-the-experiment/3619/4 "2022-12-29T21:24:26Z")

</div>

Hi @mohammadbakir , Yes I know that, but what I want is to increment the ids based on what is already logged in wandb

---

<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:** [December 30, 2022, 12:16am UTC](https://community.wandb.ai/t/how-to-get-the-sequential-id-for-the-experiment/3619/5 "2022-12-30T00:16:43Z")

</div>

Hi @hafizprecisionai , thanks for clarifying. One way to accomplish this is to use our[api](https://docs.wandb.ai/guides/track/public-api-guide#querying-multiple-runs). You could for example verify the current run ids / names of runs to a project and implement your own logic from there for incrementing.

```auto
api = wandb.Api()
entity, project = "<entity>", "<project>" # set to your entity and project 
runs = api.runs(entity + "/" + project)
.....
#Check Run Ids/names `(run.id/run.name)` of fetched runs and increment accordingly

```

---

<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:** [January 4, 2023, 6:26am UTC](https://community.wandb.ai/t/how-to-get-the-sequential-id-for-the-experiment/3619/6 "2023-01-04T06:26:11Z")

</div>

Hi @hafizprecisionai , 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!

---

<div class="post-metadata">

**Author:** ![hafizprecisionai](https://avatars.discourse-cdn.com/v4/letter/h/c77e96/32.png) [@hafizprecisionai](https://community.wandb.ai/u/hafizprecisionai)\
**Post date:** [January 6, 2023, 5:33pm UTC](https://community.wandb.ai/t/how-to-get-the-sequential-id-for-the-experiment/3619/7 "2023-01-06T17:33:06Z")

</div>

@mohammadbakir Thank you Mohammad Bakir, I was able to solve with the given instruction. Really appreciate your help in this regard

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/wandb/original/1X/366b649231631dbab896843020da0056074ac79d.png) [@system](https://community.wandb.ai/u/system)\
**Post date:** [March 7, 2023, 5:34pm UTC](https://community.wandb.ai/t/how-to-get-the-sequential-id-for-the-experiment/3619/8 "2023-03-07T17:34:02Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
