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

# Artifact

export const GitHubLink = ({url, compact = false}) => <a href={url} target="_blank" rel="noopener noreferrer" className={compact ? "source-link" : "github-source-link"}>
    {compact ? "ソースを表示" : <>
    <svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
      <path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z" />
    </svg>
    GitHub のソース
      </>}
  </a>;

<GitHubLink compact url="https://github.com/wandb/wandb/blob/main/wandb/sdk/artifacts/artifact.py#L128" />

## <Badge color="yellow" size="lg" shape="rounded">クラス</Badge> wandb.Artifact

データセットとモデルのバージョン管理のための、柔軟で軽量な基本構成要素です。

空の W\&B Artifact を作成します。`add` で始まる method を使って アーティファクト の内容を
追加します。必要なファイルをすべて アーティファクト に追加したら、
`run.log_artifact()` を呼び出してログします。

```python theme={null}
name: 'str',
type: 'str',
description: 'str | None' = None,
metadata: 'dict[str, Any] | None' = None,
incremental: 'bool' = False,
use_as: 'str | None' = None,
storage_region: 'str | None' = None,
digest_algorithm: "Literal['MD5', 'XXH128']" = 'MD5'
```

<div id="args">
  ## 引数
</div>

<ResponseField name="name" type="str">
  アーティファクト の人間が読み取れる名前です。この名前を使うと、W\&B App UI 上またはプログラムから特定の アーティファクト を識別できます。`use_artifact` Public API を使えば、アーティファクト をインタラクティブに参照することもできます。名前には、英字、数字、アンダースコア、ハイフン、ドットを使用できます。名前はプロジェクト内で一意である必要があります。
</ResponseField>

<ResponseField name="type" type="str">
  アーティファクト のタイプです。アーティファクト のタイプは、Artifacts を整理し、相互に区別するために使用します。英字、数字、アンダースコア、ハイフン、ドットを含む任意の文字列を使用できます。一般的なタイプには `dataset` や `model` があります。アーティファクト を W\&B Model Registry にリンクしたい場合は、タイプ文字列に `model` を含めてください。なお、一部のタイプは内部使用のために予約されており、ユーザーは設定できません。これには `job` や `wandb-` で始まるタイプが含まれます。
</ResponseField>

<ResponseField name="description" type="str | None">
  アーティファクト の説明です。Model または Dataset Artifacts の場合は、標準化されたチームのモデルカードまたはデータセットカード用のドキュメントを追加します。アーティファクト の説明は、`Artifact.description` 属性を使ってプログラムから確認することも、W\&B App UI で確認することもできます。W\&B App では、説明は markdown として表示されます。
</ResponseField>

<ResponseField name="metadata" type="dict[str, Any] | None">
  アーティファクト に関する追加情報です。metadata はキーと値のペアからなる辞書として指定します。指定できるキーの総数は 100 個までです。
</ResponseField>

<ResponseField name="incremental" type="bool">
  既存の アーティファクト を変更するには、代わりに `Artifact.new_draft()` method を使用してください。
</ResponseField>

<ResponseField name="use_as" type="str | None">
  非推奨。
</ResponseField>

<ResponseField name="storage_region" type="str | None">
  説明はありません。
</ResponseField>

<ResponseField name="digest_algorithm" type="Literal['MD5', 'XXH128']">
  アーティファクト に使用するダイジェストアルゴリズムです。デフォルトは MD5 です。XXH128 に設定すると、すでに MD5 を使用しているコレクションの一部でない限り、アーティファクト は XXH128 アルゴリズムでハッシュ化されます。SDK バージョン 0.29.0 より前では、XXH128 アーティファクト に対する `artifact.verify()` の呼び出しは常に失敗します。
</ResponseField>

<div id="properties">
  ## プロパティ
</div>

<ResponseField name="aliases" type="list[str]">
  アーティファクト バージョンに割り当てられた、意味のわかりやすい1つ以上の参照または

  識別用の「ニックネーム」のリストです。

  エイリアスは、プログラムから参照できる変更可能な参照です。
  アーティファクトのエイリアスは、W\&B App UI またはプログラムから変更できます。
  詳細については、[新しいアーティファクト バージョンを作成する](https://docs.wandb.ai/models/artifacts/create-a-new-artifact-version)
  を参照してください。
</ResponseField>

<ResponseField name="collection" type="ArtifactCollection">
  このアーティファクトの取得元のコレクションです。

  コレクションは、順序付けられたアーティファクト バージョンのグループです。
  このアーティファクトがリンク先のコレクションから取得された場合は、
  そのコレクションを返します。それ以外の場合は、
  アーティファクト バージョンの元となるコレクションを返します。

  アーティファクトの元となるコレクションは、
  ソース シーケンスと呼ばれます。
</ResponseField>

<ResponseField name="commit_hash" type="str">
  このアーティファクトのコミット時に返されたハッシュです。
</ResponseField>

<ResponseField name="created_at" type="str">
  アーティファクトが作成された Timestamp です。
</ResponseField>

<ResponseField name="description" type="str | None">
  アーティファクトの説明です。
</ResponseField>

<ResponseField name="digest" type="str">
  アーティファクトの論理ダイジェストです。

  ダイジェストはアーティファクトの内容のチェックサムです。アーティファクトの
  ダイジェストが現在の `latest` バージョンと同じ場合、`log_artifact` は何も実行しません。
</ResponseField>

<ResponseField name="digest_algorithm" type="ArtifactDigestAlgorithm">
  アーティファクトのダイジェストの計算に使用するダイジェスト アルゴリズムです。
</ResponseField>

<ResponseField name="entity" type="str">
  アーティファクト コレクションが属するエンティティの名です。

  アーティファクトがリンクの場合、エンティティはリンク先のアーティファクトのエンティティになります。
</ResponseField>

<ResponseField name="file_count" type="int">
  file の数 (参照を含む) です。
</ResponseField>

<ResponseField name="history_step" type="int | None">
  このアーティファクトのソース run の履歴メトリクスがログされた最も近いステップです。
</ResponseField>

<ResponseField name="id" type="str | None">
  アーティファクトの ID です。
</ResponseField>

<ResponseField name="is_link" type="bool">
  アーティファクトがリンク アーティファクトかどうかを示すブール値フラグです。

  True: アーティファクトはソース アーティファクトへのリンク アーティファクトです。
  False: アーティファクトはソース アーティファクトです。
</ResponseField>

<ResponseField name="linked_artifacts" type="list[Artifact]">
  ソース アーティファクトにリンクされているすべてのアーティファクトのリストを返します。

  このアーティファクトがリンク アーティファクト (`artifact.is_link == True`) の場合、
  空のリストを返します。

  結果は500件に制限されます。
</ResponseField>

<ResponseField name="linked_at" type="str | None">
  このアーティファクトが現在のコレクションにリンクされた時刻です。

  リンクされたアーティファクトに対してのみ有効で、それ以外の場合は `None` を返します。
</ResponseField>

<ResponseField name="manifest" type="ArtifactManifest">
  アーティファクトのマニフェストです。

  マニフェストにはすべての内容が一覧表示され、アーティファクトが
  ログされた後は変更できません。
</ResponseField>

<ResponseField name="metadata" type="dict">
  ユーザー定義のアーティファクト メタデータです。

  アーティファクトに関連付けられた構造化データです。
</ResponseField>

<ResponseField name="name" type="str">
  アーティファクトの名とバージョンです。

  形式は `{collection}:{alias}` の string です。アーティファクトが
  ログまたは保存される前に取得した場合、名にはエイリアスが含まれません。
  アーティファクトがリンクの場合、名はリンク先のアーティファクトの名になります。
</ResponseField>

<ResponseField name="project" type="str">
  アーティファクト コレクションが属する project の名です。

  アーティファクトがリンクの場合、project はリンク先のアーティファクトの project になります。
</ResponseField>

<ResponseField name="qualified_name" type="str">
  アーティファクトの entity/project/name です。

  アーティファクトがリンクの場合、修飾名は
  リンク先アーティファクト パスの修飾名になります。
</ResponseField>

<ResponseField name="size" type="int">
  アーティファクトの合計サイズ (バイト単位) です。

  このアーティファクトによってトラッキングされるすべての参照を含みます。
</ResponseField>

<ResponseField name="source_artifact" type="Artifact">
  元のログ済みアーティファクトであるソース アーティファクトを返します。

  このアーティファクトがソース アーティファクト (`artifact.is_link == False`) の場合、
  自身を返します。
</ResponseField>

<ResponseField name="source_collection" type="ArtifactCollection">
  アーティファクトのソース コレクションです。

  ソース コレクションは、アーティファクトがログされたコレクションです。
</ResponseField>

<ResponseField name="source_entity" type="str">
  ソース アーティファクトのエンティティの名です。
</ResponseField>

<ResponseField name="source_name" type="str">
  ソース アーティファクトの名とバージョンです。

  形式は `{source_collection}:{alias}` の string です。アーティファクトが
  保存される前はバージョンがまだ不明なため、名のみが含まれます。
</ResponseField>

<ResponseField name="source_project" type="str">
  ソース artifact の project 名。
</ResponseField>

<ResponseField name="source_qualified_name" type="str">
  ソース artifact の source\_entity/source\_project/source\_name。
</ResponseField>

<ResponseField name="source_version" type="str">
  ソース artifact のバージョン。

  `v{number}` 形式の string。
</ResponseField>

<ResponseField name="state" type="str">
  artifact のステータス。"PENDING"、"COMMITTED"、または "DELETED" のいずれか。
</ResponseField>

<ResponseField name="tags" type="list[str]">
  この artifact バージョンに割り当てられた 1 つ以上のタグのリスト。
</ResponseField>

<ResponseField name="ttl" type="timedelta | None">
  artifact の time-to-live (TTL) ポリシー。

  TTL ポリシーの期間を過ぎると、Artifacts はその後まもなく削除されます。`None` に設定すると、その artifact では TTL ポリシーが無効になり、チームのデフォルト TTL が存在していても削除対象としてスケジュールされません。チーム管理者がデフォルト TTL を定義しており、artifact にカスタムポリシーが設定されていない場合、artifact はチームのデフォルトの TTL ポリシーを継承します。
</ResponseField>

<ResponseField name="type" type="str">
  artifact のタイプ。一般的なタイプには `dataset` や `model` があります。
</ResponseField>

<ResponseField name="updated_at" type="str">
  artifact が最後に更新された時刻。
</ResponseField>

<ResponseField name="url" type="artifact の URL。">
  artifact の URL を構築します。
</ResponseField>

<ResponseField name="use_as" type="str | None">
  非推奨。
</ResponseField>

<ResponseField name="version" type="str">
  artifact のバージョン。

  `v{number}` 形式の string。
  これがリンクされた artifact の場合、バージョンはリンク先のコレクションから取得されます。
</ResponseField>

<div id="methods">
  ## メソッド
</div>

### <Badge color="blue" size="lg" shape="rounded">method</Badge> Artifact.add()

```python theme={null}
self,
obj: 'WBValue',
name: 'StrPath',
overwrite: 'bool' = False
```

artifact に wandb.WBValue `obj` を追加します。

<div id="arguments">
  ##### 引数
</div>

<ResponseField name="obj" type="WBValue">
  追加するオブジェクト。現在サポートされているのは、Bokeh、JoinedTable、PartitionedTable、Table、Classes、ImageMask、BoundingBoxes2D、Audio、Image、Video、Html、Object3D のいずれかです。
</ResponseField>

<ResponseField name="name" type="StrPath">
  オブジェクトを追加する artifact 内のパス。
</ResponseField>

<ResponseField name="overwrite" type="bool">
  True の場合、該当する場合は同じファイルパスを持つ既存のオブジェクトを上書きします。
</ResponseField>

##### 例外

* `ArtifactFinalizedError`: 現在の artifact バージョンは確定済みのため、変更できません。代わりに新しい artifact バージョンをログしてください。

### <Badge color="blue" size="lg" shape="rounded">メソッド</Badge> Artifact.add\_dir()

```python theme={null}
self,
local_path: 'str',
name: 'str | None' = None,
skip_cache: 'bool | None' = False,
policy: "Literal['mutable', 'immutable'] | None" = 'mutable',
merge: 'bool' = False
```

ローカルディレクトリを artifact に追加します。

<div id="arguments">
  ##### 引数
</div>

<ResponseField name="local_path" type="str">
  ローカルディレクトリのパス。
</ResponseField>

<ResponseField name="name" type="str | None">
  artifact 内のサブディレクトリ名。指定した名前は、W\&B App UI で artifact の `type` 配下にネストされて表示されます。デフォルトでは artifact のルートです。
</ResponseField>

<ResponseField name="skip_cache" type="bool | None">
  `True` に設定すると、W\&B はアップロード中にファイルをキャッシュへコピーまたは移動しません
</ResponseField>

<ResponseField name="policy" type="Literal['mutable', 'immutable'] | None">
  デフォルトは "mutable" です。

  * mutable: アップロード中の破損を防ぐため、ファイルの一時コピーを作成します。
  * immutable: 保護を無効にし、ユーザーがファイルを削除または変更しないことを前提とします。
</ResponseField>

<ResponseField name="merge" type="bool">
  `False` (デフォルト) の場合、以前の `add_dir` 呼び出しですでに追加されたファイルの内容が変更されていると `ValueError` を送出します。`True` の場合、内容が変更された既存ファイルを上書きします。新しいファイルは常に追加され、既存ファイルが削除されることはありません。ディレクトリ全体を置き換えるには、`add_dir(local_path, name=my_prefix)` を使用してディレクトリ追加時に名前を指定し、`remove(my_prefix)` を呼び出してそのディレクトリを削除してから、再度追加してください。
</ResponseField>

##### 例外

* `ArtifactFinalizedError`: 現在のartifactバージョンは確定済みのため、変更できません。代わりに新しいartifactバージョンをログしてください。
* `ValueError`: Policy は "mutable" または "immutable" である必要があります

### <Badge color="blue" size="lg" shape="rounded">メソッド</Badge> Artifact.add\_file()

```python theme={null}
self,
local_path: 'str',
name: 'str | None' = None,
is_tmp: 'bool | None' = False,
skip_cache: 'bool | None' = False,
policy: "Literal['mutable', 'immutable'] | None" = 'mutable',
overwrite: 'bool' = False
```

ローカルファイルをartifactに追加します。

<div id="arguments">
  ##### 引数
</div>

<ResponseField name="local_path" type="str">
  追加するファイルのパス。
</ResponseField>

<ResponseField name="name" type="str | None">
  追加するファイルに使用する、artifact内のパス。デフォルトではファイルのベース名が使用されます。
</ResponseField>

<ResponseField name="is_tmp" type="bool | None">
  true の場合、競合を避けるため、ファイル名は決定論的に変更されます。
</ResponseField>

<ResponseField name="skip_cache" type="bool | None">
  `True` の場合、アップロード後にファイルをキャッシュへコピーしません。
</ResponseField>

<ResponseField name="policy" type="Literal['mutable', 'immutable'] | None">
  デフォルトでは "mutable" に設定されます。"mutable" を指定すると、アップロード中の破損を防ぐためにファイルの一時コピーを作成します。"immutable" を指定すると、保護を無効にし、ユーザーがファイルを削除または変更しないことを前提とします。
</ResponseField>

<ResponseField name="overwrite" type="bool">
  `True` の場合、ファイルがすでに存在していれば上書きします。
</ResponseField>

##### 例外

* `ArtifactFinalizedError`: 現在のartifactバージョンは確定済みのため、変更できません。代わりに新しいartifactバージョンをログしてください。
* `ValueError`: Policy は "mutable" または "immutable" である必要があります

### <Badge color="blue" size="lg" shape="rounded">method</Badge> Artifact.add\_reference()

```python theme={null}
self,
uri: 'ArtifactManifestEntry | str',
name: 'StrPath | None' = None,
checksum: 'bool' = True,
max_objects: 'int | None' = None
```

URI で指定した参照を アーティファクト に追加します。

アーティファクト に追加するファイルやディレクトリとは異なり、参照は W\&B にアップロードされません。詳細は[外部ファイルをトラッキングする](https://docs.wandb.ai/models/artifacts/track-external-files)を参照してください。

デフォルトでは、次のスキームがサポートされます。

* http(s): ファイルのサイズとダイジェストは、サーバーから返される
  `Content-Length` および `ETag` レスポンスヘッダーから推定されます。
* s3: チェックサムとサイズはオブジェクトのメタデータから取得されます。
  bucket のバージョン管理が有効な場合は、バージョン ID もトラッキングされます。
* gs: チェックサムとサイズはオブジェクトのメタデータから取得されます。bucket
  のバージョン管理が有効な場合は、バージョン ID もトラッキングされます。
* https, `*.blob.core.windows.net` に一致するドメイン
* Azure: チェックサムとサイズは blob のメタデータから取得されます。
  storage account のバージョン管理が有効な場合は、バージョン ID も
  トラッキングされます。
* file: チェックサムとサイズはファイルシステムから取得されます。このスキームは
  、ファイルをトラッキングしたいものの、必ずしもアップロードはしたくない場合に、NFS 共有やその他の外部マウントされたボリューム内のファイルを扱うのに便利です。

その他のスキームでは、ダイジェストは URI のハッシュのみとなり、サイズは空欄のままになります。

<div id="arguments">
  ##### 引数
</div>

<ResponseField name="uri" type="ArtifactManifestEntry | str">
  追加する参照の URI パス。別の アーティファクト のエントリへの参照を保存するには、`Artifact.get_entry` が返すオブジェクトを URI パスとして指定することもできます。
</ResponseField>

<ResponseField name="name" type="StrPath | None">
  この参照の内容を配置する アーティファクト 内のパス。
</ResponseField>

<ResponseField name="checksum" type="bool">
  参照 URI にあるリソースのチェックサムを計算するかどうか。自動整合性検証を有効にするため、チェックサムの計算を強く推奨します。チェックサムの計算を無効にすると アーティファクト の作成は高速になりますが、参照ディレクトリは走査されないため、ディレクトリ内のオブジェクトは アーティファクト に保存されません。参照オブジェクトを追加する場合は `checksum=False` に設定することを推奨します。この場合、新しいバージョンは参照 URI が変更されたときにのみ作成されます。
</ResponseField>

<ResponseField name="max_objects" type="int | None">
  ディレクトリまたは bucket store prefix を指す参照を追加する際に対象とするオブジェクトの最大数。デフォルトでは、Amazon S3、GCS、Azure、およびローカルファイルで許可されるオブジェクトの最大数は 10,000,000 です。その他の URI スキームには最大数はありません。
</ResponseField>

##### 例外

* `ArtifactFinalizedError`: 現在の artifact バージョンは確定済みのため、変更できません。代わりに新しい artifact バージョンをログしてください。

### <Badge color="blue" size="lg" shape="rounded">method</Badge> Artifact.checkout()

```python theme={null}
self,
root: 'str | None' = None
```

指定したルートディレクトリを、artifact の内容で置き換えます。

WARNING: artifact に含まれていない `root` 内のファイルはすべて削除されます。

<div id="arguments">
  ##### 引数
</div>

<ResponseField name="root" type="str | None">
  この artifact のファイルで置き換える対象のディレクトリ。
</ResponseField>

##### 例外

* `ArtifactNotLoggedError`: artifact がログされていない場合。

### <Badge color="blue" size="lg" shape="rounded">method</Badge> Artifact.delete()

```python theme={null}
self,
delete_aliases: 'bool' = False
```

artifact とそのファイルを削除します。

リンクされた artifact に対して call した場合、削除されるのはリンクのみで、ソース artifact には影響しません。

ソース artifact と collection の間のリンクを削除するには、`Artifact.delete()` ではなく `Artifact.unlink()` を使用してください。

<div id="arguments">
  ##### 引数
</div>

<ResponseField name="delete_aliases" type="bool">
  `True` に設定すると、artifact に関連付けられているすべての alias を削除します。`False` の場合、artifact に既存の alias があると例外を送出します。artifact がリンク先の collection から取得されたものである場合、このパラメーターは無視されます。
</ResponseField>

##### 例外

* `ArtifactNotLoggedError`: artifact がログされていない場合。

### <Badge color="blue" size="lg" shape="rounded">メソッド</Badge> Artifact.download()

```python theme={null}
self,
root: 'StrPath | None' = None,
allow_missing_references: 'bool' = False,
skip_cache: 'bool | None' = None,
path_prefix: 'StrPath | None' = None,
multipart: 'bool | None' = None
```

artifact の内容を、指定したルートディレクトリにダウンロードします。

`root` 内にある既存のファイルは変更されません。`root` の内容を artifact と完全に一致させたい場合は、`download` を呼び出す前に `root` を明示的に削除してください。

<div id="arguments">
  ##### 引数
</div>

<ResponseField name="root" type="StrPath | None">
  W\&B が artifact のファイルを保存するディレクトリ。
</ResponseField>

<ResponseField name="allow_missing_references" type="bool">
  `True` に設定すると、参照ファイルのダウンロード中に無効な参照パスは無視されます。
</ResponseField>

<ResponseField name="skip_cache" type="bool | None">
  `True` に設定すると、ダウンロード時に artifact キャッシュをスキップし、W\&B は各ファイルをデフォルトのルートまたは指定したダウンロードディレクトリにダウンロードします。
</ResponseField>

<ResponseField name="path_prefix" type="StrPath | None">
  指定した場合、指定したプレフィックスで始まるパスを持つファイルのみダウンロードされます。UNIX 形式 (フォワードスラッシュ) を使用します。
</ResponseField>

<ResponseField name="multipart" type="bool | None">
  `None` (デフォルト) に設定すると、各ファイルのサイズが 2GB を超える場合、multipart ダウンロードを使用して artifact を並列にダウンロードします。`True` または `False` に設定すると、ファイルサイズに関係なく、artifact は並列または逐次でダウンロードされます。
</ResponseField>

##### 例外

* `ArtifactNotLoggedError`: artifact がログされていない場合。

### <Badge color="blue" size="lg" shape="rounded">メソッド</Badge> Artifact.file()

```python theme={null}
self,
root: 'str | None' = None
```

`root` で指定したディレクトリに、単一ファイルのArtifactをダウンロードします。

<div id="arguments">
  ##### 引数
</div>

<ResponseField name="root" type="str | None">
  ファイルの保存先となるルートディレクトリ。デフォルトは `./artifacts/self.name/` です。
</ResponseField>

<div id="raises">
  ##### 送出する例外
</div>

* `ArtifactNotLoggedError`: Artifactがログされていない場合。
* `ValueError`: Artifactに複数のファイルが含まれている場合。

### <Badge color="blue" size="lg" shape="rounded">method</Badge> Artifact.files()

```python theme={null}
self,
names: 'list[str] | None' = None,
per_page: 'int' = 50,
start: 'str | None' = None
```

この アーティファクト に保存されているすべてのファイルをイテレートします。

<div id="arguments">
  ##### 引数
</div>

<ResponseField name="names" type="list[str] | None">
  一覧取得する対象の、アーティファクト のルートからの相対ファイルパス。
</ResponseField>

<ResponseField name="per_page" type="int">
  リクエストごとに返すファイル数。
</ResponseField>

<ResponseField name="start" type="str | None">
  過去のクエリを再開するためのページネーションカーソル。前回の paginator の `.cursor` 属性から取得します。
</ResponseField>

##### 例外

* `ArtifactNotLoggedError`: artifact がログされていない場合。

### <Badge color="blue" size="lg" shape="rounded">メソッド</Badge> Artifact.finalize()

```python theme={null}
self
```

artifact バージョンを確定します。

artifact は特定の artifact バージョンとしてログされるため、いったん確定するとその artifact
バージョンは変更できません。artifact にさらにデータをログするには、新しい artifact バージョンを作成してください。artifact は `log_artifact`
でログすると自動的に自動確定されます。

### <Badge color="blue" size="lg" shape="rounded">method</Badge> Artifact.get()

```python theme={null}
self,
name: 'str'
```

artifact 内の相対 `name` にある WBValue object を取得します。

<div id="arguments">
  ##### 引数
</div>

<ResponseField name="name" type="str">
  取得する artifact 内の相対パス名。
</ResponseField>

##### 発生する例外

* `ArtifactNotLoggedError`: artifact がログされていない場合、または run がオフラインの場合。

### <Badge color="blue" size="lg" shape="rounded">method</Badge> Artifact.get\_added\_local\_path\_name()

```python theme={null}
self,
local_path: 'str'
```

ローカルファイルシステム上のパスで追加されたファイルの artifact 相対名を取得します。

<div id="arguments">
  ##### 引数
</div>

<ResponseField name="local_path" type="str">
  artifact 相対名に変換するローカルパス。
</ResponseField>

### <Badge color="blue" size="lg" shape="rounded">method</Badge> Artifact.get\_entry()

```python theme={null}
self,
name: 'StrPath'
```

指定した名のエントリを取得します。

<div id="arguments">
  ##### 引数
</div>

<ResponseField name="name" type="StrPath">
  取得する artifact の相対名
</ResponseField>

##### 発生する例外

* `ArtifactNotLoggedError`: artifact がログされていない場合、または run がオフラインの場合。
* `KeyError`: artifact に指定した名のエントリが含まれていない場合。

### <Badge color="blue" size="lg" shape="rounded">method</Badge> Artifact.get\_path()

```python theme={null}
self,
name: 'StrPath'
```

非推奨です。`get_entry(name)` を使用してください。

<div id="arguments">
  ##### 引数
</div>

<ResponseField name="名" type="StrPath">
  説明はありません。
</ResponseField>

### <Badge color="blue" size="lg" shape="rounded">メソッド</Badge> Artifact.is\_draft()

```python theme={null}
self
```

artifact が未保存かどうかを確認します。

### <Badge color="blue" size="lg" shape="rounded">method</Badge> Artifact.json\_encode()

```python theme={null}
self
```

artifactをJSON形式にエンコードしたものを返します。

### <Badge color="blue" size="lg" shape="rounded">method</Badge> Artifact.link()

```python theme={null}
self,
target_path: 'str',
aliases: 'Iterable[str] | None' = None
```

この artifact をコレクションにリンクします。

<div id="arguments">
  ##### 引数
</div>

<ResponseField name="target_path" type="str">
  コレクションのパス。パスは、プレフィックス "wandb-registry-" に続けて、レジストリ名とコレクション名を指定した `wandb-registry-{REGISTRY_NAME}/{COLLECTION_NAME}` の形式です。
</ResponseField>

<ResponseField name="aliases" type="Iterable[str] | None">
  リンクした artifact に 1 つ以上のエイリアスを追加します。"latest" エイリアスは、リンクした artifact のうち最新のものに自動的に適用されます。
</ResponseField>

##### 例外

* `ArtifactNotLoggedError`: artifact がログされていない場合。

### <Badge color="blue" size="lg" shape="rounded">メソッド</Badge> Artifact.logged\_by()

```python theme={null}
self
```

artifact を最初にログした W\&B run を取得します。

##### 例外

* `ArtifactNotLoggedError`: artifact がログされていない場合。

### <Badge color="blue" size="lg" shape="rounded">メソッド</Badge> Artifact.new\_draft()

```python theme={null}
self
```

このコミット済みartifactと同じ内容を持つ新しいドラフトartifactを作成します。

既存のartifactを変更すると、「段階的artifact」と呼ばれる新しいartifactバージョンが作成されます。返されるartifactは拡張または変更でき、新しいバージョンとしてログできます。

##### 例外

* `ArtifactNotLoggedError`: artifact がログされていない場合。

### <Badge color="blue" size="lg" shape="rounded">method</Badge> Artifact.new\_file()

```python theme={null}
self,
name: 'str',
mode: 'str' = 'x',
encoding: 'str | None' = None,
policy: "Literal['mutable', 'immutable']" = 'mutable'
```

新しい一時ファイルを開き、アーティファクト に追加します。

<div id="arguments">
  ##### 引数
</div>

<ResponseField name="name" type="str">
  artifactに追加する新しいfileの名。
</ResponseField>

<ResponseField name="mode" type="str">
  新しいfileを開く際に使用するfileアクセスモード。
</ResponseField>

<ResponseField name="encoding" type="str | None">
  新しいfileを開く際に使用するエンコーディング。
</ResponseField>

<ResponseField name="policy" type="Literal['mutable', 'immutable']">
  デフォルトでは "mutable" に設定されます。"mutable" を指定すると、アップロード中の破損を防ぐためにファイルの一時コピーを作成します。"immutable" を指定すると、保護を無効にし、ユーザーがファイルを削除または変更しないことを前提とします。
</ResponseField>

##### 例外

* `ArtifactFinalizedError`: 現在の artifact バージョンは確定済みのため、変更できません。代わりに新しい artifact バージョンをログしてください。

### <Badge color="blue" size="lg" shape="rounded">method</Badge> Artifact.remove()

```python theme={null}
self,
item: 'StrPath | ArtifactManifestEntry'
```

artifact から項目を削除します。

<div id="arguments">
  ##### 引数
</div>

<ResponseField name="item" type="StrPath | ArtifactManifestEntry">
  削除する項目です。特定の manifest エントリ、または artifact 相対パスの名を指定できます。`item` がディレクトリに一致する場合、そのディレクトリ内のすべての項目が削除されます。
</ResponseField>

##### Raises

* `ArtifactFinalizedError`: 現在の artifact バージョンは確定済みのため、変更できません。代わりに新しい artifact バージョンをログしてください。
* `FileNotFoundError`: artifact 内に `item` が見つからない場合。

### <Badge color="blue" size="lg" shape="rounded">メソッド</Badge> Artifact.save()

```python theme={null}
self,
project: 'str | None' = None,
settings: 'wandb.Settings | None' = None
```

artifact に加えた変更をすべて保存します。

現在 run コンテキスト内にいる場合、その run がこの artifact をログします。現在 run コンテキスト内にいない場合は、この artifact をトラッキングするために、タイプが "auto" の run が作成されます。

<div id="arguments">
  ##### 引数
</div>

<ResponseField name="project" type="str | None">
  run がまだコンテキスト内にない場合に、artifact に使用するプロジェクト。
</ResponseField>

<ResponseField name="settings" type="wandb.Settings | None">
  自動 run の初期化時に使用する設定オブジェクト。主にテストハーネスで使用します。
</ResponseField>

### <Badge color="blue" size="lg" shape="rounded">method</Badge> Artifact.unlink()

```python theme={null}
self
```

この artifact が artifact collection にリンクされたメンバーである場合は、この artifact のリンクを解除します。

##### 発生する例外

* `ArtifactNotLoggedError`: artifact がログされていない場合。
* `ValueError`: artifact がどの collection にもリンクされていない場合。

### <Badge color="blue" size="lg" shape="rounded">メソッド</Badge> Artifact.used\_by()

```python theme={null}
self
```

このartifactおよびそれにリンクされたartifactを使用したrunのリストを取得します。

##### 例外

* `ArtifactNotLoggedError`: artifact がログされていない場合。

### <Badge color="blue" size="lg" shape="rounded">method</Badge> Artifact.verify()

```python theme={null}
self,
root: 'str | None' = None
```

アーティファクトの内容がマニフェストと一致していることを確認します。

ディレクトリ内のすべてのファイルのチェックサムを計算し、そのチェックサムをアーティファクトのマニフェストと照合します。参照は検証されません。

<div id="arguments">
  ##### 引数
</div>

<ResponseField name="root" type="str | None">
  検証するディレクトリです。None の場合、アーティファクトは './artifacts/self.name/' にダウンロードされます。
</ResponseField>

##### 発生する例外

* `ArtifactNotLoggedError`: アーティファクトがログされていない場合。
* `ValueError`: 検証に失敗した場合。

### <Badge color="blue" size="lg" shape="rounded">メソッド</Badge> Artifact.wait()

```python theme={null}
self,
timeout: 'int | None' = None
```

必要に応じて、このArtifactのログ記録が完了するまで待機します。

<div id="arguments">
  ##### 引数
</div>

<ResponseField name="timeout" type="int | None">
  待機する時間 (秒) 。
</ResponseField>
