> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-weave-otel-prioritization.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# タグを使って run にラベルを付ける

> Python SDK、Public API、または W&B App UI を使用して、W&B run のタグを追加、更新、削除し、整理できます。

ログされたメトリクスや artifact データだけでは分かりにくい特定の特徴を示すために、タグを追加して run にラベルを付けます。

たとえば、run のモデルが `in_production` であること、その run が `preemptible` であること、その run が `baseline` を表していることなどを示すタグを run に追加できます。

<div id="add-tags-to-one-or-more-runs">
  ## Add tags to one or more runs
</div>

Programmatically or interactively add tags to your runs.

Based on your use case, select a tab below that best fits your needs:

<Tabs>
  <Tab title="W&B Python SDK">
    run の初期化時にタグを追加するには、`wandb.init()` を使用します。run にタグを追加するには、`wandb.init()` の `tags` パラメーターに文字列のリストを渡します。例:

    ```python theme={null}
    import wandb

    with wandb.init(
      entity="<entity>",
      project="<project>",
      tags=["<tag1>", "<tag2>"]
    ) as run:
        # ここにトレーニング コードを記述します
    ```

    アクティブな run の実行中に、run オブジェクトの `tags` 属性 (`wandb.Run.tags`) を更新して、既存のタグを追加または更新することもできます。`tags` 属性は文字列のタプルを受け取ります。run の初期化後に新しいタグを追加するには、既存の run のタグ プロパティに 1 つ以上のタグを連結します。

    ```python theme={null}
    import wandb

    with wandb.init(entity="<entity>", project="<project>", tags=["<tag1>"]) as run:
      # ここにトレーニング ループのロジックを記述します

      # run オブジェクトに新しいタグを追加します
      run.tags += ("<new_tag>",)
    ```
  </Tab>

  <Tab title="Public API">
    Use the [W\&B Public API](/ja/models/ref/python/public-api) to add or update tags to a previously saved run.

    To update tags on an existing run, access the `wandb.Run.tags` property. `wandb.Run.tags` property consists of a list of strings. Concatenate the new tag or tags to the existing tags and then call `wandb.Run.update()` to update the run with the new tags. For example:

    ```python theme={null}
    run = wandb.Api().run("{entity}/{project}/{run-id}")
    run.tags.append("tag1")  # ここでは run データに基づいてタグを選択できます
    run.update()
    ```
  </Tab>

  <Tab title="プロジェクトページ">
    This method is best suited to tagging large numbers of runs with the same tag or tags.

    1. Navigate to your ワークスペース.
    2. Select **Runs** from the project sidebar.
    3. Select one or more runs from the table.
    4. Once you select one or more runs, select the **Tag** button above the table.
    5. Type the tag you want to add and select the **Create new tag** checkbox to add the tag.
  </Tab>

  <Tab title="Run page">
    This method is best suited to applying a tag or tags to a single run manually.

    6. ワークスペースにアクセスします。
    7. run をクリックして開きます。run ページが開き、デフォルトで **Overview** タブが表示されます。
    8. **Tags** の横にある灰色のプラス アイコン (**+**) ボタンを選択します。
    9. 追加するタグを入力し、テキストボックスの下にある **Add** を選択して新しいタグを追加します。
  </Tab>
</Tabs>

<div id="remove-tags-from-one-or-more-runs">
  ## 1 つ以上の run からタグを削除する
</div>

W\&B App で run からタグを削除するには、次の step に従う。

<Tabs>
  <Tab title="プロジェクトページ">
    この method は、多数の run からタグを削除する場合に最適です。

    1. プロジェクトの Run サイドバーで、右上の表アイコンを選択します。これにより、サイドバーが Runs 表全体に展開されます。
    2. 表内の run にカーソルを合わせると、左側にチェックボックスが表示されます。すべての Runs を選択する場合は、ヘッダー行のチェックボックスを使用します。
    3. チェックボックスを選択して、一括 action を有効にします。
    4. タグを削除する runs を選択します。
    5. run の行の上にある **Tag** ボタンを選択します。
    6. タグの横にあるチェックボックスを選択して、run からそのタグを削除します。
  </Tab>

  <Tab title="Run page">
    1. Run page の左サイドバーで、最上部の **Overview** タブを選択します。run のタグはここに表示されます。
    2. タグにカーソルを合わせて "x" を選択し、run から削除します。
  </Tab>
</Tabs>
