これは、このセクションの複数ページの印刷可能なビューです。 印刷するには、ここをクリックしてください.

このページの通常のビューに戻る.

Import & Export API

クラス

class Api: wandb サーバー のクエリに使用されます。

class File: File は wandb で保存されたファイルに関連付けられたクラスです。

class Files: File オブジェクトの反復可能なコレクション。

class Job

class Project: Project は Runs の名前空間です。

class Projects: Project オブジェクトの反復可能なコレクション。

class QueuedRun: エンティティと project に関連付けられた単一のキューされた run。run = queued_run.wait_until_running() または run = queued_run.wait_until_finished() を呼び出して、run にアクセスします。

class Run: エンティティと project に関連付けられた単一の run。

class RunQueue

class Runs: project に関連付けられた runs の反復可能なコレクションとオプションのフィルター。

class Sweep: sweep に関連付けられた runs のセット。

1 - Api

wandb サーバー のクエリに使用されます。

Api(
    overrides: Optional[Dict[str, Any]] = None,
    timeout: Optional[int] = None,
    api_key: Optional[str] = None
) -> None

例:

初期化の最も一般的な方法

>>> wandb.Api()
Args
overrides (辞書) https://api.wandb.ai 以外の wandb サーバー を使用している場合は、base_url を設定できます。また、entityproject、および run のデフォルト値を設定することもできます。
Attributes

メソッド

artifact

View source

artifact(
    name: str,
    type: Optional[str] = None
)

project/name または entity/project/name の形式でパスを解析して、単一の artifact を返します。

Args
name (str) artifact 名。project/ または entity/project/ が前に付いている場合があります。名前で entity が指定されていない場合、Run または API 設定の entity が使用されます。有効な名前は、name:version name:alias の形式にすることができます。
type (str, オプション) フェッチする artifact の型。
Returns
Artifact オブジェクト。
Raises
ValueError artifact 名が指定されていない場合。
ValueError artifact の型が指定されているが、フェッチされた artifact の型と一致しない場合。

注:

このメソッドは、外部での使用のみを目的としています。wandb リポジトリ コード内で api.artifact() を呼び出さないでください。

artifact_collection

View source

artifact_collection(
    type_name: str,
    name: str
) -> "public.ArtifactCollection"

型で単一の artifact collection を返し、entity/project/name の形式でパスを解析します。

Args
type_name (str) フェッチする artifact collection の型。
name (str) artifact collection 名。entity/project が前に付いている場合があります。
Returns
ArtifactCollection オブジェクト。

artifact_collection_exists

View source

artifact_collection_exists(
    name: str,
    type: str
) -> bool

artifact collection が指定された project および entity 内に存在するかどうかを返します。

Args
name (str) artifact collection 名。entity/project が前に付いている場合があります。entity または project が指定されていない場合、オーバーライド パラメータから推測されます (設定されている場合)。それ以外の場合、entity はユーザー設定から取得され、project はデフォルトで “uncategorized” になります。
type (str) artifact collection の型
Returns
artifact collection が存在する場合は True、それ以外の場合は False。

artifact_collections

View source

artifact_collections(
    project_name: str,
    type_name: str,
    per_page: Optional[int] = 50
) -> "public.ArtifactCollections"

一致する artifact collection の collection を返します。

Args
project_name (str) フィルタリングする project の名前。
type_name (str) フィルタリングする artifact の型の名前。
per_page (int, オプション) クエリ ページネーションのページ サイズを設定します。None を指定すると、デフォルト サイズが使用されます。通常、これを変更する理由はありません。
Returns
反復可能な ArtifactCollections オブジェクト。

artifact_exists

View source

artifact_exists(
    name: str,
    type: Optional[str] = None
) -> bool

artifact バージョンが指定された project および entity 内に存在するかどうかを返します。

Args
name (str) artifact 名。entity/project が前に付いている場合があります。entity または project が指定されていない場合、オーバーライド パラメータから推測されます (設定されている場合)。それ以外の場合、entity はユーザー設定から取得され、project はデフォルトで “uncategorized” になります。有効な名前は、name:version name:alias の形式にすることができます。
type (str, オプション) artifact の型
Returns
artifact バージョンが存在する場合は True、それ以外の場合は False。

artifact_type

View source

artifact_type(
    type_name: str,
    project: Optional[str] = None
) -> "public.ArtifactType"

一致する ArtifactType を返します。

Args
type_name (str) 取得する artifact の型の名前。
project (str, オプション) 指定された場合、フィルタリングする project 名またはパス。
Returns
ArtifactType オブジェクト。

artifact_types

View source

artifact_types(
    project: Optional[str] = None
) -> "public.ArtifactTypes"

一致する artifact 型の collection を返します。

Args
project (str, オプション) 指定された場合、フィルタリングする project 名またはパス。
Returns
反復可能な ArtifactTypes オブジェクト。

artifact_versions

View source

artifact_versions(
    type_name, name, per_page=50
)

非推奨。代わりに artifacts(type_name, name) を使用してください。

artifacts

View source

artifacts(
    type_name: str,
    name: str,
    per_page: Optional[int] = 50,
    tags: Optional[List[str]] = None
) -> "public.Artifacts"

指定されたパラメータから Artifacts collection を返します。

Args
type_name (str) フェッチする artifacts の型。
name (str) artifact collection 名。entity/project が前に付いている場合があります。
per_page (int, オプション) クエリ ページネーションのページ サイズを設定します。None を指定すると、デフォルト サイズが使用されます。通常、これを変更する理由はありません。
tags (list[str], オプション) これらのタグをすべて持つ artifacts のみを返します。
Returns
反復可能な Artifacts オブジェクト。

create_project

View source

create_project(
    name: str,
    entity: str
) -> None

新しい project を作成します。

Args
name (str) 新しい project の名前。
entity (str) 新しい project の entity。

create_run

View source

create_run(
    *,
    run_id: Optional[str] = None,
    project: Optional[str] = None,
    entity: Optional[str] = None
) -> "public.Run"

新しい run を作成します。

Args
run_id (str, オプション) 指定された場合、run に割り当てる ID。run ID はデフォルトで自動的に生成されるため、通常はこれを指定する必要はなく、自己責任で行う必要があります。
project (str, オプション) 指定された場合、新しい run の project。
entity (str, オプション) 指定された場合、新しい run の entity。
Returns
新しく作成された Run

create_run_queue

View source

create_run_queue(
    name: str,
    type: "public.RunQueueResourceType",
    entity: Optional[str] = None,
    prioritization_mode: Optional['public.RunQueuePrioritizationMode'] = None,
    config: Optional[dict] = None,
    template_variables: Optional[dict] = None
) -> "public.RunQueue"

新しい run queue (Launch) を作成します。

Args
name (str) 作成する queue の名前
type (str) queue に使用するリソースの型。“local-container”、“local-process”、“kubernetes”、“sagemaker”、または “gcp-vertex” のいずれか。
entity (str) queue を作成する entity のオプションの名前。None の場合、設定されたまたはデフォルトの entity が使用されます。
prioritization_mode (str) 使用する優先順位付けのオプションのバージョン。“V0” または None
config (dict) queue に使用するオプションのデフォルト リソース設定。handlebars (例: {{var}}) を使用してテンプレート変数を指定します。
template_variables (dict) config で使用するテンプレート変数スキーマの辞書。予期される形式: { "var-name": { "schema": { "type": ("string", "number", or "integer"), "default": (optional value), "minimum": (optional minimum), "maximum": (optional maximum), "enum": [..."(options)"] } } }
Returns
新しく作成された RunQueue
Raises
パラメータが無効な場合は ValueError wandb API エラーの場合は wandb.Error

create_team

View source

create_team(
    team, admin_username=None
)

新しい team を作成します。

Args
team (str) team の名前
admin_username (str) team の管理者ユーザーのオプションのユーザー名。デフォルトは現在のユーザーです。
Returns
Team オブジェクト

create_user

View source

create_user(
    email, admin=(False)
)

新しい user を作成します。

Args
email (str) ユーザーのメール アドレス
admin (bool) このユーザーをグローバル インスタンス管理者にするかどうか
Returns
User オブジェクト

flush

View source

flush()

ローカル キャッシュをフラッシュします。

api オブジェクトは run のローカル キャッシュを保持するため、スクリプトの実行中に run の状態が変化する可能性がある場合は、api.flush() でローカル キャッシュをクリアして、run に関連付けられている最新の値を取得する必要があります。

from_path

View source

from_path(
    path
)

パスから run、sweep、project、または report を返します。

例:

project = api.from_path("my_project")
team_project = api.from_path("my_team/my_project")
run = api.from_path("my_team/my_project/runs/id")
sweep = api.from_path("my_team/my_project/sweeps/id")
report = api.from_path("my_team/my_project/reports/My-Report-Vm11dsdf")
Args
path (str) project、run、sweep、または report へのパス
Returns
ProjectRunSweep、または BetaReport インスタンス。
Raises
パスが無効であるか、オブジェクトが存在しない場合は wandb.Error

job

View source

job(
    name: Optional[str],
    path: Optional[str] = None
) -> "public.Job"

指定されたパラメータから Job を返します。

Args
name (str) ジョブ名。
path (str, オプション) 指定された場合、ジョブ artifact をダウンロードするルート パス。
Returns
Job オブジェクト。

list_jobs

View source

list_jobs(
    entity: str,
    project: str
) -> List[Dict[str, Any]]

指定された entity および project のジョブ (存在する場合) のリストを返します。

Args
entity (str) リストされたジョブの entity。
project (str) リストされたジョブの project。
Returns
一致するジョブのリスト。

project

View source

project(
    name: str,
    entity: Optional[str] = None
) -> "public.Project"

指定された名前 (および指定された場合は entity) を持つ Project を返します。

Args
name (str) project 名。
entity (str) 要求された entity の名前。None の場合、Api に渡されたデフォルトの entity にフォールバックします。デフォルトの entity がない場合は、ValueError が発生します。
Returns
Project オブジェクト。

projects

View source

projects(
    entity: Optional[str] = None,
    per_page: Optional[int] = 200
) -> "public.Projects"

指定された entity の projects を取得します。

Args
entity (str) 要求された entity の名前。None の場合、Api に渡されたデフォルトの entity にフォールバックします。デフォルトの entity がない場合は、ValueError が発生します。
per_page (int) クエリ ページネーションのページ サイズを設定します。None を指定すると、デフォルト サイズが使用されます。通常、これを変更する理由はありません。
Returns
Project オブジェクトの反復可能な collection である Projects オブジェクト。

queued_run

View source

queued_run(
    entity, project, queue_name, run_queue_item_id, project_queue=None,
    priority=None
)

パスに基づいて、単一の queue に入れられた run を返します。

entity/project/queue_id/run_queue_item_id の形式のパスを解析します。

registries

View source

registries(
    organization: Optional[str] = None,
    filter: Optional[Dict[str, Any]] = None
) -> Registries

Registry イテレーターを返します。

イテレーターを使用して、組織の registry 全体で registry、collection、または artifact バージョンを検索およびフィルタリングします。

例:

名前に “model” が含まれるすべての registry を検索します

import wandb

api = wandb.Api()  # entity が複数の org に属している場合は org を指定します
api.registries(filter={"name": {"$regex": "model"}})

名前が “my_collection” でタグが “my_tag” の registry 内のすべての collection を検索します

api.registries().collections(filter={"name": "my_collection", "tag": "my_tag"})

名前が “my_collection” を含み、エイリアスが “best” のバージョンを持つ registry 内のすべての artifact バージョンを検索します

api.registries().collections(
    filter={"name": {"$regex": "my_collection"}}
).versions(filter={"alias": "best"})

“model” を含み、タグ “prod” またはエイリアス “best” を持つ registry 内のすべての artifact バージョンを検索します

api.registries(filter={"name": {"$regex": "model"}}).versions(
    filter={"$or": [{"tag": "prod"}, {"alias": "best"}]}
)
Args
organization (str, オプション) フェッチする registry の組織。指定されていない場合は、ユーザーの設定で指定された組織を使用します。
filter (dict, オプション) registry イテレーターの各オブジェクトに適用する MongoDB スタイルのフィルター。collection でフィルタリングに使用できるフィールドは、namedescriptioncreated_atupdated_at です。collection でフィルタリングに使用できるフィールドは、nametagdescriptioncreated_atupdated_at です。バージョンでフィルタリングに使用できるフィールドは、tagaliascreated_atupdated_atmetadata です
Returns
registry イテレーター。

reports

View source

reports(
    path: str = "",
    name: Optional[str] = None,
    per_page: Optional[int] = 50
) -> "public.Reports"

指定された project パスの reports を取得します。

警告: この API はベータ版であり、将来のリリースで変更される可能性があります

Args
path (str) report が存在する project へのパス。形式は “entity/project” である必要があります
name (str, オプション) 要求された report のオプションの名前。
per_page (int) クエリ ページネーションのページ サイズを設定します。None を指定すると、デフォルト サイズが使用されます。通常、これを変更する理由はありません。
Returns
BetaReport オブジェクトの反復可能な collection である Reports オブジェクト。

run

View source

run(
    path=""
)

entity/project/run_id の形式でパスを解析して、単一の run を返します。

Args
path (str) entity/project/run_id の形式の run へのパス。api.entity が設定されている場合は、project/run_id の形式にすることができ、api.project が設定されている場合は、run_id のみにすることができます。
Returns
Run オブジェクト。

run_queue

View source

run_queue(
    entity, name
)

entity の名前付き RunQueue を返します。

新しい RunQueue を作成するには、wandb.Api().create_run_queue(...) を使用します。

runs

View source

runs(
    path: Optional[str] = None,
    filters: Optional[Dict[str, Any]] = None,
    order: str = "+created_at",
    per_page: int = 50,
    include_sweeps: bool = (True)
)

指定されたフィルターに一致する project から run のセットを返します。

フィルターできるフィールドには、次のものがあります。

  • createdAt: run が作成されたタイムスタンプ。(ISO 8601 形式、例: “2023-01-01T12:00:00Z”)
  • displayName: run の人間が判読できる表示名。(例: “eager-fox-1”)
  • duration: run の合計実行時間 (秒単位)。
  • group: 関連する run をまとめて整理するために使用されるグループ名。
  • host: run が実行されたホスト名。
  • jobType: run のジョブの種類または目的。
  • name: run の一意の識別子。(例: “a1b2cdef”)
  • state: run の現在の状態。
  • tags: run に関連付けられているタグ。
  • username: run を開始したユーザーのユーザー名

さらに、run config または summary metrics の項目でフィルタリングできます。 config.experiment_namesummary_metrics.loss など。

より複雑なフィルタリングを行うには、MongoDB クエリ演算子を使用できます。 詳細については、https://docs.mongodb.com/manual/reference/operator/query を参照してください。 次の操作がサポートされています。

  • $and
  • $or
  • $nor
  • $eq
  • $ne
  • $gt
  • $gte
  • $lt
  • $lte
  • $in
  • $nin
  • $exists
  • $regex

例:

config.experiment_name が “foo” に設定されている my_project で run を検索します

api.runs(
    path="my_entity/my_project",
    filters={"config.experiment_name": "foo"},
)

config.experiment_name が “foo” または “bar” に設定されている my_project で run を検索します

api.runs(
    path="my_entity/my_project",
    filters={
        "$or": [
            {"config.experiment_name": "foo"},
            {"config.experiment_name": "bar"},
        ]
    },
)

config.experiment_name が正規表現に一致する my_project で run を検索します (アンカーはサポートされていません)

api.runs(
    path="my_entity/my_project",
    filters={"config.experiment_name": {"$regex": "b.*"}},
)

run 名が正規表現に一致する my_project で run を検索します (アンカーはサポートされていません)

api.runs(
    path="my_entity/my_project",
    filters={"display_name": {"$regex": "^foo.*"}},
)

config.experiment に値 “testing” を持つネストされたフィールド “category” が含まれている my_project で run を検索します

api.runs(
    path="my_entity/my_project",
    filters={"config.experiment.category": "testing"},
)

summary metrics の model1 の下の辞書にネストされた損失値が 0.5 の my_project で run を検索します

api.runs(
    path="my_entity/my_project",
    filters={"summary_metrics.model1.loss": 0.5},
)

損失の昇順でソートされた my_project で run を検索します

api.runs(path="my_entity/my_project", order="+summary_metrics.loss")
Args
path (str) project へのパス。形式は “entity/project” である必要があります
filters (dict) MongoDB クエリ言語を使用して特定の run をクエリします。config.key、summary_metrics.key、state、entity、createdAt などの run プロパティでフィルタリングできます。たとえば、{"config.experiment_name": "foo"} は、experiment 名が “foo” に設定された config エントリを持つ run を検索します
order (str) 順序は、created_atheartbeat_atconfig.*.value、または summary_metrics.* にすることができます。順序の前に + を付けると、順序は昇順になります。順序の前に - を付けると、順序は降順になります (デフォルト)。デフォルトの順序は、run.created_at が最も古いものから最も新しいものになります。
per_page (int) クエリ ページネーションのページ サイズを設定します。
include_sweeps (bool) 結果に sweep runs を含めるかどうか。
Returns
Run オブジェクトの反復可能な collection である Runs オブジェクト。

sweep

View source

sweep(
    path=""
)

entity/project/sweep_id の形式でパスを解析して sweep を返します。

Args
path (str, optional) entity/project/sweep_id の形式の sweep へのパス。api.entity が設定されている場合は、project/sweep_id の形式にすることができ、api.project が設定されている場合は、sweep_id のみにすることができます。
Returns
Sweep オブジェクト。

sync_tensorboard

View source

sync_tensorboard(
    root_dir, run_id=None, project=None, entity=None
)

tfevent ファイルを含むローカル ディレクトリを wandb に同期します。

team

View source

team(
    team: str
) -> "public.Team"

指定された名前を持つ一致する Team を返します。

Args
team (str) team の名前。
Returns
Team オブジェクト。

upsert_run_queue

View source

upsert_run_queue(
    name: str,
    resource_config: dict,
    resource_type: "public.RunQueueResourceType",
    entity: Optional[str] = None,
    template_variables: Optional[dict] = None,
    external_links: Optional[dict] = None,
    prioritization_mode: Optional['public.RunQueuePrioritizationMode'] = None
)

run queue (Launch) をアップサートします。

Args
name (str) 作成する queue の名前
entity (str) queue を作成する entity のオプションの名前。None の場合、設定されたまたはデフォルトの entity が使用されます。
resource_config (dict) queue に使用するオプションのデフォルト リソース設定。handlebars (例: {{var}}) を使用してテンプレート変数を指定します。
resource_type (str) queue に使用するリソースの型。“local-container”、“local-process”、“kubernetes”、“sagemaker”、または “gcp-vertex” のいずれか。
template_variables (dict) config で使用するテンプレート変数スキーマの辞書。予期される形式: { "var-name": { "schema": { "type": ("string", "number", or "integer"), "default": (optional value), "minimum": (optional minimum), "maximum": (optional maximum), "enum": [..."(options)"] } } }
external_links (dict) queue で使用する外部リンクのオプションの辞書。予期される形式: { "name": "url" }
prioritization_mode (str) 使用する優先順位付けのオプションのバージョン。“V0” または None
Returns
アップサートされた RunQueue
Raises
パラメータが無効な場合は ValueError wandb API エラーの場合は wandb.Error

user

View source

user(
    username_or_email: str
) -> Optional['public.User']

ユーザー名またはメール アドレスからユーザーを返します。

注: この関数はローカル管理者に対してのみ機能します。自分のユーザー オブジェクトを取得しようとしている場合は、api.viewer を使用してください。

Args
username_or_email (str) ユーザーのユーザー名またはメール アドレス
Returns
User オブジェクト。ユーザーが見つからない場合は None

users

View source

users(
    username_or_email: str
) -> List['public.User']

部分的なユーザー名またはメール アドレス クエリからすべてのユーザーを返します。

注: この関数はローカル管理者に対してのみ機能します。自分のユーザー オブジェクトを取得しようとしている場合は、api.viewer を使用してください。

Args
username_or_email (str) 検索するユーザーのプレフィックスまたはサフィックス
Returns
User オブジェクトの配列
Class Variables
CREATE_PROJECT
DEFAULT_ENTITY_QUERY
USERS_QUERY
VIEWER_QUERY

2 - File

File は wandb によって保存されたファイルに関連付けられたクラスです。

File(
    client, attrs, run=None
)
Attributes
path_uri ストレージ バケット内のファイルへの URI パスを返します。

メソッド

delete

View source

delete()

display

View source

display(
    height=420, hidden=(False)
) -> bool

このオブジェクトを jupyter で表示します。

download

View source

download(
    root: str = ".",
    replace: bool = (False),
    exist_ok: bool = (False),
    api: Optional[Api] = None
) -> io.TextIOWrapper

以前に run によって保存されたファイルを wandb サーバー からダウンロードします。

Args
replace (boolean): True の場合、ダウンロードはローカル ファイルが存在する場合に上書きします。デフォルトは False です。 root (str): ファイルを保存するローカル ディレクトリー。デフォルトは “.” です。 exist_ok (boolean): True の場合、ファイルが既に存在する場合は ValueError を発生させず、replace=True でない限り再ダウンロードしません。デフォルトは False です。 api (Api, optional): 指定された場合、ファイルのダウンロードに使用される Api インスタンス。
Raises
ファイルが既に存在し、replace=False かつ exist_ok=False の場合、ValueError

snake_to_camel

View source

snake_to_camel(
    string
)

to_html

View source

to_html(
    *args, **kwargs
)

3 - Files

File オブジェクト のイテラブルなコレクション。

Files(
    client, run, names=None, per_page=50, upload=(False)
)
属性

メソッド

convert_objects

ソースを表示

convert_objects()

next

ソースを表示

next()

update_variables

ソースを表示

update_variables()

__getitem__

ソースを表示

__getitem__(
    index
)

__iter__

ソースを表示

__iter__()

__len__

ソースを表示

__len__()
クラス変数
QUERY

4 - Job

Job(
    api: "Api",
    name,
    path: Optional[str] = None
) -> None
属性

メソッド

call

ソースを表示

call(
    config, project=None, entity=None, queue=None, resource="local-container",
    resource_args=None, template_variables=None, project_queue=None, priority=None
)

set_entrypoint

ソースを表示

set_entrypoint(
    entrypoint: List[str]
)

5 - Project

Project とは、runs の名前空間です。

Project(
    client, entity, project, attrs
)
属性

メソッド

artifacts_types

View source

artifacts_types(
    per_page=50
)

display

View source

display(
    height=420, hidden=(False)
) -> bool

この object を jupyter で表示します。

snake_to_camel

View source

snake_to_camel(
    string
)

sweeps

View source

sweeps()

to_html

View source

to_html(
    height=420, hidden=(False)
)

この project を表示する iframe を含む HTML を生成します。

6 - Projects

Project オブジェクトの反復可能なコレクション。

Projects(
    client, entity, per_page=50
)
属性

メソッド

convert_objects

ソースを表示

convert_objects()

next

ソースを表示

next()

update_variables

ソースを表示

update_variables()

__getitem__

ソースを表示

__getitem__(
    index
)

__iter__

ソースを表示

__iter__()

__len__

ソースを表示

__len__()
クラス変数
QUERY

7 - QueuedRun

Entity と Project に関連付けられた、単一のキューに登録された run 。run にアクセスするには、run = queued_run.wait_until_running() または run = queued_run.wait_until_finished() を呼び出します。

QueuedRun(
    client, entity, project, queue_name, run_queue_item_id,
    project_queue=LAUNCH_DEFAULT_PROJECT, priority=None
)
Attributes

メソッド

delete

View source

delete(
    delete_artifacts=(False)
)

指定されたキューに登録された run を wandb バックエンドから削除します。

wait_until_finished

View source

wait_until_finished()

wait_until_running

View source

wait_until_running()

8 - Run

ある entity と project に関連付けられた単一の run。

Run(
    client: "RetryingClient",
    entity: str,
    project: str,
    run_id: str,
    attrs: Optional[Mapping] = None,
    include_sweeps: bool = (True)
)
Attributes

Methods

create

View source

@classmethod
create(
    api, run_id=None, project=None, entity=None
)

指定された project の run を作成します。

delete

View source

delete(
    delete_artifacts=(False)
)

指定された run を wandb バックエンドから削除します。

display

View source

display(
    height=420, hidden=(False)
) -> bool

このオブジェクトを jupyter で表示します。

file

View source

file(
    name
)

アーティファクト内の指定された名前のファイルのパスを返します。

Args
name (str): リクエストされたファイルの名前。
Returns
name 引数に一致する File

files

View source

files(
    names=None, per_page=50
)

名前が指定された各ファイルのファイルパスを返します。

Args
names (list): リクエストされたファイルの名前。空の場合、すべてのファイルを返します。 per_page (int): ページごとの結果数。
Returns
File オブジェクトのイテレーターである Files オブジェクト。

history

View source

history(
    samples=500, keys=None, x_axis="_step", pandas=(True), stream="default"
)

run のサンプルされた履歴メトリクスを返します。

履歴レコードのサンプリングが問題ない場合は、これを使用するとより簡単かつ高速になります。

Args
samples (int, optional) 返すサンプル数
pandas (bool, optional) pandas DataFrame を返します
keys (list, optional) 特定のキーのメトリクスのみを返します
x_axis (str, optional) このメトリクスを xAxis として使用します。デフォルトは _step です
stream (str, optional) メトリクスには “default”、マシンメトリクスには “system”
Returns
pandas.DataFrame pandas=True の場合、履歴メトリクスの pandas.DataFrame を返します。 dict のリスト: pandas=False の場合、履歴メトリクスの dict のリストを返します。

load

View source

load(
    force=(False)
)

log_artifact

View source

log_artifact(
    artifact: "wandb.Artifact",
    aliases: Optional[Collection[str]] = None,
    tags: Optional[Collection[str]] = None
)

アーティファクトを run の出力として宣言します。

Args
artifact (Artifact): wandb.Api().artifact(name) から返されたアーティファクト。 aliases (list, optional): このアーティファクトに適用するエイリアス。
tags (list, optional) このアーティファクトに適用するタグ (存在する場合)。
Returns
Artifact オブジェクト。

logged_artifacts

View source

logged_artifacts(
    per_page: int = 100
) -> public.RunArtifacts

この run によって記録されたすべてのアーティファクトをフェッチします。

run 中に記録されたすべての出力 Artifacts を取得します。反復処理したり、単一のリストに収集したりできるページ分割された結果を返します。

Args
per_page API リクエストごとにフェッチする Artifacts の数。
Returns
この run 中に出力として記録されたすべての Artifact オブジェクトの反復可能なコレクション。

Example:

>>> import wandb
>>> import tempfile
>>> with tempfile.NamedTemporaryFile(
...     mode="w", delete=False, suffix=".txt"
... ) as tmp:
...     tmp.write("This is a test artifact")
...     tmp_path = tmp.name
>>> run = wandb.init(project="artifact-example")
>>> artifact = wandb.Artifact("test_artifact", type="dataset")
>>> artifact.add_file(tmp_path)
>>> run.log_artifact(artifact)
>>> run.finish()
>>> api = wandb.Api()
>>> finished_run = api.run(f"{run.entity}/{run.project}/{run.id}")
>>> for logged_artifact in finished_run.logged_artifacts():
...     print(logged_artifact.name)
test_artifact

save

View source

save()

scan_history

View source

scan_history(
    keys=None, page_size=1000, min_step=None, max_step=None
)

run のすべての履歴レコードの反復可能なコレクションを返します。

Example:

サンプル run のすべての損失値をエクスポートします。

run = api.run("l2k2/examples-numpy-boston/i0wt6xua")
history = run.scan_history(keys=["Loss"])
losses = [row["Loss"] for row in history]
Args
keys ([str], optional): これらのキーのみをフェッチし、すべてのキーが定義されている行のみをフェッチします。 page_size (int, optional): API からフェッチするページのサイズ。 min_step (int, optional): 一度にスキャンする最小ページ数。 max_step (int, optional): 一度にスキャンする最大ページ数。
Returns
履歴レコード (dict) の反復可能なコレクション。

snake_to_camel

View source

snake_to_camel(
    string
)

to_html

View source

to_html(
    height=420, hidden=(False)
)

この run を表示する iframe を含む HTML を生成します。

update

View source

update()

run オブジェクトへの変更を wandb バックエンドに永続化します。

upload_file

View source

upload_file(
    path, root="."
)

ファイルをアップロードします。

Args
path (str): アップロードするファイルの名前。 root (str): ファイルを相対的に保存するルートパス。 例: ファイルを run に “my_dir/file.txt” として保存し、現在 “my_dir” にいる場合は、root を “../” に設定します。
Returns
name 引数に一致する File

use_artifact

View source

use_artifact(
    artifact, use_as=None
)

アーティファクトを run への入力として宣言します。

Args
artifact (Artifact): wandb.Api().artifact(name) から返されたアーティファクト use_as (string, optional): スクリプトでアーティファクトがどのように使用されるかを識別する文字列。 ベータ版の wandb launch 機能のアーティファクトスワップ機能を使用する場合に、run で使用されるアーティファクトを簡単に区別するために使用されます。
Returns
Artifact オブジェクト。

used_artifacts

View source

used_artifacts(
    per_page: int = 100
) -> public.RunArtifacts

この run で明示的に使用されている Artifacts をフェッチします。

通常は run.use_artifact() を介して、run 中に使用されたと明示的に宣言された入力 Artifacts のみを取得します。反復処理したり、単一のリストに収集したりできるページ分割された結果を返します。

Args
per_page API リクエストごとにフェッチする Artifacts の数。
Returns
この run で入力として明示的に使用される Artifact オブジェクトの反復可能なコレクション。

Example:

>>> import wandb
>>> run = wandb.init(project="artifact-example")
>>> run.use_artifact("test_artifact:latest")
>>> run.finish()
>>> api = wandb.Api()
>>> finished_run = api.run(f"{run.entity}/{run.project}/{run.id}")
>>> for used_artifact in finished_run.used_artifacts():
...     print(used_artifact.name)
test_artifact

wait_until_finished

View source

wait_until_finished()

9 - RunQueue

RunQueue(
    client: "RetryingClient",
    name: str,
    entity: str,
    prioritization_mode: Optional[RunQueuePrioritizationMode] = None,
    _access: Optional[RunQueueAccessType] = None,
    _default_resource_config_id: Optional[int] = None,
    _default_resource_config: Optional[dict] = None
) -> None
Attributes
items 最初の100個までのキューに入った run 。このリストを変更しても、キューやキューに入ったアイテムは変更されません!

メソッド

create

View source

@classmethod
create(
    name: str,
    resource: "RunQueueResourceType",
    entity: Optional[str] = None,
    prioritization_mode: Optional['RunQueuePrioritizationMode'] = None,
    config: Optional[dict] = None,
    template_variables: Optional[dict] = None
) -> "RunQueue"

delete

View source

delete()

wandb バックエンドから run キューを削除します。

10 - Runs

project とオプションのフィルターに関連付けられた、反復可能な Runs のコレクション。

Runs(
    client: "RetryingClient",
    entity: str,
    project: str,
    filters: Optional[Dict[str, Any]] = None,
    order: Optional[str] = None,
    per_page: int = 50,
    include_sweeps: bool = (True)
)

これは通常、Api.runs メソッドを介して間接的に使用されます。

属性

メソッド

convert_objects

View source

convert_objects()

histories

View source

histories(
    samples: int = 500,
    keys: Optional[List[str]] = None,
    x_axis: str = "_step",
    format: Literal['default', 'pandas', 'polars'] = "default",
    stream: Literal['default', 'system'] = "default"
)

フィルター条件に適合するすべての run のサンプリングされた履歴 メトリクス を返します。

arg
samples (int, optional) run ごとに返すサンプル数
keys (list[str], optional) 特定の キー の メトリクス のみを返します
x_axis (str, optional) この メトリクス を xAxis のデフォルトとして使用します。_step
format (Literal, optional) データを返す形式。オプションは “default”、“pandas”、“polars”
stream (Literal, optional) メトリクス の場合は “default”、マシン メトリクス の場合は “system”
戻り値
pandas.DataFrame format=“pandas” の場合、履歴 メトリクス の pandas.DataFrame を返します。
polars.DataFrame format=“polars” の場合、履歴 メトリクス の polars.DataFrame を返します。dicts のリスト: format=“default” の場合、run_id キー を含む履歴 メトリクス を含む dict のリストを返します。

next

View source

next()

update_variables

View source

update_variables()

__getitem__

View source

__getitem__(
    index
)

__iter__

View source

__iter__()

__len__

View source

__len__()
クラス変数
QUERY

11 - Sweep

sweep に関連付けられた一連の Runs。

Sweep(
    client, entity, project, sweep_id, attrs=None
)

例:

以下でインスタンス化します:

api = wandb.Api()
sweep = api.sweep(path / to / sweep)
属性
runs (Runs) Runs のリスト
id (str) sweep ID
project (str) project 名
config (str) sweep configuration の辞書
state (str) sweep の状態
expected_run_count (int) sweep に予想される Runs の数

メソッド

best_run

ソースを表示

best_run(
    order=None
)

config で定義されたメトリックまたは渡された順序でソートされた最適な Run を返します。

display

ソースを表示

display(
    height=420, hidden=(False)
) -> bool

このオブジェクトを jupyter で表示します。

get

ソースを表示

@classmethod
get(
    client, entity=None, project=None, sid=None, order=None, query=None, **kwargs
)

クラウドバックエンドに対してクエリを実行します。

load

ソースを表示

load(
    force: bool = (False)
)

snake_to_camel

ソースを表示

snake_to_camel(
    string
)

to_html

ソースを表示

to_html(
    height=420, hidden=(False)
)

この sweep を表示する iframe を含む HTML を生成します。

クラス変数
LEGACY_QUERY
QUERY