# Upload model weights to the Artifacts of a finished run

**URL:** <https://community.wandb.ai/t/upload-model-weights-to-the-artifacts-of-a-finished-run/2540>\
**Category:** W&B Help\
**Tags:** artifacts\
**Created:** [June 3, 2022, 12:26am UTC](https://community.wandb.ai/t/upload-model-weights-to-the-artifacts-of-a-finished-run/2540 "2022-06-03T00:26:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![alyetama](https://avatars.discourse-cdn.com/v4/letter/a/c6cbf5/32.png) [@alyetama](https://community.wandb.ai/u/alyetama)\
**Post date:** [June 3, 2022, 12:26am UTC](https://community.wandb.ai/t/upload-model-weights-to-the-artifacts-of-a-finished-run/2540/1 "2022-06-03T00:26:07Z")

</div>

I was training a yolov5 model, using the pre-configured wandb settings. But the weights weren’t uploaded because the session was killed. I tried `wandb sync path/to/run` but the model file didn’t get synced.

I want to upload the resulting `best.pt` file to the artifacts regardless without messing up with the current summary and results of the finished run. I looked up in the documentation and tried multiple guides but couldn’t manage to do that.

TL;DR: I have a finished run and a weights file. I need to upload the weights file as a model artifact to that finished run using the run path.

---

<div class="post-metadata">

**Author:** ![morgan](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/morgan/32/74_2.png) [@morgan](https://community.wandb.ai/u/morgan)\
**Post date:** [June 3, 2022, 8:42am UTC](https://community.wandb.ai/t/upload-model-weights-to-the-artifacts-of-a-finished-run/2540/2 "2022-06-03T08:42:43Z")

</div>

hey @alyetama , I think you can 1) resume the run 2) upload the model weights to that run

1. Resume a run

Pass your run\_id to wandb.init to resume the run. You can get the id from the url of the run page or from the “info” section (click the (i) button in the top left corner of the run page.

```auto
wandb.init(id=run_id, resume="must")

```

1. Upload an artifact to that run

```auto
wandb.log_artifact(file_path, name='new_artifact', type='model') 

wandb.finish()

```

---

<div class="post-metadata">

**Author:** ![armanharutyunyan](https://avatars.discourse-cdn.com/v4/letter/a/a6a055/32.png) [@armanharutyunyan](https://community.wandb.ai/u/armanharutyunyan)\
**Post date:** [June 7, 2022, 7:41am UTC](https://community.wandb.ai/t/upload-model-weights-to-the-artifacts-of-a-finished-run/2540/3 "2022-06-07T07:41:19Z")

</div>

Hey @alyetama, here is a code snippet you can use: [https://docs.wandb.ai/guides/artifacts/artifacts-faqs#how-do-i-log-an-artifact-to-an-existing-run](https://docs.wandb.ai/guides/artifacts/artifacts-faqs#how-do-i-log-an-artifact-to-an-existing-run)

---

<div class="post-metadata">

**Author:** ![alyetama](https://avatars.discourse-cdn.com/v4/letter/a/c6cbf5/32.png) [@alyetama](https://community.wandb.ai/u/alyetama)\
**Post date:** [June 14, 2022, 12:31pm UTC](https://community.wandb.ai/t/upload-model-weights-to-the-artifacts-of-a-finished-run/2540/5 "2022-06-14T12:31:09Z")

</div>

> [@alyetama](#):
>
> This initially uploaded my artifact to a different project. But it worked after I specified the project name in `wandb.init`.  
> Thanks!

This initially uploaded my artifact to a different project. But it worked after I specified the project name in wandb.init.  
Thanks!

---

<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:** [August 13, 2022, 12:32pm UTC](https://community.wandb.ai/t/upload-model-weights-to-the-artifacts-of-a-finished-run/2540/6 "2022-08-13T12:32:10Z")

</div>

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