# Artifacts logged with run\_id

**URL:** <https://community.wandb.ai/t/artifacts-logged-with-run-id/2759>\
**Category:** W&B Help\
**Tags:** artifacts\
**Created:** [July 16, 2022, 3:11pm UTC](https://community.wandb.ai/t/artifacts-logged-with-run-id/2759 "2022-07-16T15:11:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![guen](https://avatars.discourse-cdn.com/v4/letter/g/c37758/32.png) [@guen](https://community.wandb.ai/u/guen)\
**Post date:** [July 16, 2022, 3:11pm UTC](https://community.wandb.ai/t/artifacts-logged-with-run-id/2759/1 "2022-07-16T15:11:27Z")

</div>

Hello everyone,  
I am new to w&b, so this might be a beginner question, but I was wondering why when I run  
` wandb.log_artifact(file_path, name='dataset', type='dataset')`  
I am able to log artifacts correctly without many issues, whereas if I use the example provided [here](https://colab.research.google.com/github/wandb/examples/blob/master/colabs/wandb-artifacts/Pipeline_Versioning_with_W%26B_Artifacts.ipynb#scrollTo=Mb8GiolzPgUU)

```auto
def load_and_log():

    # 🚀 start a run, with a type to label it and a project it can call home
    with wandb.init(project="artifacts-example", job_type="load-data") as run:
        
        datasets = load() # separate code for loading the datasets
        names = ["training", "validation", "test"]

        # 🏺 create our Artifact
        raw_data = wandb.Artifact(
            "mnist-raw", type="dataset",
            description="Raw MNIST dataset, split into train/val/test",
            metadata={"source": "torchvision.datasets.MNIST",
                      "sizes": [len(dataset) for dataset in datasets]})

        for name, data in zip(names, datasets):
            # 🐣 Store a new file in the artifact, and write something into its contents.
            with raw_data.new_file(name + ".pt", mode="wb") as file:
                x, y = data.tensors
                torch.save((x, y), file)

        # ✍️ Save the artifact to W&B.
        run.log_artifact(raw_data)

load_and_log()

```

I get the artifacts stored in a run\_table, and it makes versioning impossible.  
Am I doing something wrong? Below you can find the same function as I modified it for my project, in case I might have missed something

```auto
from wandb.sdk import wandb_init
def load_and_log():

    # 🚀 start a run, with a type to label it and a project it can call home
    with wandb.init(project="project", job_type="load-data", resume="allow") as run:
        
        dataset = my_function(dir_path + '/datas', MAX_SAMPLES, MAX_LENGTH) #returns a tuple of lists
        datasets = dataset.load() # separate code for loading the datasets
        names = ["questions", "answers"]

        # 🏺 create our Artifact
        raw_data = wandb.Artifact(
            "dataset", type="dataset",
            description="json of the preprocessed dataset - not split",
            metadata={"source": "https://source.php",
                      "sizes": [len(dataset) for dataset in datasets]})

        # transfer lists into table
        table = wandb.Table(columns=[], data=[])
        for name, dataset in zip(names, datasets):
          table.add_column(name=f"{name}", data=dataset)

        # ✍️ Save the artifact to W&B.
        wandb.log({f"dataset_{MAX_SAMPLES}_{MAX_LENGTH}": table})

load_and_log()

```

Thank you in advance if you have an answer!

---

<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:** [July 20, 2022, 5:40pm UTC](https://community.wandb.ai/t/artifacts-logged-with-run-id/2759/2 "2022-07-20T17:40:54Z")

</div>

Hi @guen ,

In our example we are creating an artifact of the `Raw MNIST dataset, split into train/val/test`and logging it using `run.log_artifact(raw_data)`. In your code you are generating a table of your dataset and logging the Table to wandb, `wandb.log({f"dataset_{MAX_SAMPLES}_{MAX_LENGTH}": table})`. Is this your intended approach?

---

<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:** [July 25, 2022, 11:36pm UTC](https://community.wandb.ai/t/artifacts-logged-with-run-id/2759/3 "2022-07-25T23:36:59Z")

</div>

Hi @guen ,

Following up on this request. Please let us know if you have any questions on the above.

---

<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:** [July 29, 2022, 5:58pm UTC](https://community.wandb.ai/t/artifacts-logged-with-run-id/2759/4 "2022-07-29T17:58:15Z")

</div>

Hi @guen , 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:** ![system](https://us1.discourse-cdn.com/flex020/uploads/wandb/original/1X/366b649231631dbab896843020da0056074ac79d.png) [@system](https://community.wandb.ai/u/system)\
**Post date:** [September 27, 2022, 5:58pm UTC](https://community.wandb.ai/t/artifacts-logged-with-run-id/2759/5 "2022-09-27T17:58:24Z")

</div>

Closed on September 27, 2022, 5:58pm UTC

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