# Access sweep\_id and run\_id within train() function for local weight storage

**URL:** <https://community.wandb.ai/t/access-sweep-id-and-run-id-within-train-function-for-local-weight-storage/2948>\
**Category:** W&B Help\
**Tags:** sweeps, wandb\
**Created:** [August 17, 2022, 7:01am UTC](https://community.wandb.ai/t/access-sweep-id-and-run-id-within-train-function-for-local-weight-storage/2948 "2022-08-17T07:01:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![markuskarner](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/markuskarner/32/862_2.png) [@markuskarner](https://community.wandb.ai/u/markuskarner)\
**Post date:** [August 17, 2022, 7:01am UTC](https://community.wandb.ai/t/access-sweep-id-and-run-id-within-train-function-for-local-weight-storage/2948/1 "2022-08-17T07:01:45Z")

</div>

Hello,

As I cannot simply upload infinitely many weights using artifacts, I also want to store some locally.  
For naming, I would like to use the sweep id and/or the run id.

Can I access that somehow in the train function I hand over to the agent?

Thanks

Markus

---

<div class="post-metadata">

**Author:** ![ramit\_goolry](https://avatars.discourse-cdn.com/v4/letter/r/85e7bf/32.png) [@ramit\_goolry](https://community.wandb.ai/u/ramit_goolry)\
**Post date:** [August 18, 2022, 10:04pm UTC](https://community.wandb.ai/t/access-sweep-id-and-run-id-within-train-function-for-local-weight-storage/2948/2 "2022-08-18T22:04:29Z")

</div>

Hey @markuskarner!

The `wandb.Run` object that is returned from `wandb.init` contains this information as properties. You should be able to access `run.id` and `run.sweep_id` in the train function after calling `run = wandb.init(...)`.

Thanks,  
Ramit

---

<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:** [October 17, 2022, 10:05pm UTC](https://community.wandb.ai/t/access-sweep-id-and-run-id-within-train-function-for-local-weight-storage/2948/3 "2022-10-17T22:05:26Z")

</div>

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