diff --git a/docs.json b/docs.json index cd8f22bc94..e033d6c7cd 100644 --- a/docs.json +++ b/docs.json @@ -952,14 +952,44 @@ "group": "Data Types", "pages": [ "models/ref/python/data-types", - "models/ref/python/data-types/audio", + { + "group": "Audio", + "root": "models/ref/python/data-types/audio", + "pages": [ + "models/ref/python/data-types/audio/audio-methods" + ] + }, "models/ref/python/data-types/histogram", "models/ref/python/data-types/html", - "models/ref/python/data-types/image", - "models/ref/python/data-types/molecule", - "models/ref/python/data-types/object3d", + { + "group": "Image", + "root": "models/ref/python/data-types/image", + "pages": [ + "models/ref/python/data-types/image/image-properties" + ] + }, + { + "group": "Molecule", + "root": "models/ref/python/data-types/molecule", + "pages": [ + "models/ref/python/data-types/molecule/molecule-methods" + ] + }, + { + "group": "Object3D", + "root": "models/ref/python/data-types/object3d", + "pages": [ + "models/ref/python/data-types/object3d/object3d-methods" + ] + }, "models/ref/python/data-types/plotly", - "models/ref/python/data-types/table", + { + "group": "Table", + "root": "models/ref/python/data-types/table", + "pages": [ + "models/ref/python/data-types/table/table-methods" + ] + }, "models/ref/python/data-types/video" ] }, @@ -967,9 +997,30 @@ "group": "Experiments", "pages": [ "models/ref/python/experiments", - "models/ref/python/experiments/artifact", - "models/ref/python/experiments/run", - "models/ref/python/experiments/settings", + { + "group": "Artifact", + "root": "models/ref/python/experiments/artifact", + "pages": [ + "models/ref/python/experiments/artifact/artifact-properties", + "models/ref/python/experiments/artifact/artifact-methods" + ] + }, + { + "group": "Run", + "root": "models/ref/python/experiments/run", + "pages": [ + "models/ref/python/experiments/run/run-properties", + "models/ref/python/experiments/run/run-methods" + ] + }, + { + "group": "Settings", + "root": "models/ref/python/experiments/settings", + "pages": [ + "models/ref/python/experiments/settings/settings-properties", + "models/ref/python/experiments/settings/settings-methods" + ] + }, "models/ref/python/experiments/system-metrics" ] }, @@ -980,11 +1031,23 @@ "models/ref/python/automations/automation", "models/ref/python/automations/donothing", "models/ref/python/public-api/downloadhistoryresult", - "models/ref/python/public-api/incompleterunhistoryerror", + { + "group": "IncompleteRunHistoryError", + "root": "models/ref/python/public-api/incompleterunhistoryerror", + "pages": [ + "models/ref/python/public-api/incompleterunhistoryerror/incompleterunhistoryerror-methods" + ] + }, "models/ref/python/automations/metricchangefilter", "models/ref/python/automations/metriczscorefilter", "models/ref/python/automations/metricthresholdfilter", - "models/ref/python/automations/newautomation", + { + "group": "NewAutomation", + "root": "models/ref/python/automations/newautomation", + "pages": [ + "models/ref/python/automations/newautomation/newautomation-properties" + ] + }, "models/ref/python/automations/onaddartifactalias", "models/ref/python/automations/onaddartifacttag", "models/ref/python/automations/onaddcollectiontag", @@ -996,8 +1059,20 @@ "models/ref/python/automations/onrunstate", "models/ref/python/automations/onunlinkartifact", "models/ref/python/automations/runstatefilter", - "models/ref/python/automations/sendnotification", - "models/ref/python/automations/sendwebhook" + { + "group": "SendNotification", + "root": "models/ref/python/automations/sendnotification", + "pages": [ + "models/ref/python/automations/sendnotification/sendnotification-methods" + ] + }, + { + "group": "SendWebhook", + "root": "models/ref/python/automations/sendwebhook", + "pages": [ + "models/ref/python/automations/sendwebhook/sendwebhook-methods" + ] + } ] }, { @@ -1019,30 +1094,179 @@ "group": "Public API", "pages": [ "models/ref/python/public-api", - "models/ref/python/public-api/api", - "models/ref/python/public-api/artifactcollection", - "models/ref/python/public-api/artifactcollections", - "models/ref/python/public-api/artifactfiles", - "models/ref/python/public-api/artifacts", - "models/ref/python/public-api/artifacttype", - "models/ref/python/public-api/artifacttypes", - "models/ref/python/public-api/betareport", - "models/ref/python/public-api/file", - "models/ref/python/public-api/files", - "models/ref/python/public-api/member", + { + "group": "Api", + "root": "models/ref/python/public-api/api", + "pages": [ + "models/ref/python/public-api/api/api-properties", + "models/ref/python/public-api/api/api-methods" + ] + }, + { + "group": "ArtifactCollection", + "root": "models/ref/python/public-api/artifactcollection", + "pages": [ + "models/ref/python/public-api/artifactcollection/artifactcollection-properties", + "models/ref/python/public-api/artifactcollection/artifactcollection-methods" + ] + }, + { + "group": "ArtifactCollections", + "root": "models/ref/python/public-api/artifactcollections", + "pages": [ + "models/ref/python/public-api/artifactcollections/artifactcollections-methods" + ] + }, + { + "group": "ArtifactFiles", + "root": "models/ref/python/public-api/artifactfiles", + "pages": [ + "models/ref/python/public-api/artifactfiles/artifactfiles-properties", + "models/ref/python/public-api/artifactfiles/artifactfiles-methods" + ] + }, + { + "group": "Artifacts", + "root": "models/ref/python/public-api/artifacts", + "pages": [ + "models/ref/python/public-api/artifacts/artifacts-methods" + ] + }, + { + "group": "ArtifactType", + "root": "models/ref/python/public-api/artifacttype", + "pages": [ + "models/ref/python/public-api/artifacttype/artifacttype-properties", + "models/ref/python/public-api/artifacttype/artifacttype-methods" + ] + }, + { + "group": "ArtifactTypes", + "root": "models/ref/python/public-api/artifacttypes", + "pages": [ + "models/ref/python/public-api/artifacttypes/artifacttypes-methods" + ] + }, + { + "group": "BetaReport", + "root": "models/ref/python/public-api/betareport", + "pages": [ + "models/ref/python/public-api/betareport/betareport-properties", + "models/ref/python/public-api/betareport/betareport-methods" + ] + }, + { + "group": "File", + "root": "models/ref/python/public-api/file", + "pages": [ + "models/ref/python/public-api/file/file-properties", + "models/ref/python/public-api/file/file-methods" + ] + }, + { + "group": "Files", + "root": "models/ref/python/public-api/files", + "pages": [ + "models/ref/python/public-api/files/files-methods" + ] + }, + { + "group": "Member", + "root": "models/ref/python/public-api/member", + "pages": [ + "models/ref/python/public-api/member/member-methods" + ] + }, "models/ref/python/public-api/organization", - "models/ref/python/public-api/project", - "models/ref/python/public-api/projects", - "models/ref/python/public-api/projectartifactcollections", - "models/ref/python/public-api/registry", - "models/ref/python/public-api/reports", - "models/ref/python/public-api/run", - "models/ref/python/public-api/runartifacts", - "models/ref/python/public-api/runs", - "models/ref/python/public-api/sweep", - "models/ref/python/public-api/sweeps", - "models/ref/python/public-api/team", - "models/ref/python/public-api/user" + { + "group": "Project", + "root": "models/ref/python/public-api/project", + "pages": [ + "models/ref/python/public-api/project/project-properties", + "models/ref/python/public-api/project/project-methods" + ] + }, + { + "group": "Projects", + "root": "models/ref/python/public-api/projects", + "pages": [ + "models/ref/python/public-api/projects/projects-methods" + ] + }, + { + "group": "ProjectArtifactCollections", + "root": "models/ref/python/public-api/projectartifactcollections", + "pages": [ + "models/ref/python/public-api/projectartifactcollections/projectartifactcollections-methods" + ] + }, + { + "group": "Registry", + "root": "models/ref/python/public-api/registry", + "pages": [ + "models/ref/python/public-api/registry/registry-properties", + "models/ref/python/public-api/registry/registry-methods" + ] + }, + { + "group": "Reports", + "root": "models/ref/python/public-api/reports", + "pages": [ + "models/ref/python/public-api/reports/reports-methods" + ] + }, + { + "group": "Run", + "root": "models/ref/python/public-api/run", + "pages": [ + "models/ref/python/public-api/run/run-properties", + "models/ref/python/public-api/run/run-methods" + ] + }, + { + "group": "RunArtifacts", + "root": "models/ref/python/public-api/runartifacts", + "pages": [ + "models/ref/python/public-api/runartifacts/runartifacts-methods" + ] + }, + { + "group": "Runs", + "root": "models/ref/python/public-api/runs", + "pages": [ + "models/ref/python/public-api/runs/runs-methods" + ] + }, + { + "group": "Sweep", + "root": "models/ref/python/public-api/sweep", + "pages": [ + "models/ref/python/public-api/sweep/sweep-properties", + "models/ref/python/public-api/sweep/sweep-methods" + ] + }, + { + "group": "Sweeps", + "root": "models/ref/python/public-api/sweeps", + "pages": [ + "models/ref/python/public-api/sweeps/sweeps-methods" + ] + }, + { + "group": "Team", + "root": "models/ref/python/public-api/team", + "pages": [ + "models/ref/python/public-api/team/team-methods" + ] + }, + { + "group": "User", + "root": "models/ref/python/public-api/user", + "pages": [ + "models/ref/python/public-api/user/user-properties", + "models/ref/python/public-api/user/user-methods" + ] + } ] } ] @@ -7619,4 +7843,4 @@ "stylesheet": "/css/styles.css" }, "theme": "aspen" -} \ No newline at end of file +} diff --git a/models/ref/python/automations/automation.mdx b/models/ref/python/automations/automation.mdx index e774957b04..c25ba020ea 100644 --- a/models/ref/python/automations/automation.mdx +++ b/models/ref/python/automations/automation.mdx @@ -7,11 +7,18 @@ namespace: wandb.automations.automations import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + + + + +## Class wandb.automations.Automation + + + +A local instance of a saved W&B automation that supports editing. -## class wandb.automations.Automation ```python *, __typename: Literal['Trigger'] = 'Trigger', @@ -21,33 +28,48 @@ updatedAt: datetime.datetime | None = None, name: str, description: str | None, enabled: bool, -scope: Annotated[Union[wandb.automations.scopes._ArtifactSequenceScope, wandb.automations.scopes._ArtifactPortfolioScope, wandb.automations.scopes.ProjectScope, Annotated[wandb.automations.scopes.TeamScope | wandb.automations.scopes.OrgScope, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), Discriminator(discriminator='entity_type', custom_error_type=None, custom_error_message=None, custom_error_context=None)]], BeforeValidator(func=, json_schema_input_type=PydanticUndefined), Discriminator(discriminator='typename__', custom_error_type=None, custom_error_message=None, custom_error_context=None)], +scope: Annotated[wandb.automations.scopes._ArtifactSequenceScope | wandb.automations.scopes._ArtifactPortfolioScope | wandb.automations.scopes.ProjectScope, BeforeValidator(func=, json_schema_input_type=PydanticUndefined)], event: wandb.automations.events.SavedEvent, action: Annotated[wandb.automations.actions.SavedLaunchJobAction | wandb.automations.actions.SavedNotificationAction | wandb.automations.actions.SavedWebhookAction | wandb.automations.actions.SavedNoOpAction, BeforeValidator(func=, json_schema_input_type=PydanticUndefined)] ``` +## Args + -A local instance of a saved W&B automation that supports editing. + + +The date and time when this automation was created. + + +The date and time when this automation was last updated, if applicable. + -## Args - -- `id`: -- `createdAt`: The date and time when this automation was created. -- `updatedAt`: The date and time when this automation was last updated, if applicable. -- `name`: The name of this automation. -- `description`: An optional description of this automation. -- `enabled`: Whether this automation is enabled. Only enabled automations will trigger. -- `scope`: The scope in which the triggering event must occur. -- `event`: The event that will trigger this automation. -- `action`: The action that will execute when this automation is triggered. + +The name of this automation. + + +An optional description of this automation. + + +Whether this automation is enabled. Only enabled automations will trigger. + + +The scope in which the triggering event must occur. + + +The event that will trigger this automation. + + +The action that will execute when this automation is triggered. + diff --git a/models/ref/python/automations/donothing.mdx b/models/ref/python/automations/donothing.mdx index 88a31471d9..5156cb243b 100644 --- a/models/ref/python/automations/donothing.mdx +++ b/models/ref/python/automations/donothing.mdx @@ -7,16 +7,11 @@ namespace: wandb.automations.actions import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.automations.DoNothing -```python -*, -no_op: Annotated[bool, BeforeValidator(func=, json_schema_input_type=PydanticUndefined)] = True, -action_type: Literal[NO_OP] = NO_OP -``` +## Class wandb.automations.DoNothing @@ -24,17 +19,23 @@ Defines an automation action that intentionally does nothing. -## Args - -- `no_op`: Placeholder field which exists only to satisfy backend schema requirements. - - There should never be a need to set this field explicitly, as its value is ignored. -- `action_type`: +```python +*, +no_op: Annotated[bool, BeforeValidator(func=, json_schema_input_type=PydanticUndefined)] = True, +action_type: Literal[NO_OP] = NO_OP +``` +## Args + +Placeholder field which exists only to satisfy backend schema requirements. +There should never be a need to set this field explicitly, as its value is ignored. + + + diff --git a/models/ref/python/automations/metricchangefilter.mdx b/models/ref/python/automations/metricchangefilter.mdx index 2e405651e1..bb82c4e83d 100644 --- a/models/ref/python/automations/metricchangefilter.mdx +++ b/models/ref/python/automations/metricchangefilter.mdx @@ -1,55 +1,74 @@ --- title: MetricChangeFilter kind: class -namespace: wandb.automations._run_metric_filters +namespace: wandb.automations._filters.run_metrics --- import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + + + + +## Class wandb.automations.MetricChangeFilter + + + +Filter that compares a **change** in a metric value to a user-defined threshold. + +The change is calculated over "tumbling" windows, i.e. the difference +between the current window and the non-overlapping prior window. -## class wandb.automations.MetricChangeFilter ```python *, name: str, -agg_op: wandb.automations._run_metric_filters.Agg | None = None, +agg_op: wandb.automations._filters.run_metrics.Agg | None = None, current_window_size: Annotated[int, Gt(gt=0)] = 1, cmp: NoneType = None, change_amount: Union[Annotated[int, Gt(gt=0)], Annotated[float, Gt(gt=0)]], prior_window_size: Annotated[int, Gt(gt=0)] = , -change_type: wandb.automations._run_metric_filters.ChangeType, -change_dir: wandb.automations._run_metric_filters.ChangeDir +change_type: wandb.automations._filters.run_metrics.ChangeType, +change_dir: wandb.automations._filters.run_metrics.ChangeDir ``` +## Args + -Filter that compares a **change** in a metric value to a user-defined threshold. + -The change is calculated over "tumbling" windows, i.e. the difference -between the current window and the non-overlapping prior window. + + + -## Args + + + +Ignored. + + + -- `name`: -- `agg_op`: -- `current_window_size`: -- `cmp`: Ignored. -- `change_amount`: -- `prior_window_size`: Size of the "prior" metric aggregation window (ignored if `agg` is ``None``). + - If omitted, defaults to the size of the current window. -- `change_type`: -- `change_dir`: + +Size of the "prior" metric aggregation window (ignored if `agg` is ``None``). +If omitted, defaults to the size of the current window. + + + + + diff --git a/models/ref/python/automations/metricthresholdfilter.mdx b/models/ref/python/automations/metricthresholdfilter.mdx index a15f89af71..fa405320fc 100644 --- a/models/ref/python/automations/metricthresholdfilter.mdx +++ b/models/ref/python/automations/metricthresholdfilter.mdx @@ -1,25 +1,17 @@ --- title: MetricThresholdFilter kind: class -namespace: wandb.automations._run_metric_filters +namespace: wandb.automations._filters.run_metrics --- import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.automations.MetricThresholdFilter -```python -*, -name: str, -agg_op: wandb.automations._run_metric_filters.Agg | None = None, -window_size: Annotated[int, Gt(gt=0)] = 1, -cmp_op: Literal['$gte', '$gt', '$lt', '$lte'], -threshold: Union[Annotated[int, Strict(strict=True)], Annotated[float, Strict(strict=True)]] -``` +## Class wandb.automations.MetricThresholdFilter @@ -30,18 +22,36 @@ multiple values. +```python +*, +name: str, +agg_op: wandb.automations._filters.run_metrics.Agg | None = None, +window_size: Annotated[int, Gt(gt=0)] = 1, +cmp_op: Literal['$gte', '$gt', '$lt', '$lte'], +threshold: Union[Annotated[int, Strict(strict=True)], Annotated[float, Strict(strict=True)]] +``` + ## Args -- `name`: -- `agg_op`: -- `window_size`: -- `cmp_op`: Comparison operator between the metric value (left) vs. the threshold (right). -- `threshold`: + + + + + + + + + + +Comparison operator between the metric value (left) vs. the threshold (right). + + + diff --git a/models/ref/python/automations/metriczscorefilter.mdx b/models/ref/python/automations/metriczscorefilter.mdx index e0de33816c..24ae47c0d3 100644 --- a/models/ref/python/automations/metriczscorefilter.mdx +++ b/models/ref/python/automations/metriczscorefilter.mdx @@ -1,24 +1,17 @@ --- title: MetricZScoreFilter kind: class -namespace: wandb.automations._run_metric_filters +namespace: wandb.automations._filters.run_metrics --- import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.automations.MetricZScoreFilter -```python -*, -name: str, -window_size: Annotated[int, Gt(gt=0)] = 30, -threshold: Union[Annotated[int, Gt(gt=0)], Annotated[float, Gt(gt=0)]] = 3.0, -change_dir: wandb.automations._run_metric_filters.ChangeDir = ANY -``` +## Class wandb.automations.MetricZScoreFilter @@ -26,17 +19,31 @@ Filter that compares a metric's z-score against a user-defined threshold. -## Args - -- `name`: Name of the observed metric. -- `window_size`: Size of the window to calculate the metric mean and standard deviation over. -- `threshold`: Threshold for the z-score. -- `change_dir`: Direction of the z-score change to watch for. +```python +*, +name: str, +window_size: Annotated[int, Gt(gt=0)] = 30, +threshold: Union[Annotated[int, Gt(gt=0)], Annotated[float, Gt(gt=0)]] = 3.0, +change_dir: wandb.automations._filters.run_metrics.ChangeDir = ANY +``` +## Args + +Name of the observed metric. + + +Size of the window to calculate the metric mean and standard deviation over. + + +Threshold for the z-score. + + +Direction of the z-score change to watch for. + diff --git a/models/ref/python/automations/newautomation.mdx b/models/ref/python/automations/newautomation.mdx index d32118a17f..8a65e85341 100644 --- a/models/ref/python/automations/newautomation.mdx +++ b/models/ref/python/automations/newautomation.mdx @@ -7,11 +7,18 @@ namespace: wandb.automations.automations import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + + + + +## Class wandb.automations.NewAutomation + + + +A new automation to be created. -## class wandb.automations.NewAutomation ```python *, name: str | None = None, @@ -21,30 +28,27 @@ event: Optional[Annotated[wandb.automations.events.OnLinkArtifact | wandb.automa action: Optional[Annotated[wandb.automations.actions.SendNotification | wandb.automations.actions.SendWebhook | wandb.automations.actions.DoNothing, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), FieldInfo(annotation=NoneType, required=True, discriminator='action_type')]] = None ``` - - -A new automation to be created. - - - ## Args -- `name`: The name of this automation. -- `description`: An optional description of this automation. -- `enabled`: Whether this automation is enabled. Only enabled automations will trigger. -- `event`: The event that will trigger this automation. -- `action`: The action that will execute when this automation is triggered. - - - - + +The name of this automation. + + +An optional description of this automation. + -## Properties + +Whether this automation is enabled. Only enabled automations will trigger. + -### property scope + +The event that will trigger this automation. + -The scope in which the triggering event must occur. + +The action that will execute when this automation is triggered. + diff --git a/models/ref/python/automations/newautomation/newautomation-properties.mdx b/models/ref/python/automations/newautomation/newautomation-properties.mdx new file mode 100644 index 0000000000..bcb4b82d2f --- /dev/null +++ b/models/ref/python/automations/newautomation/newautomation-properties.mdx @@ -0,0 +1,15 @@ +--- +title: NewAutomation properties +sidebarTitle: Properties +page_kind: class-properties +parent_slug: newautomation +kind: class +namespace: wandb.automations.automations +--- + +## Class wandb.automations.NewAutomation + +## property scope + +The scope in which the triggering event must occur. + diff --git a/models/ref/python/automations/onaddartifactalias.mdx b/models/ref/python/automations/onaddartifactalias.mdx index 99d1f4ca64..51f10cdf51 100644 --- a/models/ref/python/automations/onaddartifactalias.mdx +++ b/models/ref/python/automations/onaddartifactalias.mdx @@ -7,17 +7,11 @@ namespace: wandb.automations.events import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.automations.OnAddArtifactAlias -```python -*, -event_type: Literal[ADD_ARTIFACT_ALIAS] = ADD_ARTIFACT_ALIAS, -scope: Annotated[Union[wandb.automations.scopes._ArtifactSequenceScope, wandb.automations.scopes._ArtifactPortfolioScope, wandb.automations.scopes.ProjectScope, Annotated[wandb.automations.scopes.TeamScope | wandb.automations.scopes.OrgScope, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), Discriminator(discriminator='entity_type', custom_error_type=None, custom_error_message=None, custom_error_context=None)]], BeforeValidator(func=, json_schema_input_type=PydanticUndefined), Discriminator(discriminator='typename__', custom_error_type=None, custom_error_message=None, custom_error_context=None)], -filter: Annotated[wandb.automations._filters.operators.And | wandb.automations._filters.operators.Or | wandb.automations._filters.operators.Nor | wandb.automations._filters.operators.Not | wandb.automations._filters.operators.Lt | wandb.automations._filters.operators.Gt | wandb.automations._filters.operators.Lte | wandb.automations._filters.operators.Gte | wandb.automations._filters.operators.Eq | wandb.automations._filters.operators.Ne | wandb.automations._filters.operators.In | wandb.automations._filters.operators.NotIn | wandb.automations._filters.operators.Exists | wandb.automations._filters.operators.Regex | wandb.automations._filters.operators.Contains | wandb.automations._filters.operators.Size | wandb.automations._filters.operators.All | wandb.automations._filters.expressions.FilterExpr | dict[str, Any], Json, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), PlainSerializer(func=, return_type=PydanticUndefined, when_used='always'), AfterValidator(func=)] = And(()) -``` +## Class wandb.automations.OnAddArtifactAlias @@ -25,12 +19,26 @@ A new alias is assigned to an artifact. +```python +*, +event_type: Literal[ADD_ARTIFACT_ALIAS] = ADD_ARTIFACT_ALIAS, +scope: Annotated[wandb.automations.scopes._ArtifactSequenceScope | wandb.automations.scopes._ArtifactPortfolioScope | wandb.automations.scopes.ProjectScope, BeforeValidator(func=, json_schema_input_type=PydanticUndefined)], +filter: Annotated[wandb.automations._filters.operators.And | wandb.automations._filters.operators.Or | wandb.automations._filters.operators.Nor | wandb.automations._filters.operators.Not | wandb.automations._filters.operators.Lt | wandb.automations._filters.operators.Gt | wandb.automations._filters.operators.Lte | wandb.automations._filters.operators.Gte | wandb.automations._filters.operators.Eq | wandb.automations._filters.operators.Ne | wandb.automations._filters.operators.In | wandb.automations._filters.operators.NotIn | wandb.automations._filters.operators.Exists | wandb.automations._filters.operators.Regex | wandb.automations._filters.operators.Contains | wandb.automations._filters.expressions.FilterExpr | dict[str, Any], Json, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), PlainSerializer(func=, return_type=PydanticUndefined, when_used='always'), AfterValidator(func=)] = And(()) +``` + ## Args -- `event_type`: -- `scope`: The scope of the event. -- `filter`: Additional conditions(s), if any, that are required for this event to trigger. + + + + +The scope of the event. + + + +Additional conditions(s), if any, that are required for this event to trigger. + @@ -52,7 +60,3 @@ event = OnAddArtifactAlias( ) ``` - - - - diff --git a/models/ref/python/automations/onaddartifacttag.mdx b/models/ref/python/automations/onaddartifacttag.mdx index 2ebf658cc8..a7debf9086 100644 --- a/models/ref/python/automations/onaddartifacttag.mdx +++ b/models/ref/python/automations/onaddartifacttag.mdx @@ -7,17 +7,11 @@ namespace: wandb.automations.events import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.automations.OnAddArtifactTag -```python -*, -event_type: Literal[ADD_ARTIFACT_TAG] = ADD_ARTIFACT_TAG, -scope: Annotated[Union[wandb.automations.scopes._ArtifactSequenceScope, wandb.automations.scopes._ArtifactPortfolioScope, wandb.automations.scopes.ProjectScope, Annotated[wandb.automations.scopes.TeamScope | wandb.automations.scopes.OrgScope, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), Discriminator(discriminator='entity_type', custom_error_type=None, custom_error_message=None, custom_error_context=None)]], BeforeValidator(func=, json_schema_input_type=PydanticUndefined), Discriminator(discriminator='typename__', custom_error_type=None, custom_error_message=None, custom_error_context=None)], -filter: Annotated[wandb.automations._filters.operators.And | wandb.automations._filters.operators.Or | wandb.automations._filters.operators.Nor | wandb.automations._filters.operators.Not | wandb.automations._filters.operators.Lt | wandb.automations._filters.operators.Gt | wandb.automations._filters.operators.Lte | wandb.automations._filters.operators.Gte | wandb.automations._filters.operators.Eq | wandb.automations._filters.operators.Ne | wandb.automations._filters.operators.In | wandb.automations._filters.operators.NotIn | wandb.automations._filters.operators.Exists | wandb.automations._filters.operators.Regex | wandb.automations._filters.operators.Contains | wandb.automations._filters.operators.Size | wandb.automations._filters.operators.All | wandb.automations._filters.expressions.FilterExpr | dict[str, Any], Json, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), PlainSerializer(func=, return_type=PydanticUndefined, when_used='always'), AfterValidator(func=)] = And(()) -``` +## Class wandb.automations.OnAddArtifactTag @@ -25,12 +19,26 @@ A new tag is assigned to an artifact version. +```python +*, +event_type: Literal[ADD_ARTIFACT_TAG] = ADD_ARTIFACT_TAG, +scope: Annotated[wandb.automations.scopes._ArtifactSequenceScope | wandb.automations.scopes._ArtifactPortfolioScope | wandb.automations.scopes.ProjectScope, BeforeValidator(func=, json_schema_input_type=PydanticUndefined)], +filter: Annotated[wandb.automations._filters.operators.And | wandb.automations._filters.operators.Or | wandb.automations._filters.operators.Nor | wandb.automations._filters.operators.Not | wandb.automations._filters.operators.Lt | wandb.automations._filters.operators.Gt | wandb.automations._filters.operators.Lte | wandb.automations._filters.operators.Gte | wandb.automations._filters.operators.Eq | wandb.automations._filters.operators.Ne | wandb.automations._filters.operators.In | wandb.automations._filters.operators.NotIn | wandb.automations._filters.operators.Exists | wandb.automations._filters.operators.Regex | wandb.automations._filters.operators.Contains | wandb.automations._filters.expressions.FilterExpr | dict[str, Any], Json, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), PlainSerializer(func=, return_type=PydanticUndefined, when_used='always'), AfterValidator(func=)] = And(()) +``` + ## Args -- `event_type`: -- `scope`: The scope of the event. -- `filter`: Additional conditions(s), if any, that are required for this event to trigger. + + + + +The scope of the event. + + + +Additional conditions(s), if any, that are required for this event to trigger. + @@ -52,7 +60,3 @@ event = OnAddArtifactTag( ) ``` - - - - diff --git a/models/ref/python/automations/onaddcollectiontag.mdx b/models/ref/python/automations/onaddcollectiontag.mdx index 191d1be7d1..52d08d6bd9 100644 --- a/models/ref/python/automations/onaddcollectiontag.mdx +++ b/models/ref/python/automations/onaddcollectiontag.mdx @@ -7,17 +7,11 @@ namespace: wandb.automations.events import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.automations.OnAddCollectionTag -```python -*, -event_type: Literal[ADD_COLLECTION_TAG] = ADD_COLLECTION_TAG, -scope: Annotated[Union[wandb.automations.scopes._ArtifactSequenceScope, wandb.automations.scopes._ArtifactPortfolioScope, wandb.automations.scopes.ProjectScope, Annotated[wandb.automations.scopes.TeamScope | wandb.automations.scopes.OrgScope, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), Discriminator(discriminator='entity_type', custom_error_type=None, custom_error_message=None, custom_error_context=None)]], BeforeValidator(func=, json_schema_input_type=PydanticUndefined), Discriminator(discriminator='typename__', custom_error_type=None, custom_error_message=None, custom_error_context=None)], -filter: Annotated[wandb.automations._filters.operators.And | wandb.automations._filters.operators.Or | wandb.automations._filters.operators.Nor | wandb.automations._filters.operators.Not | wandb.automations._filters.operators.Lt | wandb.automations._filters.operators.Gt | wandb.automations._filters.operators.Lte | wandb.automations._filters.operators.Gte | wandb.automations._filters.operators.Eq | wandb.automations._filters.operators.Ne | wandb.automations._filters.operators.In | wandb.automations._filters.operators.NotIn | wandb.automations._filters.operators.Exists | wandb.automations._filters.operators.Regex | wandb.automations._filters.operators.Contains | wandb.automations._filters.operators.Size | wandb.automations._filters.operators.All | wandb.automations._filters.expressions.FilterExpr | dict[str, Any], Json, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), PlainSerializer(func=, return_type=PydanticUndefined, when_used='always'), AfterValidator(func=)] = And(()) -``` +## Class wandb.automations.OnAddCollectionTag @@ -25,16 +19,26 @@ A new tag is assigned to an artifact collection. -## Args - -- `event_type`: -- `scope`: The scope of the event. -- `filter`: Additional conditions(s), if any, that are required for this event to trigger. +```python +*, +event_type: Literal[ADD_COLLECTION_TAG] = ADD_COLLECTION_TAG, +scope: Annotated[wandb.automations.scopes._ArtifactSequenceScope | wandb.automations.scopes._ArtifactPortfolioScope | wandb.automations.scopes.ProjectScope, BeforeValidator(func=, json_schema_input_type=PydanticUndefined)], +filter: Annotated[wandb.automations._filters.operators.And | wandb.automations._filters.operators.Or | wandb.automations._filters.operators.Nor | wandb.automations._filters.operators.Not | wandb.automations._filters.operators.Lt | wandb.automations._filters.operators.Gt | wandb.automations._filters.operators.Lte | wandb.automations._filters.operators.Gte | wandb.automations._filters.operators.Eq | wandb.automations._filters.operators.Ne | wandb.automations._filters.operators.In | wandb.automations._filters.operators.NotIn | wandb.automations._filters.operators.Exists | wandb.automations._filters.operators.Regex | wandb.automations._filters.operators.Contains | wandb.automations._filters.expressions.FilterExpr | dict[str, Any], Json, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), PlainSerializer(func=, return_type=PydanticUndefined, when_used='always'), AfterValidator(func=)] = And(()) +``` +## Args + + + +The scope of the event. + + +Additional conditions(s), if any, that are required for this event to trigger. + diff --git a/models/ref/python/automations/oncreateartifact.mdx b/models/ref/python/automations/oncreateartifact.mdx index 350fcc7db2..638c682550 100644 --- a/models/ref/python/automations/oncreateartifact.mdx +++ b/models/ref/python/automations/oncreateartifact.mdx @@ -7,17 +7,11 @@ namespace: wandb.automations.events import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.automations.OnCreateArtifact -```python -*, -event_type: Literal[CREATE_ARTIFACT] = CREATE_ARTIFACT, -scope: Annotated[wandb.automations.scopes._ArtifactSequenceScope | wandb.automations.scopes._ArtifactPortfolioScope, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), Discriminator(discriminator='typename__', custom_error_type=None, custom_error_message=None, custom_error_context=None)], -filter: Annotated[wandb.automations._filters.operators.And | wandb.automations._filters.operators.Or | wandb.automations._filters.operators.Nor | wandb.automations._filters.operators.Not | wandb.automations._filters.operators.Lt | wandb.automations._filters.operators.Gt | wandb.automations._filters.operators.Lte | wandb.automations._filters.operators.Gte | wandb.automations._filters.operators.Eq | wandb.automations._filters.operators.Ne | wandb.automations._filters.operators.In | wandb.automations._filters.operators.NotIn | wandb.automations._filters.operators.Exists | wandb.automations._filters.operators.Regex | wandb.automations._filters.operators.Contains | wandb.automations._filters.operators.Size | wandb.automations._filters.operators.All | wandb.automations._filters.expressions.FilterExpr | dict[str, Any], Json, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), PlainSerializer(func=, return_type=PydanticUndefined, when_used='always'), AfterValidator(func=)] = And(()) -``` +## Class wandb.automations.OnCreateArtifact @@ -25,12 +19,26 @@ A new artifact is created. +```python +*, +event_type: Literal[CREATE_ARTIFACT] = CREATE_ARTIFACT, +scope: Annotated[wandb.automations.scopes._ArtifactSequenceScope | wandb.automations.scopes._ArtifactPortfolioScope, BeforeValidator(func=, json_schema_input_type=PydanticUndefined)], +filter: Annotated[wandb.automations._filters.operators.And | wandb.automations._filters.operators.Or | wandb.automations._filters.operators.Nor | wandb.automations._filters.operators.Not | wandb.automations._filters.operators.Lt | wandb.automations._filters.operators.Gt | wandb.automations._filters.operators.Lte | wandb.automations._filters.operators.Gte | wandb.automations._filters.operators.Eq | wandb.automations._filters.operators.Ne | wandb.automations._filters.operators.In | wandb.automations._filters.operators.NotIn | wandb.automations._filters.operators.Exists | wandb.automations._filters.operators.Regex | wandb.automations._filters.operators.Contains | wandb.automations._filters.expressions.FilterExpr | dict[str, Any], Json, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), PlainSerializer(func=, return_type=PydanticUndefined, when_used='always'), AfterValidator(func=)] = And(()) +``` + ## Args -- `event_type`: -- `scope`: The scope of the event: must be an artifact collection. -- `filter`: Additional conditions(s), if any, that are required for this event to trigger. + + + + +The scope of the event: must be an artifact collection. + + + +Additional conditions(s), if any, that are required for this event to trigger. + @@ -49,7 +57,3 @@ collection = api.artifact_collection(name="my-collection", type_name="model") event = OnCreateArtifact(scope=collection) ``` - - - - diff --git a/models/ref/python/automations/onlinkartifact.mdx b/models/ref/python/automations/onlinkartifact.mdx index 093eb066ff..b1ecbdfa02 100644 --- a/models/ref/python/automations/onlinkartifact.mdx +++ b/models/ref/python/automations/onlinkartifact.mdx @@ -7,17 +7,11 @@ namespace: wandb.automations.events import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.automations.OnLinkArtifact -```python -*, -event_type: Literal[LINK_ARTIFACT] = LINK_ARTIFACT, -scope: Annotated[Union[wandb.automations.scopes._ArtifactSequenceScope, wandb.automations.scopes._ArtifactPortfolioScope, wandb.automations.scopes.ProjectScope, Annotated[wandb.automations.scopes.TeamScope | wandb.automations.scopes.OrgScope, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), Discriminator(discriminator='entity_type', custom_error_type=None, custom_error_message=None, custom_error_context=None)]], BeforeValidator(func=, json_schema_input_type=PydanticUndefined), Discriminator(discriminator='typename__', custom_error_type=None, custom_error_message=None, custom_error_context=None)], -filter: Annotated[wandb.automations._filters.operators.And | wandb.automations._filters.operators.Or | wandb.automations._filters.operators.Nor | wandb.automations._filters.operators.Not | wandb.automations._filters.operators.Lt | wandb.automations._filters.operators.Gt | wandb.automations._filters.operators.Lte | wandb.automations._filters.operators.Gte | wandb.automations._filters.operators.Eq | wandb.automations._filters.operators.Ne | wandb.automations._filters.operators.In | wandb.automations._filters.operators.NotIn | wandb.automations._filters.operators.Exists | wandb.automations._filters.operators.Regex | wandb.automations._filters.operators.Contains | wandb.automations._filters.operators.Size | wandb.automations._filters.operators.All | wandb.automations._filters.expressions.FilterExpr | dict[str, Any], Json, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), PlainSerializer(func=, return_type=PydanticUndefined, when_used='always'), AfterValidator(func=)] = And(()) -``` +## Class wandb.automations.OnLinkArtifact @@ -25,12 +19,26 @@ A new artifact is linked to a collection. +```python +*, +event_type: Literal[LINK_ARTIFACT] = LINK_ARTIFACT, +scope: Annotated[wandb.automations.scopes._ArtifactSequenceScope | wandb.automations.scopes._ArtifactPortfolioScope | wandb.automations.scopes.ProjectScope, BeforeValidator(func=, json_schema_input_type=PydanticUndefined)], +filter: Annotated[wandb.automations._filters.operators.And | wandb.automations._filters.operators.Or | wandb.automations._filters.operators.Nor | wandb.automations._filters.operators.Not | wandb.automations._filters.operators.Lt | wandb.automations._filters.operators.Gt | wandb.automations._filters.operators.Lte | wandb.automations._filters.operators.Gte | wandb.automations._filters.operators.Eq | wandb.automations._filters.operators.Ne | wandb.automations._filters.operators.In | wandb.automations._filters.operators.NotIn | wandb.automations._filters.operators.Exists | wandb.automations._filters.operators.Regex | wandb.automations._filters.operators.Contains | wandb.automations._filters.expressions.FilterExpr | dict[str, Any], Json, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), PlainSerializer(func=, return_type=PydanticUndefined, when_used='always'), AfterValidator(func=)] = And(()) +``` + ## Args -- `event_type`: -- `scope`: The scope of the event. -- `filter`: Additional conditions(s), if any, that are required for this event to trigger. + + + + +The scope of the event. + + + +Additional conditions(s), if any, that are required for this event to trigger. + @@ -52,7 +60,3 @@ event = OnLinkArtifact( ) ``` - - - - diff --git a/models/ref/python/automations/onremoveartifacttag.mdx b/models/ref/python/automations/onremoveartifacttag.mdx index 118f2b442b..19bd765cc6 100644 --- a/models/ref/python/automations/onremoveartifacttag.mdx +++ b/models/ref/python/automations/onremoveartifacttag.mdx @@ -7,17 +7,11 @@ namespace: wandb.automations.events import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.automations.OnRemoveArtifactTag -```python -*, -event_type: Literal[REMOVE_ARTIFACT_TAG] = REMOVE_ARTIFACT_TAG, -scope: Annotated[Union[wandb.automations.scopes._ArtifactSequenceScope, wandb.automations.scopes._ArtifactPortfolioScope, wandb.automations.scopes.ProjectScope, Annotated[wandb.automations.scopes.TeamScope | wandb.automations.scopes.OrgScope, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), Discriminator(discriminator='entity_type', custom_error_type=None, custom_error_message=None, custom_error_context=None)]], BeforeValidator(func=, json_schema_input_type=PydanticUndefined), Discriminator(discriminator='typename__', custom_error_type=None, custom_error_message=None, custom_error_context=None)], -filter: Annotated[wandb.automations._filters.operators.And | wandb.automations._filters.operators.Or | wandb.automations._filters.operators.Nor | wandb.automations._filters.operators.Not | wandb.automations._filters.operators.Lt | wandb.automations._filters.operators.Gt | wandb.automations._filters.operators.Lte | wandb.automations._filters.operators.Gte | wandb.automations._filters.operators.Eq | wandb.automations._filters.operators.Ne | wandb.automations._filters.operators.In | wandb.automations._filters.operators.NotIn | wandb.automations._filters.operators.Exists | wandb.automations._filters.operators.Regex | wandb.automations._filters.operators.Contains | wandb.automations._filters.operators.Size | wandb.automations._filters.operators.All | wandb.automations._filters.expressions.FilterExpr | dict[str, Any], Json, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), PlainSerializer(func=, return_type=PydanticUndefined, when_used='always'), AfterValidator(func=)] = And(()) -``` +## Class wandb.automations.OnRemoveArtifactTag @@ -25,16 +19,26 @@ A tag is removed from an artifact version. -## Args - -- `event_type`: -- `scope`: The scope of the event. -- `filter`: Additional conditions(s), if any, that are required for this event to trigger. +```python +*, +event_type: Literal[REMOVE_ARTIFACT_TAG] = REMOVE_ARTIFACT_TAG, +scope: Annotated[wandb.automations.scopes._ArtifactSequenceScope | wandb.automations.scopes._ArtifactPortfolioScope | wandb.automations.scopes.ProjectScope, BeforeValidator(func=, json_schema_input_type=PydanticUndefined)], +filter: Annotated[wandb.automations._filters.operators.And | wandb.automations._filters.operators.Or | wandb.automations._filters.operators.Nor | wandb.automations._filters.operators.Not | wandb.automations._filters.operators.Lt | wandb.automations._filters.operators.Gt | wandb.automations._filters.operators.Lte | wandb.automations._filters.operators.Gte | wandb.automations._filters.operators.Eq | wandb.automations._filters.operators.Ne | wandb.automations._filters.operators.In | wandb.automations._filters.operators.NotIn | wandb.automations._filters.operators.Exists | wandb.automations._filters.operators.Regex | wandb.automations._filters.operators.Contains | wandb.automations._filters.expressions.FilterExpr | dict[str, Any], Json, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), PlainSerializer(func=, return_type=PydanticUndefined, when_used='always'), AfterValidator(func=)] = And(()) +``` +## Args + + + +The scope of the event. + + +Additional conditions(s), if any, that are required for this event to trigger. + diff --git a/models/ref/python/automations/onremovecollectiontag.mdx b/models/ref/python/automations/onremovecollectiontag.mdx index 9de8d3240e..78fbeecd83 100644 --- a/models/ref/python/automations/onremovecollectiontag.mdx +++ b/models/ref/python/automations/onremovecollectiontag.mdx @@ -7,17 +7,11 @@ namespace: wandb.automations.events import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.automations.OnRemoveCollectionTag -```python -*, -event_type: Literal[REMOVE_COLLECTION_TAG] = REMOVE_COLLECTION_TAG, -scope: Annotated[Union[wandb.automations.scopes._ArtifactSequenceScope, wandb.automations.scopes._ArtifactPortfolioScope, wandb.automations.scopes.ProjectScope, Annotated[wandb.automations.scopes.TeamScope | wandb.automations.scopes.OrgScope, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), Discriminator(discriminator='entity_type', custom_error_type=None, custom_error_message=None, custom_error_context=None)]], BeforeValidator(func=, json_schema_input_type=PydanticUndefined), Discriminator(discriminator='typename__', custom_error_type=None, custom_error_message=None, custom_error_context=None)], -filter: Annotated[wandb.automations._filters.operators.And | wandb.automations._filters.operators.Or | wandb.automations._filters.operators.Nor | wandb.automations._filters.operators.Not | wandb.automations._filters.operators.Lt | wandb.automations._filters.operators.Gt | wandb.automations._filters.operators.Lte | wandb.automations._filters.operators.Gte | wandb.automations._filters.operators.Eq | wandb.automations._filters.operators.Ne | wandb.automations._filters.operators.In | wandb.automations._filters.operators.NotIn | wandb.automations._filters.operators.Exists | wandb.automations._filters.operators.Regex | wandb.automations._filters.operators.Contains | wandb.automations._filters.operators.Size | wandb.automations._filters.operators.All | wandb.automations._filters.expressions.FilterExpr | dict[str, Any], Json, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), PlainSerializer(func=, return_type=PydanticUndefined, when_used='always'), AfterValidator(func=)] = And(()) -``` +## Class wandb.automations.OnRemoveCollectionTag @@ -25,16 +19,26 @@ A tag is removed from an artifact collection. -## Args - -- `event_type`: -- `scope`: The scope of the event. -- `filter`: Additional conditions(s), if any, that are required for this event to trigger. +```python +*, +event_type: Literal[REMOVE_COLLECTION_TAG] = REMOVE_COLLECTION_TAG, +scope: Annotated[wandb.automations.scopes._ArtifactSequenceScope | wandb.automations.scopes._ArtifactPortfolioScope | wandb.automations.scopes.ProjectScope, BeforeValidator(func=, json_schema_input_type=PydanticUndefined)], +filter: Annotated[wandb.automations._filters.operators.And | wandb.automations._filters.operators.Or | wandb.automations._filters.operators.Nor | wandb.automations._filters.operators.Not | wandb.automations._filters.operators.Lt | wandb.automations._filters.operators.Gt | wandb.automations._filters.operators.Lte | wandb.automations._filters.operators.Gte | wandb.automations._filters.operators.Eq | wandb.automations._filters.operators.Ne | wandb.automations._filters.operators.In | wandb.automations._filters.operators.NotIn | wandb.automations._filters.operators.Exists | wandb.automations._filters.operators.Regex | wandb.automations._filters.operators.Contains | wandb.automations._filters.expressions.FilterExpr | dict[str, Any], Json, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), PlainSerializer(func=, return_type=PydanticUndefined, when_used='always'), AfterValidator(func=)] = And(()) +``` +## Args + + + +The scope of the event. + + +Additional conditions(s), if any, that are required for this event to trigger. + diff --git a/models/ref/python/automations/onrunmetric.mdx b/models/ref/python/automations/onrunmetric.mdx index 4892974f65..ced9e46a64 100644 --- a/models/ref/python/automations/onrunmetric.mdx +++ b/models/ref/python/automations/onrunmetric.mdx @@ -7,17 +7,11 @@ namespace: wandb.automations.events import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.automations.OnRunMetric -```python -*, -event_type: Literal[RUN_METRIC_THRESHOLD, RUN_METRIC_CHANGE, RUN_METRIC_ZSCORE], -scope: Annotated[Union[wandb.automations.scopes.ProjectScope, Annotated[wandb.automations.scopes.TeamScope | wandb.automations.scopes.OrgScope, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), Discriminator(discriminator='entity_type', custom_error_type=None, custom_error_message=None, custom_error_context=None)]], BeforeValidator(func=, json_schema_input_type=PydanticUndefined), Discriminator(discriminator='typename__', custom_error_type=None, custom_error_message=None, custom_error_context=None)], -filter: Annotated[wandb.automations.events.RunMetricFilter, Json, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), PlainSerializer(func=, return_type=PydanticUndefined, when_used='always')] -``` +## Class wandb.automations.OnRunMetric @@ -25,12 +19,26 @@ A run metric satisfies a user-defined condition. +```python +*, +event_type: Literal[RUN_METRIC_THRESHOLD, RUN_METRIC_CHANGE, RUN_METRIC_ZSCORE], +scope: wandb.automations.scopes.ProjectScope, +filter: Annotated[wandb.automations.events.RunMetricFilter, Json, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), PlainSerializer(func=, return_type=PydanticUndefined, when_used='always')] +``` + ## Args -- `event_type`: -- `scope`: The scope of the event: must be a project or a team/org entity. -- `filter`: Run and/or metric condition(s) that must be satisfied for this event to trigger. + + + + + +The scope of the event: must be a project. + + +Run and/or metric condition(s) that must be satisfied for this event to trigger. + @@ -52,7 +60,3 @@ event = OnRunMetric( ) ``` - - - - diff --git a/models/ref/python/automations/onrunstate.mdx b/models/ref/python/automations/onrunstate.mdx index 035d8b577e..f9a0950efd 100644 --- a/models/ref/python/automations/onrunstate.mdx +++ b/models/ref/python/automations/onrunstate.mdx @@ -7,17 +7,11 @@ namespace: wandb.automations.events import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.automations.OnRunState -```python -*, -event_type: Literal[RUN_STATE] = RUN_STATE, -scope: Annotated[Union[wandb.automations.scopes.ProjectScope, Annotated[wandb.automations.scopes.TeamScope | wandb.automations.scopes.OrgScope, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), Discriminator(discriminator='entity_type', custom_error_type=None, custom_error_message=None, custom_error_context=None)]], BeforeValidator(func=, json_schema_input_type=PydanticUndefined), Discriminator(discriminator='typename__', custom_error_type=None, custom_error_message=None, custom_error_context=None)], -filter: Annotated[wandb.automations.events.RunStateFilter, Json, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), PlainSerializer(func=, return_type=PydanticUndefined, when_used='always')] -``` +## Class wandb.automations.OnRunState @@ -25,12 +19,26 @@ A run state changes. +```python +*, +event_type: Literal[RUN_STATE] = RUN_STATE, +scope: wandb.automations.scopes.ProjectScope, +filter: Annotated[wandb.automations.events.RunStateFilter, Json, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), PlainSerializer(func=, return_type=PydanticUndefined, when_used='always')] +``` + ## Args -- `event_type`: -- `scope`: The scope of the event: must be a project or a team/org entity. -- `filter`: Run state condition(s) that must be satisfied for this event to trigger. + + + + + +The scope of the event: must be a project. + + +Run state condition(s) that must be satisfied for this event to trigger. + @@ -52,7 +60,3 @@ event = OnRunState( ) ``` - - - - diff --git a/models/ref/python/automations/onunlinkartifact.mdx b/models/ref/python/automations/onunlinkartifact.mdx index 069c92c57a..30f5ba382f 100644 --- a/models/ref/python/automations/onunlinkartifact.mdx +++ b/models/ref/python/automations/onunlinkartifact.mdx @@ -7,17 +7,11 @@ namespace: wandb.automations.events import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.automations.OnUnlinkArtifact -```python -*, -event_type: Literal[UNLINK_ARTIFACT] = UNLINK_ARTIFACT, -scope: Annotated[Union[wandb.automations.scopes._ArtifactSequenceScope, wandb.automations.scopes._ArtifactPortfolioScope, wandb.automations.scopes.ProjectScope, Annotated[wandb.automations.scopes.TeamScope | wandb.automations.scopes.OrgScope, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), Discriminator(discriminator='entity_type', custom_error_type=None, custom_error_message=None, custom_error_context=None)]], BeforeValidator(func=, json_schema_input_type=PydanticUndefined), Discriminator(discriminator='typename__', custom_error_type=None, custom_error_message=None, custom_error_context=None)], -filter: Annotated[wandb.automations._filters.operators.And | wandb.automations._filters.operators.Or | wandb.automations._filters.operators.Nor | wandb.automations._filters.operators.Not | wandb.automations._filters.operators.Lt | wandb.automations._filters.operators.Gt | wandb.automations._filters.operators.Lte | wandb.automations._filters.operators.Gte | wandb.automations._filters.operators.Eq | wandb.automations._filters.operators.Ne | wandb.automations._filters.operators.In | wandb.automations._filters.operators.NotIn | wandb.automations._filters.operators.Exists | wandb.automations._filters.operators.Regex | wandb.automations._filters.operators.Contains | wandb.automations._filters.operators.Size | wandb.automations._filters.operators.All | wandb.automations._filters.expressions.FilterExpr | dict[str, Any], Json, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), PlainSerializer(func=, return_type=PydanticUndefined, when_used='always'), AfterValidator(func=)] = And(()) -``` +## Class wandb.automations.OnUnlinkArtifact @@ -25,16 +19,26 @@ An artifact version is unlinked from a collection. -## Args - -- `event_type`: -- `scope`: The scope of the event. -- `filter`: Additional conditions(s), if any, that are required for this event to trigger. +```python +*, +event_type: Literal[UNLINK_ARTIFACT] = UNLINK_ARTIFACT, +scope: Annotated[wandb.automations.scopes._ArtifactSequenceScope | wandb.automations.scopes._ArtifactPortfolioScope | wandb.automations.scopes.ProjectScope, BeforeValidator(func=, json_schema_input_type=PydanticUndefined)], +filter: Annotated[wandb.automations._filters.operators.And | wandb.automations._filters.operators.Or | wandb.automations._filters.operators.Nor | wandb.automations._filters.operators.Not | wandb.automations._filters.operators.Lt | wandb.automations._filters.operators.Gt | wandb.automations._filters.operators.Lte | wandb.automations._filters.operators.Gte | wandb.automations._filters.operators.Eq | wandb.automations._filters.operators.Ne | wandb.automations._filters.operators.In | wandb.automations._filters.operators.NotIn | wandb.automations._filters.operators.Exists | wandb.automations._filters.operators.Regex | wandb.automations._filters.operators.Contains | wandb.automations._filters.expressions.FilterExpr | dict[str, Any], Json, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), PlainSerializer(func=, return_type=PydanticUndefined, when_used='always'), AfterValidator(func=)] = And(()) +``` +## Args + + + +The scope of the event. + + +Additional conditions(s), if any, that are required for this event to trigger. + diff --git a/models/ref/python/automations/runstatefilter.mdx b/models/ref/python/automations/runstatefilter.mdx index 12c0702d93..71c6545ad5 100644 --- a/models/ref/python/automations/runstatefilter.mdx +++ b/models/ref/python/automations/runstatefilter.mdx @@ -7,16 +7,11 @@ namespace: wandb.automations.events import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.automations.RunStateFilter -```python -*, -run_filter: Annotated[wandb.automations._filters.operators.And | wandb.automations._filters.operators.Or | wandb.automations._filters.operators.Nor | wandb.automations._filters.operators.Not | wandb.automations._filters.operators.Lt | wandb.automations._filters.operators.Gt | wandb.automations._filters.operators.Lte | wandb.automations._filters.operators.Gte | wandb.automations._filters.operators.Eq | wandb.automations._filters.operators.Ne | wandb.automations._filters.operators.In | wandb.automations._filters.operators.NotIn | wandb.automations._filters.operators.Exists | wandb.automations._filters.operators.Regex | wandb.automations._filters.operators.Contains | wandb.automations._filters.operators.Size | wandb.automations._filters.operators.All | wandb.automations._filters.expressions.FilterExpr | dict[str, Any], Json, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), PlainSerializer(func=, return_type=PydanticUndefined, when_used='always'), AfterValidator(func=)] = And(()), -run_state_filter: wandb.automations._run_state_filters.StateFilter -``` +## Class wandb.automations.RunStateFilter @@ -24,15 +19,21 @@ Represents a filter for triggering events based on changes in run states. -## Args - -- `run_filter`: Filters that must match any runs that will trigger this event. -- `run_state_filter`: Run state condition(s) that must be satisfied for this event to trigger. - - +```python +*, +run_filter: Annotated[wandb.automations._filters.operators.And | wandb.automations._filters.operators.Or | wandb.automations._filters.operators.Nor | wandb.automations._filters.operators.Not | wandb.automations._filters.operators.Lt | wandb.automations._filters.operators.Gt | wandb.automations._filters.operators.Lte | wandb.automations._filters.operators.Gte | wandb.automations._filters.operators.Eq | wandb.automations._filters.operators.Ne | wandb.automations._filters.operators.In | wandb.automations._filters.operators.NotIn | wandb.automations._filters.operators.Exists | wandb.automations._filters.operators.Regex | wandb.automations._filters.operators.Contains | wandb.automations._filters.expressions.FilterExpr | dict[str, Any], Json, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), PlainSerializer(func=, return_type=PydanticUndefined, when_used='always'), AfterValidator(func=)] = And(()), +run_state_filter: wandb.automations._filters.run_states.StateFilter +``` +## Args + +Filters that must match any runs that will trigger this event. + + +Run state condition(s) that must be satisfied for this event to trigger. + diff --git a/models/ref/python/automations/sendnotification.mdx b/models/ref/python/automations/sendnotification.mdx index 3383f96ce5..641464aa78 100644 --- a/models/ref/python/automations/sendnotification.mdx +++ b/models/ref/python/automations/sendnotification.mdx @@ -7,11 +7,18 @@ namespace: wandb.automations.actions import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + + + + +## Class wandb.automations.SendNotification + + + +Defines an automation action that sends a (Slack) notification. -## class wandb.automations.SendNotification ```python *, integration_id: Annotated[str, Strict(strict=True)], @@ -21,47 +28,27 @@ title: Annotated[str, BeforeValidator(func=, json_sche action_type: Literal[NOTIFICATION] = NOTIFICATION ``` - - -Defines an automation action that sends a (Slack) notification. - - - ## Args -- `integration_id`: The ID of the Slack integration that will be used to send the notification. -- `text`: The message body of the sent notification. -- `level`: The severity (`INFO`, `WARN`, `ERROR`) of the sent notification. -- `title`: The title of the sent notification. -- `action_type`: - - - - - + +The ID of the Slack integration that will be used to send the notification. + + +The message body of the sent notification. + + +The severity (`INFO`, `WARN`, `ERROR`) of the sent notification. + -## Methods - -### method SendNotification.from_integration() - -```python -integration: 'SlackIntegration', *, -title: 'str' = '', -text: 'str' = '', -level: 'AlertSeverity' = -``` - -Define a notification action that sends to the given (Slack) integration. - -##### Arguments + +The title of the sent notification. + -- `integration`: -- `title`: -- `text`: -- `level`: + + diff --git a/models/ref/python/automations/sendnotification/sendnotification-methods.mdx b/models/ref/python/automations/sendnotification/sendnotification-methods.mdx new file mode 100644 index 0000000000..d66a166ff3 --- /dev/null +++ b/models/ref/python/automations/sendnotification/sendnotification-methods.mdx @@ -0,0 +1,40 @@ +--- +title: SendNotification methods +sidebarTitle: Methods +page_kind: class-methods +parent_slug: sendnotification +kind: class +namespace: wandb.automations.actions +--- + +## Class wandb.automations.SendNotification + +## method SendNotification.from_integration() + +Define a notification action that sends to the given (Slack) integration. + +```python +integration: 'SlackIntegration', *, +title: 'str' = '', +text: 'str' = '', +level: 'AlertSeverity' = +``` + +##### Arguments + + + + + + + + + + + + + + + + + diff --git a/models/ref/python/automations/sendwebhook.mdx b/models/ref/python/automations/sendwebhook.mdx index 39d3fa58ac..2718bcd7ce 100644 --- a/models/ref/python/automations/sendwebhook.mdx +++ b/models/ref/python/automations/sendwebhook.mdx @@ -7,17 +7,11 @@ namespace: wandb.automations.actions import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.automations.SendWebhook -```python -*, -integration_id: Annotated[str, Strict(strict=True)], -requestPayload: Optional[Annotated[dict[str, Any], Json, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), PlainSerializer(func=, return_type=PydanticUndefined, when_used='always')]] = None, -action_type: Literal[GENERIC_WEBHOOK] = GENERIC_WEBHOOK -``` +## Class wandb.automations.SendWebhook @@ -25,35 +19,26 @@ Defines an automation action that sends a webhook request. -## Args - -- `integration_id`: The ID of the webhook integration that will be used to send the request. -- `requestPayload`: The payload, possibly with template variables, to send in the webhook request. -- `action_type`: - - - - - - - - -## Methods - -### method SendWebhook.from_integration() - ```python -integration: 'WebhookIntegration', *, -payload: 'JsonEncoded[dict[str, Any]] | None' = None +*, +integration_id: Annotated[str, Strict(strict=True)], +requestPayload: Optional[Annotated[dict[str, Any], Json, BeforeValidator(func=, json_schema_input_type=PydanticUndefined), PlainSerializer(func=, return_type=PydanticUndefined, when_used='always')]] = None, +action_type: Literal[GENERIC_WEBHOOK] = GENERIC_WEBHOOK ``` -Define a webhook action that sends to the given (webhook) integration. +## Args + + +The ID of the webhook integration that will be used to send the request. + -##### Arguments + +The payload, possibly with template variables, to send in the webhook request. + -- `integration`: -- `payload`: + + diff --git a/models/ref/python/automations/sendwebhook/sendwebhook-methods.mdx b/models/ref/python/automations/sendwebhook/sendwebhook-methods.mdx new file mode 100644 index 0000000000..6b1d0dd0d3 --- /dev/null +++ b/models/ref/python/automations/sendwebhook/sendwebhook-methods.mdx @@ -0,0 +1,30 @@ +--- +title: SendWebhook methods +sidebarTitle: Methods +page_kind: class-methods +parent_slug: sendwebhook +kind: class +namespace: wandb.automations.actions +--- + +## Class wandb.automations.SendWebhook + +## method SendWebhook.from_integration() + +Define a webhook action that sends to the given (webhook) integration. + +```python +integration: 'WebhookIntegration', *, +payload: 'JsonEncoded[dict[str, Any]] | None' = None +``` + +##### Arguments + + + + + + + + + diff --git a/models/ref/python/custom-charts/bar.mdx b/models/ref/python/custom-charts/bar.mdx index 04a403c167..c1ff6f0a4e 100644 --- a/models/ref/python/custom-charts/bar.mdx +++ b/models/ref/python/custom-charts/bar.mdx @@ -7,7 +7,7 @@ namespace: wandb.plot.bar import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + @@ -34,14 +34,12 @@ Constructs a bar chart from a wandb.Table of data. - `title`: The title of the bar chart. - `split_table`: Whether the table should be split into a separate section in the W&B UI. If `True`, the table will be displayed in a section named "Custom Chart Tables". Default is `False`. - ## Returns `CustomChart`: A custom chart object that can be logged to W&B. To log the chart, pass it to `wandb.log()`. - ## Examples ```python diff --git a/models/ref/python/custom-charts/confusion_matrix.mdx b/models/ref/python/custom-charts/confusion_matrix.mdx index 8c0d65a8ca..0482f607a2 100644 --- a/models/ref/python/custom-charts/confusion_matrix.mdx +++ b/models/ref/python/custom-charts/confusion_matrix.mdx @@ -7,7 +7,7 @@ namespace: wandb.plot.confusion_matrix import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + @@ -36,18 +36,15 @@ Constructs a confusion matrix from a sequence of probabilities or predictions. - `title`: Title of the confusion matrix chart. - `split_table`: Whether the table should be split into a separate section in the W&B UI. If `True`, the table will be displayed in a section named "Custom Chart Tables". Default is `False`. - ## Returns `CustomChart`: A custom chart object that can be logged to W&B. To log the chart, pass it to `wandb.log()`. - ## Raises - `ValueError`: If both `probs` and `preds` are provided or if the number of predictions and true labels are not equal. If the number of unique predicted classes exceeds the number of class names or if the number of unique true labels exceeds the number of class names. - `wandb.Error`: If numpy is not installed. - ## Examples Logging a confusion matrix with random probabilities for wildlife diff --git a/models/ref/python/custom-charts/histogram.mdx b/models/ref/python/custom-charts/histogram.mdx index 8ec1fac1a8..40184f06a1 100644 --- a/models/ref/python/custom-charts/histogram.mdx +++ b/models/ref/python/custom-charts/histogram.mdx @@ -7,7 +7,7 @@ namespace: wandb.plot.histogram import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + @@ -32,14 +32,12 @@ Constructs a histogram chart from a W&B Table. - `title`: The title of the histogram plot. - `split_table`: Whether the table should be split into a separate section in the W&B UI. If `True`, the table will be displayed in a section named "Custom Chart Tables". Default is `False`. - ## Returns `CustomChart`: A custom chart object that can be logged to W&B. To log the chart, pass it to `wandb.log()`. - ## Examples ```python diff --git a/models/ref/python/custom-charts/line.mdx b/models/ref/python/custom-charts/line.mdx index 80b299e7b6..fe3177b0c8 100644 --- a/models/ref/python/custom-charts/line.mdx +++ b/models/ref/python/custom-charts/line.mdx @@ -7,7 +7,7 @@ namespace: wandb.plot.line import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + @@ -36,14 +36,12 @@ Constructs a customizable line chart. - `title`: Title of the chart. - `split_table`: Whether the table should be split into a separate section in the W&B UI. If `True`, the table will be displayed in a section named "Custom Chart Tables". Default is `False`. - ## Returns `CustomChart`: A custom chart object that can be logged to W&B. To log the chart, pass it to `wandb.log()`. - ## Examples ```python diff --git a/models/ref/python/custom-charts/line_series.mdx b/models/ref/python/custom-charts/line_series.mdx index cd011a44fc..599a1cc980 100644 --- a/models/ref/python/custom-charts/line_series.mdx +++ b/models/ref/python/custom-charts/line_series.mdx @@ -7,7 +7,7 @@ namespace: wandb.plot.line_series import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + @@ -36,14 +36,12 @@ Constructs a line series chart. - `xname`: Label for the x-axis. - `split_table`: Whether the table should be split into a separate section in the W&B UI. If `True`, the table will be displayed in a section named "Custom Chart Tables". Default is `False`. - ## Returns `CustomChart`: A custom chart object that can be logged to W&B. To log the chart, pass it to `wandb.log()`. - ## Examples Logging a single x array where all y series are plotted against the same x values: diff --git a/models/ref/python/custom-charts/plot_table.mdx b/models/ref/python/custom-charts/plot_table.mdx index 803fcd7357..3b26900f05 100644 --- a/models/ref/python/custom-charts/plot_table.mdx +++ b/models/ref/python/custom-charts/plot_table.mdx @@ -7,7 +7,7 @@ namespace: wandb.plot.custom_chart import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + @@ -39,17 +39,14 @@ chart object that can be logged to W&B using `wandb.Run.log()`. - `string_fields`: A dictionary for providing values for any string constants required by the custom visualization. - `split_table`: Whether the table should be split into a separate section in the W&B UI. If `True`, the table will be displayed in a section named "Custom Chart Tables". Default is `False`. - ## Returns `CustomChart`: A custom chart object that can be logged to W&B. To log the chart, pass the chart object as argument to `wandb.Run.log()`. - ## Raises - `wandb.Error`: If `data_table` is not a `wandb.Table` object. - ## Examples ```python diff --git a/models/ref/python/custom-charts/pr_curve.mdx b/models/ref/python/custom-charts/pr_curve.mdx index 44afa4a17b..59fca7d9ec 100644 --- a/models/ref/python/custom-charts/pr_curve.mdx +++ b/models/ref/python/custom-charts/pr_curve.mdx @@ -7,7 +7,7 @@ namespace: wandb.plot.pr_curve import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + @@ -45,17 +45,14 @@ a model's performance. - `title`: Title of the plot. Defaults to "Precision-Recall Curve". - `split_table`: Whether the table should be split into a separate section in the W&B UI. If `True`, the table will be displayed in a section named "Custom Chart Tables". Default is `False`. - ## Returns `CustomChart`: A custom chart object that can be logged to W&B. To log the chart, pass it to `wandb.log()`. - ## Raises - `wandb.Error`: If NumPy, pandas, or scikit-learn is not installed. - ## Examples ```python diff --git a/models/ref/python/custom-charts/roc_curve.mdx b/models/ref/python/custom-charts/roc_curve.mdx index f5fb4c4a0b..e2399ddb5a 100644 --- a/models/ref/python/custom-charts/roc_curve.mdx +++ b/models/ref/python/custom-charts/roc_curve.mdx @@ -7,7 +7,7 @@ namespace: wandb.plot.roc_curve import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + @@ -36,17 +36,14 @@ Constructs Receiver Operating Characteristic (ROC) curve chart. - `title`: Title of the ROC curve plot. Default is "ROC Curve". - `split_table`: Whether the table should be split into a separate section in the W&B UI. If `True`, the table will be displayed in a section named "Custom Chart Tables". Default is `False`. - ## Returns `CustomChart`: A custom chart object that can be logged to W&B. To log the chart, pass it to `wandb.log()`. - ## Raises - `wandb.Error`: If numpy, pandas, or scikit-learn are not found. - ## Examples ```python diff --git a/models/ref/python/custom-charts/scatter.mdx b/models/ref/python/custom-charts/scatter.mdx index 0eac6ad0b6..3e250e09db 100644 --- a/models/ref/python/custom-charts/scatter.mdx +++ b/models/ref/python/custom-charts/scatter.mdx @@ -7,7 +7,7 @@ namespace: wandb.plot.scatter import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + @@ -34,14 +34,12 @@ Constructs a scatter plot from a wandb.Table of data. - `title`: The title of the scatter chart. - `split_table`: Whether the table should be split into a separate section in the W&B UI. If `True`, the table will be displayed in a section named "Custom Chart Tables". Default is `False`. - ## Returns `CustomChart`: A custom chart object that can be logged to W&B. To log the chart, pass it to `wandb.log()`. - ## Examples ```python diff --git a/models/ref/python/data-types/audio.mdx b/models/ref/python/data-types/audio.mdx index 2e3a686774..b456220ad4 100644 --- a/models/ref/python/data-types/audio.mdx +++ b/models/ref/python/data-types/audio.mdx @@ -7,16 +7,11 @@ namespace: wandb.sdk.data_types.audio import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.Audio -```python -(data_or_path: 'str | pathlib.Path | list | np.ndarray', -sample_rate: 'int | None' = None, -caption: 'str | None' = None) -``` +## Class wandb.Audio @@ -24,48 +19,25 @@ W&B class for audio clips. -## Args - -- `data_or_path`: A path to an audio file or a NumPy array of audio data. -- `sample_rate`: Sample rate, required when passing in raw NumPy array of audio data. -- `caption`: Caption to display with audio. - - - - - - - - -## Methods - -### method Audio.durations() - ```python -(audio_list) -``` - -Calculate the duration of the audio files. - -##### Arguments - -- `audio_list`: - - - - -### method Audio.sample_rates() - -```python -(audio_list) +(data_or_path: 'str | pathlib.Path | list | np.ndarray', +sample_rate: 'int | None' = None, +caption: 'str | None' = None) ``` -Get sample rates of the audio files. +## Args -##### Arguments + +A path to an audio file or a NumPy array of audio data. + -- `audio_list`: + +Sample rate, required when passing in raw NumPy array of audio data. + + +Caption to display with audio. + diff --git a/models/ref/python/data-types/audio/audio-methods.mdx b/models/ref/python/data-types/audio/audio-methods.mdx new file mode 100644 index 0000000000..717be86fb5 --- /dev/null +++ b/models/ref/python/data-types/audio/audio-methods.mdx @@ -0,0 +1,39 @@ +--- +title: Audio methods +sidebarTitle: Methods +page_kind: class-methods +parent_slug: audio +kind: class +namespace: wandb.sdk.data_types.audio +--- + +## Class wandb.Audio + +## method Audio.durations() + +Calculate the duration of the audio files. + +```python +(audio_list) +``` + +##### Arguments + + + + + +## method Audio.sample_rates() + +Get sample rates of the audio files. + +```python +(audio_list) +``` + +##### Arguments + + + + + diff --git a/models/ref/python/data-types/histogram.mdx b/models/ref/python/data-types/histogram.mdx index b3cf154899..f1940e68e4 100644 --- a/models/ref/python/data-types/histogram.mdx +++ b/models/ref/python/data-types/histogram.mdx @@ -7,16 +7,11 @@ namespace: wandb.sdk.data_types.histogram import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.Histogram -```python -sequence: 'Sequence | None' = None, -np_histogram: 'NumpyHistogram | None' = None, -num_bins: 'int' = 64 -``` +## Class wandb.Histogram @@ -27,12 +22,25 @@ https://docs.scipy.org/doc/numpy/reference/generated/numpy.histogram.html +```python +sequence: 'Sequence | None' = None, +np_histogram: 'NumpyHistogram | None' = None, +num_bins: 'int' = 64 +``` + ## Args -- `sequence`: Input data for histogram. -- `np_histogram`: Alternative input of a precomputed histogram. -- `num_bins`: Number of bins for the histogram. The default number of bins is 64. The maximum number of bins is 512. + +Input data for histogram. + + +Alternative input of a precomputed histogram. + + + +Number of bins for the histogram. The default number of bins is 64. The maximum number of bins is 512. + ## Attributes @@ -41,8 +49,3 @@ https://docs.scipy.org/doc/numpy/reference/generated/numpy.histogram.html - - - - - diff --git a/models/ref/python/data-types/html.mdx b/models/ref/python/data-types/html.mdx index 283eb9f5b4..f72feb0f76 100644 --- a/models/ref/python/data-types/html.mdx +++ b/models/ref/python/data-types/html.mdx @@ -7,16 +7,11 @@ namespace: wandb.sdk.data_types.html import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.Html -```python -data: 'str | pathlib.Path | TextIO', -inject: 'bool' = True, -data_is_not_path: 'bool' = False -``` +## Class wandb.Html @@ -24,16 +19,25 @@ W&B class for logging HTML content to W&B. -## Args - -- `data`: A string that is a path to a file with the extension ".html", or a string or IO object containing literal HTML. -- `inject`: Add a stylesheet to the HTML object. If set to False the HTML will pass through unchanged. -- `data_is_not_path`: If set to False, the data will be treated as a path to a file. - +```python +data: 'str | pathlib.Path | TextIO', +inject: 'bool' = True, +data_is_not_path: 'bool' = False +``` +## Args + +A string that is a path to a file with the extension ".html", or a string or IO object containing literal HTML. + + +Add a stylesheet to the HTML object. If set to False the HTML will pass through unchanged. + + +If set to False, the data will be treated as a path to a file. + diff --git a/models/ref/python/data-types/image.mdx b/models/ref/python/data-types/image.mdx index 3b210ad6dd..81ae56a772 100644 --- a/models/ref/python/data-types/image.mdx +++ b/models/ref/python/data-types/image.mdx @@ -7,11 +7,18 @@ namespace: wandb.sdk.data_types.image import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + + + + +## Class wandb.Image + + + +A class for logging images to W&B. -## class wandb.Image ```python data_or_path: 'ImageDataOrPathType', mode: 'str | None' = None, @@ -24,42 +31,51 @@ file_type: 'str | None' = None, normalize: 'bool' = True ``` - - -A class for logging images to W&B. - - - ## Args -- `data_or_path`: Accepts NumPy array/pytorch tensor of image data, - a PIL image object, or a path to an image file. If a NumPy - array or pytorch tensor is provided, - the image data will be saved to the given file type. - If the values are not in the range [0, 255] or all values are in the range [0, 1], - the image pixel values will be normalized to the range [0, 255] - unless `normalize` is set to `False`. - - pytorch tensor should be in the format (channel, height, width) - - NumPy array should be in the format (height, width, channel) -- `mode`: The PIL mode for an image. Most common are "L", "RGB", "RGBA". Full Pillow docs for more information https://pillow.readthedocs.io/en/stable/handbook/concepts.html#modes -- `caption`: Label for display of image. -- `grouping`: The grouping number for the image. -- `classes`: A list of class information for the image, used for labeling bounding boxes, and image masks. -- `boxes`: A dictionary containing bounding box information for the image. see https://docs.wandb.ai/models/ref/python/data-types/boundingboxes2d -- `masks`: A dictionary containing mask information for the image. see https://docs.wandb.ai/models/ref/python/data-types/imagemask -- `file_type`: The file type to save the image as. This parameter has no effect if `data_or_path` is a path to an image file. -- `normalize`: If `True`, normalize the image pixel values to fall within the range of [0, 255]. Normalize is only applied if `data_or_path` is a numpy array or pytorch tensor. - - - - - - -## Properties - -### property image - - + +Accepts NumPy array/pytorch tensor of image data, +a PIL image object, or a path to an image file. If a NumPy +array or pytorch tensor is provided, +the image data will be saved to the given file type. +If the values are not in the range [0, 255] or all values are in the range [0, 1], +the image pixel values will be normalized to the range [0, 255] +unless `normalize` is set to `False`. +- pytorch tensor should be in the format (channel, height, width) +- NumPy array should be in the format (height, width, channel) + + + +The PIL mode for an image. Most common are "L", "RGB", "RGBA". Full Pillow docs for more information https://pillow.readthedocs.io/en/stable/handbook/concepts.html#modes + + + +Label for display of image. + + + +The grouping number for the image. + + + +A list of class information for the image, used for labeling bounding boxes, and image masks. + + + +A dictionary containing bounding box information for the image. see https://docs.wandb.ai/models/ref/python/data-types/boundingboxes2d + + + +A dictionary containing mask information for the image. see https://docs.wandb.ai/models/ref/python/data-types/imagemask + + + +The file type to save the image as. This parameter has no effect if `data_or_path` is a path to an image file. + + + +If `True`, normalize the image pixel values to fall within the range of [0, 255]. Normalize is only applied if `data_or_path` is a numpy array or pytorch tensor. + diff --git a/models/ref/python/data-types/image/image-properties.mdx b/models/ref/python/data-types/image/image-properties.mdx new file mode 100644 index 0000000000..80070cfadb --- /dev/null +++ b/models/ref/python/data-types/image/image-properties.mdx @@ -0,0 +1,13 @@ +--- +title: Image properties +sidebarTitle: Properties +page_kind: class-properties +parent_slug: image +kind: class +namespace: wandb.sdk.data_types.image +--- + +## Class wandb.Image + +## property image + diff --git a/models/ref/python/data-types/molecule.mdx b/models/ref/python/data-types/molecule.mdx index 2a17d616f4..0dc54fe6a9 100644 --- a/models/ref/python/data-types/molecule.mdx +++ b/models/ref/python/data-types/molecule.mdx @@ -7,15 +7,11 @@ namespace: wandb.sdk.data_types.molecule import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.Molecule -```python -data_or_path: 'str | pathlib.Path | TextIO', -caption: 'str | None' = None, **kwargs: 'str' -``` +## Class wandb.Molecule @@ -23,60 +19,24 @@ W&B class for 3D Molecular data. -## Args - -- `data_or_path`: Molecule can be initialized from a file name or an io object. -- `caption`: Caption associated with the molecule for display. -- `kwargs`: - - - - - - - - -## Methods - -### method Molecule.from_rdkit() - ```python -data_or_path: 'RDKitDataType', -caption: 'str | None' = None, -convert_to_3d_and_optimize: 'bool' = True, -mmff_optimize_molecule_max_iterations: 'int' = 200 +data_or_path: 'str | pathlib.Path | TextIO', +caption: 'str | None' = None, **kwargs: 'str' ``` -Convert RDKit-supported file/object types to wandb.Molecule. - -##### Arguments - -- `data_or_path`: (string, rdkit.Chem.rdchem.Mol) Molecule can be initialized from a file name or an rdkit.Chem.rdchem.Mol object. -- `caption`: (string) Caption associated with the molecule for display. -- `convert_to_3d_and_optimize`: (bool) Convert to rdkit.Chem.rdchem.Mol with 3D coordinates. This is an expensive operation that may take a long time for complicated molecules. - - - - -### method Molecule.from_smiles() - -```python -data: 'str', -caption: 'str | None' = None, -sanitize: 'bool' = True, -convert_to_3d_and_optimize: 'bool' = True, -mmff_optimize_molecule_max_iterations: 'int' = 200 -``` +## Args -Convert SMILES string to wandb.Molecule. + +Molecule can be initialized from a file name or an io object. + -##### Arguments + +Caption associated with the molecule for display. + -- `data`: SMILES string. -- `caption`: Caption associated with the molecule for display. -- `sanitize`: Check if the molecule is chemically reasonable by the RDKit's definition. -- `convert_to_3d_and_optimize`: Convert to rdkit.Chem.rdchem.Mol with 3D coordinates. This is a computationally intensive operation that may take a long time for complicated molecules. + + diff --git a/models/ref/python/data-types/molecule/molecule-methods.mdx b/models/ref/python/data-types/molecule/molecule-methods.mdx new file mode 100644 index 0000000000..45bb7c8170 --- /dev/null +++ b/models/ref/python/data-types/molecule/molecule-methods.mdx @@ -0,0 +1,66 @@ +--- +title: Molecule methods +sidebarTitle: Methods +page_kind: class-methods +parent_slug: molecule +kind: class +namespace: wandb.sdk.data_types.molecule +--- + +## Class wandb.Molecule + +## method Molecule.from_rdkit() + +Convert RDKit-supported file/object types to wandb.Molecule. + +```python +data_or_path: 'RDKitDataType', +caption: 'str | None' = None, +convert_to_3d_and_optimize: 'bool' = True, +mmff_optimize_molecule_max_iterations: 'int' = 200 +``` + +##### Arguments + + +(string, rdkit.Chem.rdchem.Mol) Molecule can be initialized from a file name or an rdkit.Chem.rdchem.Mol object. + + + +(string) Caption associated with the molecule for display. + + + +(bool) Convert to rdkit.Chem.rdchem.Mol with 3D coordinates. This is an expensive operation that may take a long time for complicated molecules. + + +## method Molecule.from_smiles() + +Convert SMILES string to wandb.Molecule. + +```python +data: 'str', +caption: 'str | None' = None, +sanitize: 'bool' = True, +convert_to_3d_and_optimize: 'bool' = True, +mmff_optimize_molecule_max_iterations: 'int' = 200 +``` + +##### Arguments + + +SMILES string. + + + +Caption associated with the molecule for display. + + + +Check if the molecule is chemically reasonable by the RDKit's definition. + + + +Convert to rdkit.Chem.rdchem.Mol with 3D coordinates. This is a computationally intensive operation that may take a long time for complicated molecules. + + diff --git a/models/ref/python/data-types/object3d.mdx b/models/ref/python/data-types/object3d.mdx index d614ccf162..65b8cd58d5 100644 --- a/models/ref/python/data-types/object3d.mdx +++ b/models/ref/python/data-types/object3d.mdx @@ -7,15 +7,11 @@ namespace: wandb.sdk.data_types.object_3d import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.Object3D -```python -data_or_path: 'np.ndarray | str | pathlib.Path | TextIO | dict', -caption: 'str | None' = None, **kwargs: 'str | FileFormat3D | None' -``` +## Class wandb.Object3D @@ -23,66 +19,24 @@ W&B class for 3D point clouds. -## Args - -- `data_or_path`: Object3D can be initialized from a file or a numpy array. -- `caption`: Caption associated with the object for display. -- `kwargs`: - - - - - - - - -## Methods - -### method Object3D.from_file() - ```python -data_or_path: 'TextIO | str', -file_type: 'FileFormat3D | None' = None -``` - -Initializes Object3D from a file or stream. - -##### Arguments - -- `data_or_path`: A path to a file or a `TextIO` stream. - - - - -### method Object3D.from_numpy() - -```python -data: 'np.ndarray' +data_or_path: 'np.ndarray | str | pathlib.Path | TextIO | dict', +caption: 'str | None' = None, **kwargs: 'str | FileFormat3D | None' ``` -Initializes Object3D from a numpy array. - - - - - -### method Object3D.from_point_cloud() - -```python -points: 'Sequence[Point]', -boxes: 'Sequence[Box3D]', -vectors: 'Sequence[Vector3D] | None' = None, -point_cloud_type: 'PointCloudType' = 'lidar/beta' -``` +## Args -Initializes Object3D from a python object. + +Object3D can be initialized from a file or a numpy array. + -##### Arguments + +Caption associated with the object for display. + -- `points`: The points in the point cloud. -- `boxes`: 3D bounding boxes for labeling the point cloud. Boxes are displayed in point cloud visualizations. -- `vectors`: Each vector is displayed in the point cloud visualization. Can be used to indicate directionality of bounding boxes. Defaults to None. + + diff --git a/models/ref/python/data-types/object3d/object3d-methods.mdx b/models/ref/python/data-types/object3d/object3d-methods.mdx new file mode 100644 index 0000000000..acb87de8f9 --- /dev/null +++ b/models/ref/python/data-types/object3d/object3d-methods.mdx @@ -0,0 +1,59 @@ +--- +title: Object3D methods +sidebarTitle: Methods +page_kind: class-methods +parent_slug: object3d +kind: class +namespace: wandb.sdk.data_types.object_3d +--- + +## Class wandb.Object3D + +## method Object3D.from_file() + +Initializes Object3D from a file or stream. + +```python +data_or_path: 'TextIO | str', +file_type: 'FileFormat3D | None' = None +``` + +##### Arguments + + +A path to a file or a `TextIO` stream. + + +## method Object3D.from_numpy() + +Initializes Object3D from a numpy array. + +```python +data: 'np.ndarray' +``` + +## method Object3D.from_point_cloud() + +Initializes Object3D from a python object. + +```python +points: 'Sequence[Point]', +boxes: 'Sequence[Box3D]', +vectors: 'Sequence[Vector3D] | None' = None, +point_cloud_type: 'PointCloudType' = 'lidar/beta' +``` + +##### Arguments + + +The points in the point cloud. + + + +3D bounding boxes for labeling the point cloud. Boxes are displayed in point cloud visualizations. + + + +Each vector is displayed in the point cloud visualization. Can be used to indicate directionality of bounding boxes. Defaults to None. + + diff --git a/models/ref/python/data-types/plotly.mdx b/models/ref/python/data-types/plotly.mdx index fa06476b52..39d36ee127 100644 --- a/models/ref/python/data-types/plotly.mdx +++ b/models/ref/python/data-types/plotly.mdx @@ -7,14 +7,11 @@ namespace: wandb.sdk.data_types.plotly import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.Plotly -```python -(val: 'plotly.Figure | matplotlib.artist.Artist') -``` +## Class wandb.Plotly @@ -22,14 +19,15 @@ W&B class for Plotly plots. -## Args - -- `val`: Matplotlib or Plotly figure. - - - +```python +(val: 'plotly.Figure | matplotlib.artist.Artist') +``` +## Args + +Matplotlib or Plotly figure. + diff --git a/models/ref/python/data-types/table.mdx b/models/ref/python/data-types/table.mdx index e496d322e2..2f65c9c0eb 100644 --- a/models/ref/python/data-types/table.mdx +++ b/models/ref/python/data-types/table.mdx @@ -7,21 +7,11 @@ namespace: wandb.sdk.data_types.table import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.Table -```python -columns: 'list[ColumnKey] | None' = None, -data: 'list[InputRow] | np.ndarray | pd.DataFrame | None' = None, -rows: 'list[InputRow] | None' = None, -dataframe: 'pd.DataFrame | None' = None, -dtype: 'Any' = None, -optional: 'bool | list[bool]' = True, -allow_mixed_types: 'bool' = False, -log_mode: 'LogMode | None' = 'IMMUTABLE' -``` +## Class wandb.Table @@ -37,193 +27,70 @@ https://docs.wandb.ai/models/tables -## Args - -- `columns`: Names of the columns in the table. Defaults to ["Input", "Output", "Expected"]. -- `data`: 2D row-oriented array of values, NumPy array, or pandas DataFrame. -- `rows`: 2D row-oriented array of values. -- `dataframe`: pandas DataFrame object used to create the table. When set, `data` and `columns` arguments are ignored. -- `dtype`: The expected type for the column values, used to validate the - data. If not set, types are inferred from the data. It can be: - - a single type - - a Python built-in type such as `int`, `str`, `bool`, list, dict, or - datetime. - - a W&B Media type like `wandb.Image` declared under wandb.data_types - - a const value - - a list of any of the above to assign a different type to each - column (should be the same length as `columns`) -- `optional`: Determines if `None` values are allowed. Defaults to True. - - If a singular bool value, then the optionality is enforced for all - columns specified at construction time - - If a list of bool values, then the optionality is applied to each - column - should be the same length as `columns` - applies to all columns. A list of bool values applies to each respective column. -- `allow_mixed_types`: Determines if columns are allowed to have mixed types (disables type validation). Defaults to False -- `log_mode`: Controls how the Table is logged when mutations occur. - Options: - - "IMMUTABLE" (default): Table can only be logged once; subsequent - logging attempts after the table has been mutated will be no-ops. - - "MUTABLE": Table can be re-logged after mutations, creating - a new artifact version each time it's logged. - - "INCREMENTAL": Table data is logged incrementally, with each log creating - a new artifact entry containing the new data since the last log. - - - - - - - - -## Methods - -### method Table.add_column() - -```python -self, -name: 'str', -data: 'list[Any] | np.ndarray', -optional: 'bool' = False -``` - -Adds a column of data to the table. - -##### Arguments - -- `name`: The unique name of the column. -- `data`: A column of homogeneous data. -- `optional`: If null-like values are permitted. - - - - -### method Table.add_computed_columns() - -```python -self, -fn: 'Callable[[int, dict[ColumnKey, Any]], dict[str, Any]]' -``` - -Adds one or more computed columns based on existing data. - -##### Arguments - -- `fn`: A function which accepts an index and row dict, and returns a dict representing new columns for that row, keyed by the new column names. - - - - -##### Examples - -In the callback: -- `ndx` is an integer representing the index of the row. -- `row` is a dictionary keyed by existing columns. - -```python -import wandb - -table = wandb.Table(columns=["x", "y"], data=[[3, 1], [4, 6]]) -table.add_computed_columns(lambda ndx, row: {"diff": row["x"] - row["y"]}) -``` - -### method Table.add_data() - -```python -self, *data: 'Any' -``` - -Adds a new row of data to the table. - -The maximum amount ofrows in a table is determined by -`wandb.Table.MAX_ARTIFACT_ROWS`. - -The length of the data should match the length of the table column. - -##### Arguments - -- `data`: - - - - -### method Table.add_row() - -```python -self, *row: 'Any' -``` - -Deprecated. Use `Table.add_data` method instead. - -##### Arguments - -- `row`: - - - - -### method Table.cast() - -```python -self, -col_name: 'ColumnKey', -dtype: 'Any', -optional: 'bool' = False -``` - -Casts a column to a specific data type. - -This can be one of the normal python classes, an internal W&B type, -or an example object, like an instance of wandb.Image or -wandb.Classes. - -##### Arguments - -- `col_name`: The name of the column to cast. -- `dtype`: The target dtype. -- `optional`: If the column should allow Nones. - - - - -### method Table.get_column() - ```python -self, -name: 'ColumnKey', -convert_to: "Literal['numpy'] | None" = None -``` - -Retrieves a column from the table and optionally converts it to a NumPy object. - -##### Arguments - -- `name`: The name of the column. -- `convert_to`: "numpy" will convert the underlying data to a NumPy object. - - - - -### method Table.get_dataframe() - -```python -self -``` - -Returns a `pandas.DataFrame` of the table. - - - - - -### method Table.get_index() - -```python -(self) +columns: 'list[ColumnKey] | None' = None, +data: 'list[InputRow] | np.ndarray | pd.DataFrame | None' = None, +rows: 'list[InputRow] | None' = None, +dataframe: 'pd.DataFrame | None' = None, +dtype: 'Any' = None, +optional: 'bool | list[bool]' = True, +allow_mixed_types: 'bool' = False, +log_mode: 'LogMode | None' = 'IMMUTABLE' ``` -Returns an array of row indexes for use in other tables to create links. - +## Args + +Names of the columns in the table. Defaults to ["Input", "Output", "Expected"]. + + + +2D row-oriented array of values, NumPy array, or pandas DataFrame. + + + +2D row-oriented array of values. + + + +pandas DataFrame object used to create the table. When set, `data` and `columns` arguments are ignored. + + + +The expected type for the column values, used to validate the +data. If not set, types are inferred from the data. It can be: +- a single type + - a Python built-in type such as `int`, `str`, `bool`, list, dict, or + datetime. + - a W&B Media type like `wandb.Image` declared under wandb.data_types + - a const value +- a list of any of the above to assign a different type to each + column (should be the same length as `columns`) + + + +Determines if `None` values are allowed. Defaults to True. +- If a singular bool value, then the optionality is enforced for all +columns specified at construction time +- If a list of bool values, then the optionality is applied to each +column - should be the same length as `columns` +applies to all columns. A list of bool values applies to each respective column. + + + +Determines if columns are allowed to have mixed types (disables type validation). Defaults to False + + + +Controls how the Table is logged when mutations occur. +Options: +- "IMMUTABLE" (default): Table can only be logged once; subsequent +logging attempts after the table has been mutated will be no-ops. +- "MUTABLE": Table can be re-logged after mutations, creating +a new artifact version each time it's logged. +- "INCREMENTAL": Table data is logged incrementally, with each log creating +a new artifact entry containing the new data since the last log. + diff --git a/models/ref/python/data-types/table/table-methods.mdx b/models/ref/python/data-types/table/table-methods.mdx new file mode 100644 index 0000000000..437ae44b88 --- /dev/null +++ b/models/ref/python/data-types/table/table-methods.mdx @@ -0,0 +1,159 @@ +--- +title: Table methods +sidebarTitle: Methods +page_kind: class-methods +parent_slug: table +kind: class +namespace: wandb.sdk.data_types.table +--- + +## Class wandb.Table + +## method Table.add_column() + +Adds a column of data to the table. + +```python +self, +name: 'str', +data: 'list[Any] | np.ndarray', +optional: 'bool' = False +``` + +##### Arguments + + +The unique name of the column. + + + +A column of homogeneous data. + + + +If null-like values are permitted. + + +## method Table.add_computed_columns() + +Adds one or more computed columns based on existing data. + +```python +self, +fn: 'Callable[[int, dict[ColumnKey, Any]], dict[str, Any]]' +``` + +##### Arguments + + +A function which accepts an index and row dict, and returns a dict representing new columns for that row, keyed by the new column names. + + +##### Examples + +table = wandb.Table(columns=["x", "y"], data=[[3, 1], [4, 6]]) + table.add_computed_columns( + ) + + In the callback: + - `ndx` is an integer representing the index of the row. + - `row` is a dictionary keyed by existing columns. + +## method Table.add_data() + +Adds a new row of data to the table. + +The maximum amount ofrows in a table is determined by +`wandb.Table.MAX_ARTIFACT_ROWS`. + +The length of the data should match the length of the table column. + +```python +self, *data: 'Any' +``` + +##### Arguments + + + + + +## method Table.add_row() + +Deprecated. Use `Table.add_data` method instead. + +```python +self, *row: 'Any' +``` + +##### Arguments + + + + + +## method Table.cast() + +Casts a column to a specific data type. + +This can be one of the normal python classes, an internal W&B type, +or an example object, like an instance of wandb.Image or +wandb.Classes. + +```python +self, +col_name: 'ColumnKey', +dtype: 'Any', +optional: 'bool' = False +``` + +##### Arguments + + +The name of the column to cast. + + + +The target dtype. + + + +If the column should allow Nones. + + +## method Table.get_column() + +Retrieves a column from the table and optionally converts it to a NumPy object. + +```python +self, +name: 'ColumnKey', +convert_to: "Literal['numpy'] | None" = None +``` + +##### Arguments + + +The name of the column. + + + +"numpy" will convert the underlying data to a NumPy object. + + +## method Table.get_dataframe() + +Returns a `pandas.DataFrame` of the table. + +```python +self +``` + +## method Table.get_index() + +Returns an array of row indexes for use in other tables to create links. + +```python +(self) +``` + diff --git a/models/ref/python/data-types/video.mdx b/models/ref/python/data-types/video.mdx index e0ad10509c..f1e05f115f 100644 --- a/models/ref/python/data-types/video.mdx +++ b/models/ref/python/data-types/video.mdx @@ -7,17 +7,11 @@ namespace: wandb.sdk.data_types.video import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.Video -```python -(data_or_path: 'str | pathlib.Path | np.ndarray | TextIO | BytesIO', -caption: 'str | None' = None, -fps: 'int | None' = None, -format: "Literal['gif', 'mp4', 'webm', 'ogg'] | None" = None) -``` +## Class wandb.Video @@ -25,17 +19,30 @@ A class for logging videos to W&B. -## Args - -- `data_or_path`: Video can be initialized with a path to a file or an io object. Video can be initialized with a numpy tensor. The numpy tensor must be either 4 dimensional or 5 dimensional. The dimensions should be (number of frames, channel, height, width) or (batch, number of frames, channel, height, width) The format parameter must be specified with the format argument when initializing with a numpy array or io object. -- `caption`: Caption associated with the video for display. -- `fps`: The frame rate to use when encoding raw video frames. Default value is 4. This parameter has no effect when data_or_path is a string, or bytes. -- `format`: Format of video, necessary if initializing with a numpy array or io object. This parameter will be used to determine the format to use when encoding the video data. Accepted values are "gif", "mp4", "webm", or "ogg". If no value is provided, the default format will be "gif". +```python +(data_or_path: 'str | pathlib.Path | np.ndarray | TextIO | BytesIO', +caption: 'str | None' = None, +fps: 'int | None' = None, +format: "Literal['gif', 'mp4', 'webm', 'ogg'] | None" = None) +``` +## Args + +Video can be initialized with a path to a file or an io object. Video can be initialized with a numpy tensor. The numpy tensor must be either 4 dimensional or 5 dimensional. The dimensions should be (number of frames, channel, height, width) or (batch, number of frames, channel, height, width) The format parameter must be specified with the format argument when initializing with a numpy array or io object. + + +Caption associated with the video for display. + + +The frame rate to use when encoding raw video frames. Default value is 4. This parameter has no effect when data_or_path is a string, or bytes. + + +Format of video, necessary if initializing with a numpy array or io object. This parameter will be used to determine the format to use when encoding the video data. Accepted values are "gif", "mp4", "webm", or "ogg". If no value is provided, the default format will be "gif". + diff --git a/models/ref/python/experiments/artifact.mdx b/models/ref/python/experiments/artifact.mdx index b42f6163f7..67be207f61 100644 --- a/models/ref/python/experiments/artifact.mdx +++ b/models/ref/python/experiments/artifact.mdx @@ -7,20 +7,11 @@ namespace: wandb.sdk.artifacts.artifact import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.Artifact -```python -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 -``` +## Class wandb.Artifact @@ -32,775 +23,45 @@ begin with `add`. Once the artifact has all the desired files, you can call -## Args - -- `name`: A human-readable name for the artifact. Use the name to identify a specific artifact in the W&B App UI or programmatically. You can interactively reference an artifact with the `use_artifact` Public API. A name can contain letters, numbers, underscores, hyphens, and dots. The name must be unique across a project. -- `type`: The artifact's type. Use the type of an artifact to both organize and differentiate artifacts. You can use any string that contains letters, numbers, underscores, hyphens, and dots. Common types include `dataset` or `model`. Include `model` within your type string if you want to link the artifact to the W&B Model Registry. Note that some types reserved for internal use and cannot be set by users. Such types include `job` and types that start with `wandb-`. -- `description`: A description of the artifact. For Model or Dataset Artifacts, add documentation for your standardized team model or dataset card. View an artifact's description programmatically with the `Artifact.description` attribute or programmatically with the W&B App UI. W&B renders the description as markdown in the W&B App. -- `metadata`: Additional information about an artifact. Specify metadata as a dictionary of key-value pairs. You can specify no more than 100 total keys. -- `incremental`: Use `Artifact.new_draft()` method instead to modify an existing artifact. -- `use_as`: Deprecated. -- `storage_region`: - - - - - - -## Properties - -### property aliases - -List of one or more semantically-friendly references or - -identifying "nicknames" assigned to an artifact version. - -Aliases are mutable references that you can programmatically reference. -Change an artifact's alias with the W&B App UI or programmatically. -See [Create new artifact versions](https://docs.wandb.ai/models/artifacts/create-a-new-artifact-version) -for more information. - -### property collection - -The collection this artifact is retrieved from. - -A collection is an ordered group of artifact versions. -If this artifact is retrieved from a collection that it is linked to, -return that collection. Otherwise, return the collection -that the artifact version originates from. - -The collection that an artifact originates from is known as -the source sequence. - -### property commit_hash - -The hash returned when this artifact was committed. - -### property created_at - -Timestamp when the artifact was created. - -### property description - -A description of the artifact. - -### property digest - -The logical digest of the artifact. - -The digest is the checksum of the artifact's contents. If an artifact has the -same digest as the current `latest` version, then `log_artifact` is a no-op. - -### property entity - -The name of the entity that the artifact collection belongs to. - -If the artifact is a link, the entity will be the entity of the linked artifact. - -### property file_count - -The number of files (including references). - -### property history_step - -The nearest step which logged history metrics for this artifact's source run. - -### property id - -The artifact's ID. - -### property is_link - -Boolean flag indicating if the artifact is a link artifact. - -True: The artifact is a link artifact to a source artifact. -False: The artifact is a source artifact. - -### property linked_artifacts - -Returns a list of all the linked artifacts of a source artifact. - -If this artifact is a link artifact (`artifact.is_link == True`), -it will return an empty list. - -Limited to 500 results. - -### property manifest - -The artifact's manifest. - -The manifest lists all of its contents, and can't be changed once the artifact -has been logged. - -### property metadata - -User-defined artifact metadata. - -Structured data associated with the artifact. - -### property name - -The artifact name and version of the artifact. - -A string with the format `{collection}:{alias}`. If fetched before an artifact is -logged/saved, the name won't contain the alias. -If the artifact is a link, the name will be the name of the linked artifact. - -### property project - -The name of the project that the artifact collection belongs to. - -If the artifact is a link, the project will be the project of the linked artifact. - -### property qualified_name - -The entity/project/name of the artifact. - -If the artifact is a link, the qualified name will be the qualified name of the -linked artifact path. - -### property size - -The total size of the artifact in bytes. - -Includes any references tracked by this artifact. - -### property source_artifact - -Returns the source artifact, which is the original logged artifact. - -If this artifact is a source artifact (`artifact.is_link == False`), -it will return itself. - -### property source_collection - -The artifact's source collection. - -The source collection is the collection that the artifact was logged from. - -### property source_entity - -The name of the entity of the source artifact. - -### property source_name - -The artifact name and version of the source artifact. - -A string with the format `{source_collection}:{alias}`. Before the artifact -is saved, contains only the name since the version is not yet known. - -### property source_project - -The name of the project of the source artifact. - -### property source_qualified_name - -The source_entity/source_project/source_name of the source artifact. - -### property source_version - -The source artifact's version. - -A string with the format `v{number}`. - -### property state - -The status of the artifact. One of: "PENDING", "COMMITTED", or "DELETED". - -### property tags - -List of one or more tags assigned to this artifact version. - -### property ttl - -The time-to-live (TTL) policy of an artifact. - -Artifacts are deleted shortly after a TTL policy's duration passes. -If set to `None`, the artifact deactivates TTL policies and will be not -scheduled for deletion, even if there is a team default TTL. -An artifact inherits a TTL policy from -the team default if the team administrator defines a default -TTL and there is no custom policy set on an artifact. - -### property type - -The artifact's type. Common types include `dataset` or `model`. - -### property updated_at - -The time when the artifact was last updated. - -### property url - -Constructs the URL of the artifact. - -### property use_as - -Deprecated. - -### property version - -The artifact's version. - -A string with the format `v{number}`. -If this is a link artifact, the version will be from the linked collection. - - - -## Methods - -### method Artifact.add() - ```python -self, -obj: 'WBValue', -name: 'StrPath', -overwrite: 'bool' = False -``` - -Add wandb.WBValue `obj` to the artifact. - -##### Arguments - -- `obj`: The object to add. Currently support one of Bokeh, JoinedTable, PartitionedTable, Table, Classes, ImageMask, BoundingBoxes2D, Audio, Image, Video, Html, Object3D -- `name`: The path within the artifact to add the object. -- `overwrite`: If True, overwrite existing objects with the same file path if applicable. - - -##### Raises - -- `ArtifactFinalizedError`: You cannot make changes to the current artifact version because it is finalized. Log a new artifact version instead. - - -### method Artifact.add_dir() - -```python -self, -local_path: 'str', -name: 'str | None' = None, -skip_cache: 'bool | None' = False, -policy: "Literal['mutable', 'immutable'] | None" = 'mutable', -merge: 'bool' = False -``` - -Add a local directory to the artifact. - -##### Arguments - -- `local_path`: The path of the local directory. -- `name`: The subdirectory name within an artifact. The name you specify appears in the W&B App UI nested by artifact's `type`. Defaults to the root of the artifact. -- `skip_cache`: If set to `True`, W&B will not copy/move files to the cache while uploading -- `policy`: By default, "mutable". - - mutable: Create a temporary copy of the file to prevent - corruption during upload. - - immutable: Disable protection, rely on the user not to delete - or change the file. -- `merge`: If `False` (default), throws ValueError if a file was already added in a previous add_dir call and its content has changed. If `True`, overwrites existing files with changed content. Always adds new files and never removes files. To replace an entire directory, pass a name when adding the directory using `add_dir(local_path, name=my_prefix)` and call `remove(my_prefix)` to remove the directory, then add it again. - - -##### Raises - -- `ArtifactFinalizedError`: You cannot make changes to the current artifact version because it is finalized. Log a new artifact version instead. -- `ValueError`: Policy must be "mutable" or "immutable" - - -### method Artifact.add_file() - -```python -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 -``` - -Add a local file to the artifact. - -##### Arguments - -- `local_path`: The path to the file being added. -- `name`: The path within the artifact to use for the file being added. Defaults to the basename of the file. -- `is_tmp`: If true, then the file is renamed deterministically to avoid collisions. -- `skip_cache`: If `True`, do not copy files to the cache after uploading. -- `policy`: By default, set to "mutable". If set to "mutable", create a temporary copy of the file to prevent corruption during upload. If set to "immutable", disable protection and rely on the user not to delete or change the file. -- `overwrite`: If `True`, overwrite the file if it already exists. - - -##### Raises - -- `ArtifactFinalizedError`: You cannot make changes to the current artifact version because it is finalized. Log a new artifact version instead. -- `ValueError`: Policy must be "mutable" or "immutable" - - -### method Artifact.add_reference() - -```python -self, -uri: 'ArtifactManifestEntry | str', -name: 'StrPath | None' = None, -checksum: 'bool' = True, -max_objects: 'int | None' = None -``` - -Add a reference denoted by a URI to the artifact. - -Unlike files or directories that you add to an artifact, references are not -uploaded to W&B. For more information, -see [Track external files](https://docs.wandb.ai/models/artifacts/track-external-files). - -By default, the following schemes are supported: - -- http(s): The size and digest of the file will be inferred by the - `Content-Length` and the `ETag` response headers returned by the server. -- s3: The checksum and size are pulled from the object metadata. - If bucket versioning is enabled, then the version ID is also tracked. -- gs: The checksum and size are pulled from the object metadata. If bucket - versioning is enabled, then the version ID is also tracked. -- https, domain matching `*.blob.core.windows.net` -- Azure: The checksum and size are be pulled from the blob metadata. - If storage account versioning is enabled, then the version ID is - also tracked. -- file: The checksum and size are pulled from the file system. This scheme - is useful if you have an NFS share or other externally mounted volume - containing files you wish to track but not necessarily upload. - -For any other scheme, the digest is just a hash of the URI and the size is left -blank. - -##### Arguments - -- `uri`: The URI path of the reference to add. The URI path can be an object returned from `Artifact.get_entry` to store a reference to another artifact's entry. -- `name`: The path within the artifact to place the contents of this reference. -- `checksum`: Whether or not to checksum the resource(s) located at the reference URI. Checksumming is strongly recommended as it enables automatic integrity validation. Disabling checksumming will speed up artifact creation but reference directories will not iterated through so the objects in the directory will not be saved to the artifact. We recommend setting `checksum=False` when adding reference objects, in which case a new version will only be created if the reference URI changes. -- `max_objects`: The maximum number of objects to consider when adding a reference that points to directory or bucket store prefix. By default, the maximum number of objects allowed for Amazon S3, GCS, Azure, and local files is 10,000,000. Other URI schemas do not have a maximum. - - -##### Raises - -- `ArtifactFinalizedError`: You cannot make changes to the current artifact version because it is finalized. Log a new artifact version instead. - - -### method Artifact.checkout() - -```python -self, -root: 'str | None' = None -``` - -Replace the specified root directory with the contents of the artifact. - -WARNING: This will delete all files in `root` that are not included in the -artifact. - -##### Arguments - -- `root`: The directory to replace with this artifact's files. - - -##### Raises - -- `ArtifactNotLoggedError`: If the artifact is not logged. - - -### method Artifact.delete() - -```python -self, -delete_aliases: 'bool' = False -``` - -Delete an artifact and its files. - -If called on a linked artifact, only the link is deleted, and the -source artifact is unaffected. - -Use `Artifact.unlink()` instead of `Artifact.delete()` to remove a -link between a source artifact and a collection. - -##### Arguments - -- `delete_aliases`: If set to `True`, delete all aliases associated with the artifact. If `False`, raise an exception if the artifact has existing aliases. This parameter is ignored if the artifact is retrieved from a collection it is linked to. - - -##### Raises - -- `ArtifactNotLoggedError`: If the artifact is not logged. - - -### method Artifact.download() - -```python -self, -root: 'StrPath | None' = None, -allow_missing_references: 'bool' = False, -skip_cache: 'bool | None' = None, -path_prefix: 'StrPath | None' = None, -multipart: 'bool | None' = None -``` - -Download the contents of the artifact to the specified root directory. - -Existing files located within `root` are not modified. Explicitly delete `root` -before you call `download` if you want the contents of `root` to exactly match -the artifact. - -##### Arguments - -- `root`: The directory W&B stores the artifact's files. -- `allow_missing_references`: If set to `True`, any invalid reference paths will be ignored while downloading referenced files. -- `skip_cache`: If set to `True`, the artifact cache will be skipped when downloading and W&B will download each file into the default root or specified download directory. -- `path_prefix`: If specified, only files with a path that starts with the given prefix will be downloaded. Uses unix format (forward slashes). -- `multipart`: If set to `None` (default), the artifact will be downloaded in parallel using multipart download if individual file size is greater than 2GB. If set to `True` or `False`, the artifact will be downloaded in parallel or serially regardless of the file size. - - -##### Raises - -- `ArtifactNotLoggedError`: If the artifact is not logged. - - -### method Artifact.file() - -```python -self, -root: 'str | None' = None -``` - -Download a single file artifact to the directory you specify with `root`. - -##### Arguments - -- `root`: The root directory to store the file. Defaults to `./artifacts/self.name/`. - - -##### Raises - -- `ArtifactNotLoggedError`: If the artifact is not logged. -- `ValueError`: If the artifact contains more than one file. - - -### method Artifact.files() - -```python -self, -names: 'list[str] | None' = None, -per_page: 'int' = 50, -start: 'str | None' = None -``` - -Iterate over all files stored in this artifact. - -##### Arguments - -- `names`: The filename paths relative to the root of the artifact you wish to list. -- `per_page`: The number of files to return per request. -- `start`: Pagination cursor for resuming a past query, captured from a previous paginator's `.cursor` attribute. - - -##### Raises - -- `ArtifactNotLoggedError`: If the artifact is not logged. - - -### method Artifact.finalize() - -```python -self -``` - -Finalize the artifact version. - -You cannot modify an artifact version once it is finalized because the artifact -is logged as a specific artifact version. Create a new artifact version -to log more data to an artifact. An artifact is automatically finalized -when you log the artifact with `log_artifact`. - - - - - -### method Artifact.get() - -```python -self, -name: 'str' -``` - -Get the WBValue object located at the artifact relative `name`. - -##### Arguments - -- `name`: The artifact relative name to retrieve. - - -##### Raises - -- `ArtifactNotLoggedError`: if the artifact isn't logged or the run is offline. - - -### method Artifact.get_added_local_path_name() - -```python -self, -local_path: 'str' -``` - -Get the artifact relative name of a file added by a local filesystem path. - -##### Arguments - -- `local_path`: The local path to resolve into an artifact relative name. - - - - -### method Artifact.get_entry() - -```python -self, -name: 'StrPath' -``` - -Get the entry with the given name. - -##### Arguments - -- `name`: The artifact relative name to get - - -##### Raises - -- `ArtifactNotLoggedError`: if the artifact isn't logged or the run is offline. -- `KeyError`: if the artifact doesn't contain an entry with the given name. - - -### method Artifact.get_path() - -```python -self, -name: 'StrPath' -``` - -Deprecated. Use `get_entry(name)`. - -##### Arguments - -- `name`: - - - - -### method Artifact.is_draft() - -```python -self -``` - -Check if artifact is not saved. - - - - - -### method Artifact.json_encode() - -```python -self -``` - -Returns the artifact encoded to the JSON format. - - - - - -### method Artifact.link() - -```python -self, -target_path: 'str', -aliases: 'Iterable[str] | None' = None -``` - -Link this artifact to a collection. - -##### Arguments - -- `target_path`: The path of the collection. Path consists of the prefix "wandb-registry-" along with the registry name and the collection name `wandb-registry-{REGISTRY_NAME}/{COLLECTION_NAME}`. -- `aliases`: Add one or more aliases to the linked artifact. The "latest" alias is automatically applied to the most recent artifact you link. - - -##### Raises - -- `ArtifactNotLoggedError`: If the artifact is not logged. - - -### method Artifact.logged_by() - -```python -self -``` - -Get the W&B run that originally logged the artifact. - - - -##### Raises - -- `ArtifactNotLoggedError`: If the artifact is not logged. - - -### method Artifact.new_draft() - -```python -self -``` - -Create a new draft artifact with the same content as this committed artifact. - -Modifying an existing artifact creates a new artifact version known -as an "incremental artifact". The artifact returned can be extended or -modified and logged as a new version. - - - -##### Raises - -- `ArtifactNotLoggedError`: If the artifact is not logged. - - -### method Artifact.new_file() - -```python -self, name: 'str', -mode: 'str' = 'x', -encoding: 'str | None' = None -``` - -Open a new temporary file and add it to the artifact. - -##### Arguments - -- `name`: The name of the new file to add to the artifact. -- `mode`: The file access mode to use to open the new file. -- `encoding`: The encoding used to open the new file. - - -##### Raises - -- `ArtifactFinalizedError`: You cannot make changes to the current artifact version because it is finalized. Log a new artifact version instead. - - -### method Artifact.remove() - -```python -self, -item: 'StrPath | ArtifactManifestEntry' -``` - -Remove an item from the artifact. - -##### Arguments - -- `item`: The item to remove. Can be a specific manifest entry or the name of an artifact-relative path. If the item matches a directory all items in that directory will be removed. - - -##### Raises - -- `ArtifactFinalizedError`: You cannot make changes to the current artifact version because it is finalized. Log a new artifact version instead. -- `FileNotFoundError`: If the item isn't found in the artifact. - - -### method Artifact.save() - -```python -self, -project: 'str | None' = None, -settings: 'wandb.Settings | None' = None -``` - -Persist any changes made to the artifact. - -If currently in a run, that run will log this artifact. If not currently in a -run, a run of type "auto" is created to track this artifact. - -##### Arguments - -- `project`: A project to use for the artifact in the case that a run is not already in context. -- `settings`: A settings object to use when initializing an automatic run. Most commonly used in testing harness. - - - - -### method Artifact.unlink() - -```python -self -``` - -Unlink this artifact if it is a linked member of an artifact collection. - - - -##### Raises - -- `ArtifactNotLoggedError`: If the artifact is not logged. -- `ValueError`: If the artifact is not linked to any collection. - - -### method Artifact.used_by() - -```python -self -``` - -Get a list of the runs that have used this artifact and its linked artifacts. - - - -##### Raises - -- `ArtifactNotLoggedError`: If the artifact is not logged. - - -### method Artifact.verify() - -```python -self, -root: 'str | None' = None +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 ``` -Verify that the contents of an artifact match the manifest. - -All files in the directory are checksummed and the checksums are then -cross-referenced against the artifact's manifest. References are not verified. - -##### Arguments - -- `root`: The directory to verify. If None artifact will be downloaded to './artifacts/self.name/'. - - -##### Raises +## Args -- `ArtifactNotLoggedError`: If the artifact is not logged. -- `ValueError`: If the verification fails. + +A human-readable name for the artifact. Use the name to identify a specific artifact in the W&B App UI or programmatically. You can interactively reference an artifact with the `use_artifact` Public API. A name can contain letters, numbers, underscores, hyphens, and dots. The name must be unique across a project. + + +The artifact's type. Use the type of an artifact to both organize and differentiate artifacts. You can use any string that contains letters, numbers, underscores, hyphens, and dots. Common types include `dataset` or `model`. Include `model` within your type string if you want to link the artifact to the W&B Model Registry. Note that some types reserved for internal use and cannot be set by users. Such types include `job` and types that start with `wandb-`. + -### method Artifact.wait() + +A description of the artifact. For Model or Dataset Artifacts, add documentation for your standardized team model or dataset card. View an artifact's description programmatically with the `Artifact.description` attribute or programmatically with the W&B App UI. W&B renders the description as markdown in the W&B App. + -```python -self, -timeout: 'int | None' = None -``` + +Additional information about an artifact. Specify metadata as a dictionary of key-value pairs. You can specify no more than 100 total keys. + -If needed, wait for this artifact to finish logging. + +Use `Artifact.new_draft()` method instead to modify an existing artifact. + -##### Arguments + +Deprecated. + -- `timeout`: The time, in seconds, to wait. + + diff --git a/models/ref/python/experiments/artifact/artifact-methods.mdx b/models/ref/python/experiments/artifact/artifact-methods.mdx new file mode 100644 index 0000000000..7be57a09e7 --- /dev/null +++ b/models/ref/python/experiments/artifact/artifact-methods.mdx @@ -0,0 +1,741 @@ +--- +title: Artifact methods +sidebarTitle: Methods +page_kind: class-methods +parent_slug: artifact +kind: class +namespace: wandb.sdk.artifacts.artifact +--- + +## Class wandb.Artifact + +## method Artifact.add() + +Add wandb.WBValue `obj` to the artifact. + +```python +self, +obj: 'WBValue', +name: 'StrPath', +overwrite: 'bool' = False +``` + +##### Arguments + + +The object to add. Currently support one of Bokeh, JoinedTable, PartitionedTable, Table, Classes, ImageMask, BoundingBoxes2D, Audio, Image, Video, Html, Object3D + + + +The path within the artifact to add the object. + + + +If True, overwrite existing objects with the same file path if applicable. + + +##### Returns + +The added manifest entry + +##### Raises + + +You cannot make changes to the current artifact version because it is finalized. Log a new artifact version instead. + + +## method Artifact.add_dir() + +Add a local directory to the artifact. + +```python +self, +local_path: 'str', +name: 'str | None' = None, +skip_cache: 'bool | None' = False, +policy: "Literal['mutable', 'immutable'] | None" = 'mutable', +merge: 'bool' = False +``` + +##### Arguments + + +The path of the local directory. + + + +The subdirectory name within an artifact. The name you specify appears in the W&B App UI nested by artifact's `type`. Defaults to the root of the artifact. + + + +If set to `True`, W&B will not copy/move files to the cache while uploading + + + +By default, "mutable". +- mutable: Create a temporary copy of the file to prevent + corruption during upload. +- immutable: Disable protection, rely on the user not to delete + or change the file. + + + +If `False` (default), throws ValueError if a file was already added in a previous add_dir call and its content has changed. If `True`, overwrites existing files with changed content. Always adds new files and never removes files. To replace an entire directory, pass a name when adding the directory using `add_dir(local_path, name=my_prefix)` and call `remove(my_prefix)` to remove the directory, then add it again. + + +##### Raises + + +You cannot make changes to the current artifact version because it is finalized. Log a new artifact version instead. + + + +Policy must be "mutable" or "immutable" + + +## method Artifact.add_file() + +Add a local file to the artifact. + +```python +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 +``` + +##### Arguments + + +The path to the file being added. + + + +The path within the artifact to use for the file being added. Defaults to the basename of the file. + + + +If true, then the file is renamed deterministically to avoid collisions. + + + +If `True`, do not copy files to the cache after uploading. + + + +By default, set to "mutable". If set to "mutable", create a temporary copy of the file to prevent corruption during upload. If set to "immutable", disable protection and rely on the user not to delete or change the file. + + + +If `True`, overwrite the file if it already exists. + + +##### Returns + +The added manifest entry. + +##### Raises + + +You cannot make changes to the current artifact version because it is finalized. Log a new artifact version instead. + + + +Policy must be "mutable" or "immutable" + + +## method Artifact.add_reference() + +Add a reference denoted by a URI to the artifact. + +Unlike files or directories that you add to an artifact, references are not +uploaded to W&B. For more information, +see [Track external files](https://docs.wandb.ai/models/artifacts/track-external-files). + +By default, the following schemes are supported: + +- http(s): The size and digest of the file will be inferred by the + `Content-Length` and the `ETag` response headers returned by the server. +- s3: The checksum and size are pulled from the object metadata. + If bucket versioning is enabled, then the version ID is also tracked. +- gs: The checksum and size are pulled from the object metadata. If bucket + versioning is enabled, then the version ID is also tracked. +- https, domain matching `*.blob.core.windows.net` +- Azure: The checksum and size are be pulled from the blob metadata. + If storage account versioning is enabled, then the version ID is + also tracked. +- file: The checksum and size are pulled from the file system. This scheme + is useful if you have an NFS share or other externally mounted volume + containing files you wish to track but not necessarily upload. + +For any other scheme, the digest is just a hash of the URI and the size is left +blank. + +```python +self, +uri: 'ArtifactManifestEntry | str', +name: 'StrPath | None' = None, +checksum: 'bool' = True, +max_objects: 'int | None' = None +``` + +##### Arguments + + +The URI path of the reference to add. The URI path can be an object returned from `Artifact.get_entry` to store a reference to another artifact's entry. + + + +The path within the artifact to place the contents of this reference. + + + +Whether or not to checksum the resource(s) located at the reference URI. Checksumming is strongly recommended as it enables automatic integrity validation. Disabling checksumming will speed up artifact creation but reference directories will not iterated through so the objects in the directory will not be saved to the artifact. We recommend setting `checksum=False` when adding reference objects, in which case a new version will only be created if the reference URI changes. + + + +The maximum number of objects to consider when adding a reference that points to directory or bucket store prefix. By default, the maximum number of objects allowed for Amazon S3, GCS, Azure, and local files is 10,000,000. Other URI schemas do not have a maximum. + + +##### Returns + +The added manifest entries. + +##### Raises + + +You cannot make changes to the current artifact version because it is finalized. Log a new artifact version instead. + + +## method Artifact.checkout() + +Replace the specified root directory with the contents of the artifact. + +WARNING: This will delete all files in `root` that are not included in the +artifact. + +```python +self, +root: 'str | None' = None +``` + +##### Arguments + + +The directory to replace with this artifact's files. + + +##### Returns + +The path of the checked out contents. + +##### Raises + + +If the artifact is not logged. + + +## method Artifact.delete() + +Delete an artifact and its files. + +If called on a linked artifact, only the link is deleted, and the +source artifact is unaffected. + +Use `Artifact.unlink()` instead of `Artifact.delete()` to remove a +link between a source artifact and a collection. + +```python +self, +delete_aliases: 'bool' = False +``` + +##### Arguments + + +If set to `True`, delete all aliases associated with the artifact. If `False`, raise an exception if the artifact has existing aliases. This parameter is ignored if the artifact is retrieved from a collection it is linked to. + + +##### Raises + + +If the artifact is not logged. + + +## method Artifact.download() + +Download the contents of the artifact to the specified root directory. + +Existing files located within `root` are not modified. Explicitly delete `root` +before you call `download` if you want the contents of `root` to exactly match +the artifact. + +```python +self, +root: 'StrPath | None' = None, +allow_missing_references: 'bool' = False, +skip_cache: 'bool | None' = None, +path_prefix: 'StrPath | None' = None, +multipart: 'bool | None' = None +``` + +##### Arguments + + +The directory W&B stores the artifact's files. + + + +If set to `True`, any invalid reference paths will be ignored while downloading referenced files. + + + +If set to `True`, the artifact cache will be skipped when downloading and W&B will download each file into the default root or specified download directory. + + + +If specified, only files with a path that starts with the given prefix will be downloaded. Uses unix format (forward slashes). + + + +If set to `None` (default), the artifact will be downloaded in parallel using multipart download if individual file size is greater than 2GB. If set to `True` or `False`, the artifact will be downloaded in parallel or serially regardless of the file size. + + +##### Returns + +The path to the downloaded contents. + +##### Raises + + +If the artifact is not logged. + + +## method Artifact.file() + +Download a single file artifact to the directory you specify with `root`. + +```python +self, +root: 'str | None' = None +``` + +##### Arguments + + +The root directory to store the file. Defaults to `./artifacts/self.name/`. + + +##### Returns + +The full path of the downloaded file. + +##### Raises + + +If the artifact is not logged. + + + +If the artifact contains more than one file. + + +## method Artifact.files() + +Iterate over all files stored in this artifact. + +```python +self, +names: 'list[str] | None' = None, +per_page: 'int' = 50, +start: 'str | None' = None +``` + +##### Arguments + + +The filename paths relative to the root of the artifact you wish to list. + + + +The number of files to return per request. + + + +Pagination cursor for resuming a past query, captured from a previous paginator's `.cursor` attribute. + + +##### Returns + +An iterator containing `File` objects. + +##### Raises + + +If the artifact is not logged. + + +## method Artifact.finalize() + +Finalize the artifact version. + +You cannot modify an artifact version once it is finalized because the artifact +is logged as a specific artifact version. Create a new artifact version +to log more data to an artifact. An artifact is automatically finalized +when you log the artifact with `log_artifact`. + +```python +self +``` + +## method Artifact.get() + +Get the WBValue object located at the artifact relative `name`. + +```python +self, +name: 'str' +``` + +##### Arguments + + +The artifact relative name to retrieve. + + +##### Returns + +W&B object that can be logged with `run.log()` and visualized in the W&B UI. + +##### Raises + + +if the artifact isn't logged or the run is offline. + + +## method Artifact.get_added_local_path_name() + +Get the artifact relative name of a file added by a local filesystem path. + +```python +self, +local_path: 'str' +``` + +##### Arguments + + +The local path to resolve into an artifact relative name. + + +##### Returns + +The artifact relative name. + +## method Artifact.get_entry() + +Get the entry with the given name. + +```python +self, +name: 'StrPath' +``` + +##### Arguments + + +The artifact relative name to get + + +##### Returns + +A `W&B` object. + +##### Raises + + +if the artifact isn't logged or the run is offline. + + + +if the artifact doesn't contain an entry with the given name. + + +## method Artifact.get_path() + +Deprecated. Use `get_entry(name)`. + +```python +self, +name: 'StrPath' +``` + +##### Arguments + + + + + +## method Artifact.is_draft() + +Check if artifact is not saved. + +```python +self +``` + +##### Returns + +Boolean. `False` if artifact is saved. `True` if artifact is not saved. + +## method Artifact.json_encode() + +Returns the artifact encoded to the JSON format. + +```python +self +``` + +##### Returns + +A `dict` with `string` keys representing attributes of the artifact. + +## method Artifact.link() + +Link this artifact to a collection. + +```python +self, +target_path: 'str', +aliases: 'Iterable[str] | None' = None +``` + +##### Arguments + + +The path of the collection. Path consists of the prefix "wandb-registry-" along with the registry name and the collection name `wandb-registry-{REGISTRY_NAME}/{COLLECTION_NAME}`. + + + +Add one or more aliases to the linked artifact. The "latest" alias is automatically applied to the most recent artifact you link. + + +##### Returns + +The linked artifact. + +##### Raises + + +If the artifact is not logged. + + +## method Artifact.logged_by() + +Get the W&B run that originally logged the artifact. + +```python +self +``` + +##### Returns + +The name of the W&B run that originally logged the artifact. + +##### Raises + + +If the artifact is not logged. + + +## method Artifact.new_draft() + +Create a new draft artifact with the same content as this committed artifact. + +Modifying an existing artifact creates a new artifact version known +as an "incremental artifact". The artifact returned can be extended or +modified and logged as a new version. + +```python +self +``` + +##### Returns + +An `Artifact` object. + +##### Raises + + +If the artifact is not logged. + + +## method Artifact.new_file() + +Open a new temporary file and add it to the artifact. + +```python +self, +name: 'str', +mode: 'str' = 'x', +encoding: 'str | None' = None +``` + +##### Arguments + + +The name of the new file to add to the artifact. + + + +The file access mode to use to open the new file. + + + +The encoding used to open the new file. + + +##### Returns + +A new file object that can be written to. Upon closing, the file is automatically added to the artifact. + +##### Raises + + +You cannot make changes to the current artifact version because it is finalized. Log a new artifact version instead. + + +## method Artifact.remove() + +Remove an item from the artifact. + +```python +self, +item: 'StrPath | ArtifactManifestEntry' +``` + +##### Arguments + + +The item to remove. Can be a specific manifest entry or the name of an artifact-relative path. If the item matches a directory all items in that directory will be removed. + + +##### Raises + + +You cannot make changes to the current artifact version because it is finalized. Log a new artifact version instead. + + + +If the item isn't found in the artifact. + + +## method Artifact.save() + +Persist any changes made to the artifact. + +If currently in a run, that run will log this artifact. If not currently in a +run, a run of type "auto" is created to track this artifact. + +```python +self, +project: 'str | None' = None, +settings: 'wandb.Settings | None' = None +``` + +##### Arguments + + +A project to use for the artifact in the case that a run is not already in context. + + + +A settings object to use when initializing an automatic run. Most commonly used in testing harness. + + +## method Artifact.unlink() + +Unlink this artifact if it is a linked member of an artifact collection. + +```python +self +``` + +##### Raises + + +If the artifact is not logged. + + + +If the artifact is not linked to any collection. + + +## method Artifact.used_by() + +Get a list of the runs that have used this artifact and its linked artifacts. + +```python +self +``` + +##### Returns + +A list of `Run` objects. + +##### Raises + + +If the artifact is not logged. + + +## method Artifact.verify() + +Verify that the contents of an artifact match the manifest. + +All files in the directory are checksummed and the checksums are then +cross-referenced against the artifact's manifest. References are not verified. + +```python +self, +root: 'str | None' = None +``` + +##### Arguments + + +The directory to verify. If None artifact will be downloaded to './artifacts/self.name/'. + + +##### Raises + + +If the artifact is not logged. + + + +If the verification fails. + + +## method Artifact.wait() + +If needed, wait for this artifact to finish logging. + +```python +self, +timeout: 'int | None' = None +``` + +##### Arguments + + +The time, in seconds, to wait. + + +##### Returns + +An `Artifact` object. + diff --git a/models/ref/python/experiments/artifact/artifact-properties.mdx b/models/ref/python/experiments/artifact/artifact-properties.mdx new file mode 100644 index 0000000000..b567a84ec7 --- /dev/null +++ b/models/ref/python/experiments/artifact/artifact-properties.mdx @@ -0,0 +1,207 @@ +--- +title: Artifact properties +sidebarTitle: Properties +page_kind: class-properties +parent_slug: artifact +kind: class +namespace: wandb.sdk.artifacts.artifact +--- + +## Class wandb.Artifact + +## property aliases + +List of one or more semantically-friendly references or + +identifying "nicknames" assigned to an artifact version. + +Aliases are mutable references that you can programmatically reference. +Change an artifact's alias with the W&B App UI or programmatically. +See [Create new artifact versions](https://docs.wandb.ai/models/artifacts/create-a-new-artifact-version) +for more information. + +## property collection + +The collection this artifact is retrieved from. + +A collection is an ordered group of artifact versions. +If this artifact is retrieved from a collection that it is linked to, +return that collection. Otherwise, return the collection +that the artifact version originates from. + +The collection that an artifact originates from is known as +the source sequence. + +## property commit_hash + +The hash returned when this artifact was committed. + +## property created_at + +Timestamp when the artifact was created. + +## property description + +A description of the artifact. + +## property digest + +The logical digest of the artifact. + +The digest is the checksum of the artifact's contents. If an artifact has the +same digest as the current `latest` version, then `log_artifact` is a no-op. + +## property entity + +The name of the entity that the artifact collection belongs to. + +If the artifact is a link, the entity will be the entity of the linked artifact. + +## property file_count + +The number of files (including references). + +## property history_step + +The nearest step which logged history metrics for this artifact's source run. + +## property id + +The artifact's ID. + +## property is_link + +Boolean flag indicating if the artifact is a link artifact. + +True: The artifact is a link artifact to a source artifact. +False: The artifact is a source artifact. + +## property linked_artifacts + +Returns a list of all the linked artifacts of a source artifact. + +If this artifact is a link artifact (`artifact.is_link == True`), +it will return an empty list. + +Limited to 500 results. + +## property manifest + +The artifact's manifest. + +The manifest lists all of its contents, and can't be changed once the artifact +has been logged. + +## property metadata + +User-defined artifact metadata. + +Structured data associated with the artifact. + +## property name + +The artifact name and version of the artifact. + +A string with the format `{collection}:{alias}`. If fetched before an artifact is +logged/saved, the name won't contain the alias. +If the artifact is a link, the name will be the name of the linked artifact. + +## property project + +The name of the project that the artifact collection belongs to. + +If the artifact is a link, the project will be the project of the linked artifact. + +## property qualified_name + +The entity/project/name of the artifact. + +If the artifact is a link, the qualified name will be the qualified name of the +linked artifact path. + +## property size + +The total size of the artifact in bytes. + +Includes any references tracked by this artifact. + +## property source_artifact + +Returns the source artifact, which is the original logged artifact. + +If this artifact is a source artifact (`artifact.is_link == False`), +it will return itself. + +## property source_collection + +The artifact's source collection. + +The source collection is the collection that the artifact was logged from. + +## property source_entity + +The name of the entity of the source artifact. + +## property source_name + +The artifact name and version of the source artifact. + +A string with the format `{source_collection}:{alias}`. Before the artifact +is saved, contains only the name since the version is not yet known. + +## property source_project + +The name of the project of the source artifact. + +## property source_qualified_name + +The source_entity/source_project/source_name of the source artifact. + +## property source_version + +The source artifact's version. + +A string with the format `v{number}`. + +## property state + +The status of the artifact. One of: "PENDING", "COMMITTED", or "DELETED". + +## property tags + +List of one or more tags assigned to this artifact version. + +## property ttl + +The time-to-live (TTL) policy of an artifact. + +Artifacts are deleted shortly after a TTL policy's duration passes. +If set to `None`, the artifact deactivates TTL policies and will be not +scheduled for deletion, even if there is a team default TTL. +An artifact inherits a TTL policy from +the team default if the team administrator defines a default +TTL and there is no custom policy set on an artifact. + +## property type + +The artifact's type. Common types include `dataset` or `model`. + +## property updated_at + +The time when the artifact was last updated. + +## property url + +Constructs the URL of the artifact. + +## property use_as + +Deprecated. + +## property version + +The artifact's version. + +A string with the format `v{number}`. +If this is a link artifact, the version will be from the linked collection. + diff --git a/models/ref/python/experiments/run.mdx b/models/ref/python/experiments/run.mdx index ec38463e95..922d9cbec4 100644 --- a/models/ref/python/experiments/run.mdx +++ b/models/ref/python/experiments/run.mdx @@ -7,12 +7,11 @@ namespace: wandb.sdk.wandb_run import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.Run - +## Class wandb.Run @@ -43,11 +42,12 @@ created. + + ## Attributes - `summary`: (Summary) A summary of the run, which is a dictionary-like object. For more information, see [Log summary metrics](https://docs.wandb.ai/models/track/log/log-summary). - ## Examples Create a run with `wandb.init()`: @@ -61,1010 +61,3 @@ with wandb.init(entity="entity", project="project") as run: run.log({"accuracy": acc, "loss": loss}) ``` -## Properties - -### property config - -Config object associated with this run. - -### property config_static - -Static config object associated with this run. - -### property dir - -The directory where files associated with the run are saved. - -### property disabled - -True if the run is disabled, False otherwise. - -### property entity - -The name of the W&B entity associated with the run. - -Entity can be a username or the name of a team or organization. - -### property group - -Returns the name of the group associated with this run. - -Grouping runs together allows related experiments to be organized and -visualized collectively in the W&B UI. This is especially useful for -scenarios such as distributed training or cross-validation, where -multiple runs should be viewed and managed as a unified experiment. - -In shared mode, where all processes share the same run object, -setting a group is usually unnecessary, since there is only one -run and no grouping is required. - -### property id - -Identifier for this run. - -### property job_type - -Name of the job type associated with the run. - -View a run's job type in the run's Overview page in the W&B App. - -You can use this to categorize runs by their job type, such as -"training", "evaluation", or "inference". This is useful for organizing -and filtering runs in the W&B UI, especially when you have multiple -runs with different job types in the same project. For more -information, see [Organize runs](https://docs.wandb.ai/models/runs#organize-runs). - -### property name - -Display name of the run. - -Display names are not guaranteed to be unique and may be descriptive. -By default, they are randomly generated. - -### property notes - -Notes associated with the run, if there are any. - -Notes can be a multiline string and can also use markdown and latex -equations inside `$$`, like `$x + 3$`. - -### property offline - -True if the run is offline, False otherwise. - -### property path - -Path to the run. - -Run paths include entity, project, and run ID, in the format -`entity/project/run_id`. - -### property project - -Name of the W&B project associated with the run. - -### property project_url - -URL of the W&B project associated with the run, if there is one. - -Offline runs do not have a project URL. - -### property resumed - -True if the run was resumed, False otherwise. - -### property settings - -A frozen copy of run's Settings object. - -### property start_time - -Unix timestamp (in seconds) of when the run started. - -### property step - -The W&B step of the next `log()` call. - -Raises an error in mode="shared" runs. - -### property sweep_id - -Identifier for the sweep associated with the run, if there is one. - -### property sweep_url - -URL of the sweep associated with the run, if there is one. - -Offline runs do not have a sweep URL. - -### property tags - -Tags associated with the run, if there are any. - -### property url - -The url for the W&B run, if there is one. - -Offline runs will not have a url. - - - -## Methods - -### method Run.alert() - -```python -self, -title: 'str', -text: 'str', -level: 'str | AlertLevel | None' = None, -wait_duration: 'int | float | timedelta | None' = None -``` - -Create an alert with the given title and text. - -##### Arguments - -- `title`: The title of the alert, must be less than 64 characters long. -- `text`: The text body of the alert. -- `level`: The alert level to use, either: `INFO`, `WARN`, or `ERROR`. -- `wait_duration`: The time to wait (in seconds) before sending another alert with this title. - - - - -### method Run.define_metric() - -```python -self, -name: 'str', -step_metric: 'str | wandb_metric.Metric | None' = None, -step_sync: 'bool | None' = None, -hidden: 'bool | None' = None, -summary: 'str | None' = None, -goal: 'str | None' = None, -overwrite: 'bool | None' = None -``` - -Customize metrics logged with `wandb.Run.log()`. - -##### Arguments - -- `name`: The name of the metric to customize. -- `step_metric`: The name of another metric to serve as the X-axis for this metric in automatically generated charts. -- `step_sync`: Automatically insert the last value of step_metric into `wandb.Run.log()` if it is not provided explicitly. Defaults to True if step_metric is specified. -- `hidden`: Hide this metric from automatic plots. -- `summary`: Specify aggregate metrics added to summary. Supported aggregations include "min", "max", "mean", "last", "first", "best", "copy" and "none". "none" prevents a summary from being generated. "best" is used together with the goal parameter, "best" is deprecated and should not be used, use "min" or "max" instead. "copy" is deprecated and should not be used. -- `goal`: Specify how to interpret the "best" summary type. Supported options are "minimize" and "maximize". "goal" is deprecated and should not be used, use "min" or "max" instead. -- `overwrite`: If false, then this call is merged with previous `define_metric` calls for the same metric by using their values for any unspecified parameters. If true, then unspecified parameters overwrite values specified by previous calls. - - - - -### method Run.display() - -```python -self, -height: 'int' = 420, -hidden: 'bool' = False -``` - -Display this run in Jupyter. - -##### Arguments - -- `height`: -- `hidden`: - - - - -### method Run.finish() - -```python -self, -exit_code: 'int | None' = None, -quiet: 'bool | None' = None -``` - -Finish a run and upload any remaining data. - -Marks the completion of a W&B run and ensures all data is synced to the server. -The run's final state is determined by its exit conditions and sync status. - -Run States: -- Running: Active run that is logging data and/or sending heartbeats. -- Crashed: Run that stopped sending heartbeats unexpectedly. -- Finished: Run completed successfully (`exit_code=0`) with all data synced. -- Failed: Run completed with errors (`exit_code!=0`). -- Killed: Run was forcibly stopped before it could finish. - -##### Arguments - -- `exit_code`: Integer indicating the run's exit status. Use 0 for success, any other value marks the run as failed. -- `quiet`: Deprecated. Configure logging verbosity using `wandb.Settings(quiet=...)`. - - - - -### method Run.finish_artifact() - -```python -self, -artifact_or_path: 'Artifact | str', -name: 'str | None' = None, -type: 'str | None' = None, -aliases: 'list[str] | None' = None, -distributed_id: 'str | None' = None -``` - -Finishes a non-finalized artifact as output of a run. - -Subsequent "upserts" with the same distributed ID will result in a new version. - -##### Arguments - -- `artifact_or_path`: A path to the contents of this artifact, - can be in the following forms: - - `/local/directory` - - `/local/directory/file.txt` - - `s3://bucket/path` - You can also pass an Artifact object created by calling - `wandb.Artifact`. -- `name`: An artifact name. May be prefixed with entity/project. - Valid names can be in the following forms: - - name:version - - name:alias - - digest - This will default to the basename of the path prepended with the current - run id if not specified. -- `type`: The type of artifact to log, examples include `dataset`, `model` -- `aliases`: Aliases to apply to this artifact, defaults to `["latest"]` -- `distributed_id`: Unique string that all distributed jobs share. If None, defaults to the run's group name. - - - - -### method Run.link_artifact() - -```python -self, -artifact: 'Artifact', -target_path: 'str', -aliases: 'list[str] | None' = None -``` - -Link the artifact to a collection. - -The term “link” refers to pointers that connect where W&B stores the -artifact and where the artifact is accessible in the registry. W&B -does not duplicate artifacts when you link an artifact to a collection. - -View linked artifacts in the Registry UI for the specified collection. - -##### Arguments - -- `artifact`: The artifact object to link to the collection. -- `target_path`: The path of the collection. Path consists of the prefix "wandb-registry-" along with the registry name and the collection name `wandb-registry-{REGISTRY_NAME}/{COLLECTION_NAME}`. -- `aliases`: Add one or more aliases to the linked artifact. The "latest" alias is automatically applied to the most recent artifact you link. - - - - -### method Run.link_model() - -```python -self, -path: 'StrPath', -registered_model_name: 'str', -name: 'str | None' = None, -aliases: 'list[str] | None' = None -``` - -Log a model artifact version and link it to a registered model in the model registry. - -Linked model versions are visible in the UI for the specified registered model. - -This method will: -- Check if 'name' model artifact has been logged. If so, use the artifact version that matches the files -located at 'path' or log a new version. Otherwise log files under 'path' as a new model artifact, 'name' -of type 'model'. -- Check if registered model with name 'registered_model_name' exists in the 'model-registry' project. -If not, create a new registered model with name 'registered_model_name'. -- Link version of model artifact 'name' to registered model, 'registered_model_name'. -- Attach aliases from 'aliases' list to the newly linked model artifact version. - -##### Arguments - -- `path`: (str) A path to the contents of this model, can be in the - following forms: - - `/local/directory` - - `/local/directory/file.txt` - - `s3://bucket/path` -- `registered_model_name`: The name of the registered model that the model is to be linked to. A registered model is a collection of model versions linked to the model registry, typically representing a team's specific ML Task. The entity that this registered model belongs to will be derived from the run. -- `name`: The name of the model artifact that files in 'path' will be logged to. This will default to the basename of the path prepended with the current run id if not specified. -- `aliases`: Aliases that will only be applied on this linked artifact inside the registered model. The alias "latest" will always be applied to the latest version of an artifact that is linked. - - -##### Raises - -- `AssertionError`: If registered_model_name is a path or if model artifact 'name' is of a type that does not contain the substring 'model'. -- `ValueError`: If name has invalid special characters. - - -### method Run.log() - -```python -self, -data: 'dict[str, Any]', -step: 'int | None' = None, -commit: 'bool | None' = None -``` - -Upload run data. - -Use `log` to log data from runs, such as scalars, images, video, -histograms, plots, and tables. See [Log objects and media](https://docs.wandb.ai/models/track/log) for -code snippets, best practices, and more. - -Basic usage: - -```python -import wandb - -with wandb.init() as run: - run.log({"train-loss": 0.5, "accuracy": 0.9}) -``` - -The previous code snippet saves the loss and accuracy to the run's -history and updates the summary values for these metrics. - -Visualize logged data in a workspace at [wandb.ai](https://wandb.ai), -or locally on a [self-hosted instance](https://docs.wandb.ai/platform/hosting) -of the W&B app, or export data to visualize and explore locally, such as in a -Jupyter notebook, with the [Public API](https://docs.wandb.ai/models/track/public-api-guide). - -Logged values don't have to be scalars. You can log any -[W&B supported Data Type](https://docs.wandb.ai/models/ref/python/data-types) -such as images, audio, video, and more. For example, you can use -`wandb.Table` to log structured data. See -[Log tables, visualize and query data](https://docs.wandb.ai/models/tables/tables-walkthrough) -tutorial for more details. - -W&B organizes metrics with a forward slash (`/`) in their name -into sections named using the text before the final slash. For example, -the following results in two sections named "train" and "validate": - -```python -with wandb.init() as run: - # Log metrics in the "train" section. - run.log( - { - "train/accuracy": 0.9, - "train/loss": 30, - "validate/accuracy": 0.8, - "validate/loss": 20, - } - ) -``` - -Only one level of nesting is supported; `run.log({"a/b/c": 1})` -produces a section named "a". - -`run.log()` is not intended to be called more than a few times per second. -For optimal performance, limit your logging to once every N iterations, -or collect data over multiple iterations and log it in a single step. - -By default, each call to `log` creates a new "step". -The step must always increase, and it is not possible to log -to a previous step. You can use any metric as the X axis in charts. -See [Custom log axes](https://docs.wandb.ai/models/track/log/customize-logging-axes) -for more details. - -In many cases, it is better to treat the W&B step like -you'd treat a timestamp rather than a training step. - -```python -with wandb.init() as run: - # Example: log an "epoch" metric for use as an X axis. - run.log({"epoch": 40, "train-loss": 0.5}) -``` - -It is possible to use multiple `wandb.Run.log()` invocations to log to -the same step with the `step` and `commit` parameters. -The following are all equivalent: - -```python -with wandb.init() as run: - # Normal usage: - run.log({"train-loss": 0.5, "accuracy": 0.8}) - run.log({"train-loss": 0.4, "accuracy": 0.9}) - - # Implicit step without auto-incrementing: - run.log({"train-loss": 0.5}, commit=False) - run.log({"accuracy": 0.8}) - run.log({"train-loss": 0.4}, commit=False) - run.log({"accuracy": 0.9}) - - # Explicit step: - run.log({"train-loss": 0.5}, step=current_step) - run.log({"accuracy": 0.8}, step=current_step) - current_step += 1 - run.log({"train-loss": 0.4}, step=current_step) - run.log({"accuracy": 0.9}, step=current_step, commit=True) -``` - -##### Arguments - -- `data`: A `dict` with `str` keys and values that are serializable Python objects including: `int`, `float` and `string`; any of the `wandb.data_types`; lists, tuples and NumPy arrays of serializable Python objects; other `dict`s of this structure. -- `step`: The step number to log. If `None`, then an implicit auto-incrementing step is used. See the notes in the description. -- `commit`: If true, finalize and upload the step. If false, then accumulate data for the step. See the notes in the description. If `step` is `None`, then the default is `commit=True`; otherwise, the default is `commit=False`. - - -##### Raises - -- `wandb.Error`: If called before `wandb.init()`. -- `ValueError`: If invalid data is passed. - - -##### Examples - -For more and more detailed examples, see -[our guides to logging](https://docs.wandb.ai/models/track/log). - -Basic usage - -```python -import wandb - -with wandb.init() as run: - run.log({"train-loss": 0.5, "accuracy": 0.9 -``` - -Incremental logging - -```python -import wandb - -with wandb.init() as run: - run.log({"loss": 0.2}, commit=False) - # Somewhere else when I'm ready to report this step: - run.log({"accuracy": 0.8}) -``` - -Histogram - -```python -import numpy as np -import wandb - -# sample gradients at random from normal distribution -gradients = np.random.randn(100, 100) -with wandb.init() as run: - run.log({"gradients": wandb.Histogram(gradients)}) -``` - -Image from NumPy - -```python -import numpy as np -import wandb - -with wandb.init() as run: - examples = [] - for i in range(3): - pixels = np.random.randint(low=0, high=256, size=(100, 100, 3)) - image = wandb.Image(pixels, caption=f"random field {i}") - examples.append(image) - run.log({"examples": examples}) -``` - -Image from PIL - -```python -import numpy as np -from PIL import Image as PILImage -import wandb - -with wandb.init() as run: - examples = [] - for i in range(3): - pixels = np.random.randint( - low=0, - high=256, - size=(100, 100, 3), - dtype=np.uint8, - ) - pil_image = PILImage.fromarray(pixels, mode="RGB") - image = wandb.Image(pil_image, caption=f"random field {i}") - examples.append(image) - run.log({"examples": examples}) -``` - -Video from NumPy - -```python -import numpy as np -import wandb - -with wandb.init() as run: - # axes are (time, channel, height, width) - frames = np.random.randint( - low=0, - high=256, - size=(10, 3, 100, 100), - dtype=np.uint8, - ) - run.log({"video": wandb.Video(frames, fps=4)}) -``` - -Matplotlib plot - -```python -from matplotlib import pyplot as plt -import numpy as np -import wandb - -with wandb.init() as run: - fig, ax = plt.subplots() - x = np.linspace(0, 10) - y = x * x - ax.plot(x, y) # plot y = x^2 - run.log({"chart": fig}) -``` - -PR Curve - -```python -import wandb - -with wandb.init() as run: - run.log({"pr": wandb.plot.pr_curve(y_test, y_probas, labels)}) -``` - -3D Object - -```python -import wandb - -with wandb.init() as run: - run.log( - { - "generated_samples": [ - wandb.Object3D(open("sample.obj")), - wandb.Object3D(open("sample.gltf")), - wandb.Object3D(open("sample.glb")), - ] - } - ) -``` - -### method Run.log_artifact() - -```python -self, -artifact_or_path: 'Artifact | StrPath', -name: 'str | None' = None, -type: 'str | None' = None, -aliases: 'list[str] | None' = None, -tags: 'list[str] | None' = None -``` - -Declare an artifact as an output of a run. - -##### Arguments - -- `artifact_or_path`: (str or Artifact) A path to the contents of this artifact, - can be in the following forms: - - `/local/directory` - - `/local/directory/file.txt` - - `s3://bucket/path` - You can also pass an Artifact object created by calling - `wandb.Artifact`. -- `name`: (str, optional) An artifact name. Valid names can be in the following forms: - - name:version - - name:alias - - digest - This will default to the basename of the path prepended with the current - run id if not specified. -- `type`: (str) The type of artifact to log, examples include `dataset`, `model` -- `aliases`: (list, optional) Aliases to apply to this artifact, defaults to `["latest"]` -- `tags`: (list, optional) Tags to apply to this artifact, if any. - - - - -### method Run.log_code() - -```python -self, -root: 'str | None' = '.', -name: 'str | None' = None, -include_fn: 'Callable[[str, str], bool] | Callable[[str], bool]' = _is_py_requirements_or_dockerfile, -exclude_fn: 'Callable[[str, str], bool] | Callable[[str], bool]' = exclude_wandb_fn -``` - -Save the current state of your code to a W&B Artifact. - -By default, it walks the current directory and logs all files that end with `.py`. - -##### Arguments - -- `root`: The relative (to `os.getcwd()`) or absolute path to recursively find code from. -- `name`: (str, optional) The name of our code artifact. By default, we'll name the artifact `source-$PROJECT_ID-$ENTRYPOINT_RELPATH`. There may be scenarios where you want many runs to share the same artifact. Specifying name allows you to achieve that. -- `include_fn`: A callable that accepts a file path and (optionally) root path and returns True when it should be included and False otherwise. This defaults to `lambda path, root: path.endswith(".py")`. -- `exclude_fn`: A callable that accepts a file path and (optionally) root path and returns `True` when it should be excluded and `False` otherwise. This defaults to a function that excludes all files within `/.wandb/` and `/wandb/` directories. - - - - -##### Examples - -Basic usage - -```python -import wandb - -with wandb.init() as run: - run.log_code() -``` - -Advanced usage - -```python -import wandb - -with wandb.init() as run: - run.log_code( - root="../", - include_fn=lambda path: path.endswith(".py") or path.endswith(".ipynb"), - exclude_fn=lambda path, root: os.path.relpath(path, root).startswith( - "cache/" - ), - ) -``` - -### method Run.log_model() - -```python -self, -path: 'StrPath', -name: 'str | None' = None, -aliases: 'list[str] | None' = None -``` - -Logs a model artifact containing the contents inside the 'path' to a run and marks it as an output to this run. - -The name of model artifact can only contain alphanumeric characters, -underscores, and hyphens. - -##### Arguments - -- `path`: (str) A path to the contents of this model, - can be in the following forms: - - `/local/directory` - - `/local/directory/file.txt` - - `s3://bucket/path` -- `name`: A name to assign to the model artifact that the file contents will be added to. This will default to the basename of the path prepended with the current run id if not specified. -- `aliases`: Aliases to apply to the created model artifact, defaults to `["latest"]` - - -##### Raises - -- `ValueError`: If name has invalid special characters. - - -### method Run.mark_preempting() - -```python -self -``` - -Mark this run as preempting. - -Also tells the internal process to immediately report this to server. - - - - - -### method Run.pin_config_keys() - -```python -self, -keys: 'Sequence[str]' = () -``` - -Pin config keys to display in the References section on Run Overview. - -Pinned keys appear prominently above Notes on the Run Overview page. -String values are rendered as markdown; non-strings are rendered as -plain text. Calling this again replaces the previously pinned list. - -##### Arguments - -- `keys`: Config key names to pin, matching keys set via ``run.config``. These are exact key strings (dots and slashes are treated literally, not as path separators). Order is preserved and determines display order. - - - - -### method Run.restore() - -```python -self, -name: 'str', -run_path: 'str | None' = None, -replace: 'bool' = False, -root: 'str | None' = None -``` - -Download the specified file from cloud storage. - -File is placed into the current directory or run directory. -By default, will only download the file if it doesn't already exist. - -##### Arguments - -- `name`: The name of the file. -- `run_path`: Optional path to a run to pull files from, i.e. `username/project_name/run_id` if wandb.init has not been called, this is required. -- `replace`: Whether to download the file even if it already exists locally -- `root`: The directory to download the file to. Defaults to the current directory or the run directory if wandb.init was called. - - -##### Raises - -- `CommError`: If W&B can't connect to the W&B backend. -- `ValueError`: If the file is not found or can't find run_path. - - -### method Run.save() - -```python -self, -glob_str: 'str | os.PathLike', -base_path: 'str | os.PathLike | None' = None, -policy: 'PolicyName' = 'live', -glob: 'bool' = True -``` - -Sync one or more files to W&B. - -Relative paths are relative to the current working directory. - -A Unix glob, such as "myfiles/*", is expanded at the time `save` is -called regardless of the `policy`. In particular, new files are not -picked up automatically. - -`glob_str` is expanded using Python's `glob` module: see -https://docs.python.org/3/library/glob.html for the exact syntax and -behavior. Notably, the characters `*`, `?`, and `[]` are treated as -glob metacharacters, not literal characters, even if they appear in a -real filename (e.g. "myfile[1].txt"). If your file's name contains -any of these characters and you want to match it literally rather -than as a pattern, either escape it yourself with `glob.escape()` -before calling `save`, or pass `glob=False` to disable pattern -expansion entirely and treat `glob_str` as a literal path. - -A `base_path` may be provided to control the directory structure of -uploaded files. It should be a prefix of `glob_str`, and the directory -structure beneath it is preserved. - -When given an absolute path or glob and no `base_path`, one -directory level is preserved as in the example above. - -Files are automatically deduplicated: calling `save()` multiple times -on the same file without modifications will not re-upload it. - -##### Arguments - -- `glob_str`: A relative or absolute path or Unix glob. -- `base_path`: A path to use to infer a directory structure; see examples. -- `policy`: One of `live`, `now`, or `end`. - - live: upload the file as it changes, overwriting the previous version - - now: upload the file once now - - end: upload file when the run ends -- `glob`: Whether to treat `glob_str` as a glob pattern. Defaults to `True` for backward compatibility. Set to `False` to treat `glob_str` as a literal path, e.g. when its name contains glob metacharacters like `[`, `]`, `*`, or `?` that you don't want interpreted as a pattern. - - - - -### method Run.status() - -```python -self -``` - -Get sync info from the internal backend, about the current run's sync status. - - - - - -### method Run.unwatch() - -```python -self, -models: 'torch.nn.Module | Sequence[torch.nn.Module] | None' = None -``` - -Remove pytorch model topology, gradient and parameter hooks. - -##### Arguments - -- `models`: Optional list of pytorch models that have had watch called on them. - - - - -### method Run.upsert_artifact() - -```python -self, -artifact_or_path: 'Artifact | str', -name: 'str | None' = None, -type: 'str | None' = None, -aliases: 'list[str] | None' = None, -distributed_id: 'str | None' = None -``` - -Declare (or append to) a non-finalized artifact as output of a run. - -Note that you must call run.finish_artifact() to finalize the artifact. -This is useful when distributed jobs need to all contribute to the same artifact. - -##### Arguments - -- `artifact_or_path`: A path to the contents of this artifact, - can be in the following forms: - - `/local/directory` - - `/local/directory/file.txt` - - `s3://bucket/path` -- `name`: An artifact name. May be prefixed with "entity/project". Defaults - to the basename of the path prepended with the current run ID - if not specified. Valid names can be in the following forms: - - name:version - - name:alias - - digest -- `type`: The type of artifact to log. Common examples include `dataset`, `model`. -- `aliases`: Aliases to apply to this artifact, defaults to `["latest"]`. -- `distributed_id`: Unique string that all distributed jobs share. If None, defaults to the run's group name. - - - - -### method Run.use_artifact() - -```python -self, -artifact_or_name: 'str | Artifact', -type: 'str | None' = None, -aliases: 'list[str] | None' = None, -use_as: 'str | None' = None -``` - -Declare an artifact as an input to a run. - -Call `download` or `file` on the returned object to get the contents locally. - -##### Arguments - -- `artifact_or_name`: The name of the artifact to use. May be prefixed - with the name of the project the artifact was logged to - ("entity" or "entity/project"). If no - entity is specified in the name, the Run or API setting's entity is used. - Valid names can be in the following forms - - name:version - - name:alias -- `type`: The type of artifact to use. -- `aliases`: Aliases to apply to this artifact -- `use_as`: This argument is deprecated and does nothing. - - - - -##### Examples - -```python -import wandb - -run = wandb.init(project="") - -# Use an artifact by name and alias -artifact_a = run.use_artifact(artifact_or_name=":") - -# Use an artifact by name and version -artifact_b = run.use_artifact(artifact_or_name=":v") - -# Use an artifact by entity/project/name:alias -artifact_c = run.use_artifact( - artifact_or_name="//:" -) - -# Use an artifact by entity/project/name:version -artifact_d = run.use_artifact( - artifact_or_name="//:v" -) - -# Explicitly finish the run since a context manager is not used. -run.finish() -``` - -### method Run.use_model() - -```python -self, -name: 'str' -``` - -Download the files logged in a model artifact 'name'. - -##### Arguments - -- `name`: A model artifact name. 'name' must match the name of an existing logged - model artifact. May be prefixed with `entity/project/`. Valid names - can be in the following forms - - model_artifact_name:version - - model_artifact_name:alias - - -##### Raises - -- `AssertionError`: If model artifact 'name' is of a type that does not contain the substring 'model'. - - -### method Run.watch() - -```python -self, -models: 'torch.nn.Module | Sequence[torch.nn.Module]', -criterion: 'torch.F | None' = None, -log: "Literal['gradients', 'parameters', 'all'] | None" = 'gradients', -log_freq: 'int' = 1000, -idx: 'int | None' = None, -log_graph: 'bool' = False -``` - -Hook into given PyTorch model to monitor gradients and the model's computational graph. - -This function can track parameters, gradients, or both during training. - -##### Arguments - -- `models`: A single model or a sequence of models to be monitored. -- `criterion`: The loss function being optimized (optional). -- `log`: Specifies whether to log "gradients", "parameters", or "all". Set to None to disable logging. (default="gradients"). -- `log_freq`: Frequency (in batches) to log gradients and parameters. (default=1000) -- `idx`: Index used when tracking multiple models with `wandb.watch`. (default=None) -- `log_graph`: Whether to log the model's computational graph. (default=False) - - -##### Raises - -- `ValueError`: If `wandb.init()` has not been called or if any of the models are not instances of `torch.nn.Module`. - - -### method Run.write_logs() - -```python -self, -text: 'str' -``` - -Write text to the run's Logs tab. - -Use `write_logs` to directly write text to the Logs tab instead of -relying on automatic stdout/stderr capture. Calls after the run has -finished are silently ignored. - -Consider using the `capture_loggers` setting which integrates with -Python's `logging` module. - -##### Arguments - -- `text`: The text to write. A trailing newline is added if not present. - - - - - - diff --git a/models/ref/python/experiments/run/run-methods.mdx b/models/ref/python/experiments/run/run-methods.mdx new file mode 100644 index 0000000000..a67e112376 --- /dev/null +++ b/models/ref/python/experiments/run/run-methods.mdx @@ -0,0 +1,1080 @@ +--- +title: Run methods +sidebarTitle: Methods +page_kind: class-methods +parent_slug: run +kind: class +namespace: wandb.sdk.wandb_run +--- + +## Class wandb.Run + +## method Run.alert() + +Create an alert with the given title and text. + +```python +self, +title: 'str', +text: 'str', +level: 'str | AlertLevel | None' = None, +wait_duration: 'int | float | timedelta | None' = None +``` + +##### Arguments + + +The title of the alert, must be less than 64 characters long. + + + +The text body of the alert. + + + +The alert level to use, either: `INFO`, `WARN`, or `ERROR`. + + + +The time to wait (in seconds) before sending another alert with this title. + + +## method Run.define_metric() + +Customize metrics logged with `wandb.Run.log()`. + +```python +self, +name: 'str', +step_metric: 'str | wandb_metric.Metric | None' = None, +step_sync: 'bool | None' = None, +hidden: 'bool | None' = None, +summary: 'str | None' = None, +goal: 'str | None' = None, +overwrite: 'bool | None' = None +``` + +##### Arguments + + +The name of the metric to customize. + + + +The name of another metric to serve as the X-axis for this metric in automatically generated charts. + + + +Automatically insert the last value of step_metric into `wandb.Run.log()` if it is not provided explicitly. Defaults to True if step_metric is specified. + + + +Hide this metric from automatic plots. + + + +Specify aggregate metrics added to summary. Supported aggregations include "min", "max", "mean", "last", "first", "best", "copy" and "none". "none" prevents a summary from being generated. "best" is used together with the goal parameter, "best" is deprecated and should not be used, use "min" or "max" instead. "copy" is deprecated and should not be used. + + + +Specify how to interpret the "best" summary type. Supported options are "minimize" and "maximize". "goal" is deprecated and should not be used, use "min" or "max" instead. + + + +If false, then this call is merged with previous `define_metric` calls for the same metric by using their values for any unspecified parameters. If true, then unspecified parameters overwrite values specified by previous calls. + + +##### Returns + +An object that represents this call but can otherwise be discarded. + +## method Run.display() + +Display this run in Jupyter. + +```python +self, +height: 'int' = 420, +hidden: 'bool' = False +``` + +##### Arguments + + + + + + + + + +## method Run.finish() + +Finish a run and upload any remaining data. + +Marks the completion of a W&B run and ensures all data is synced to the server. +The run's final state is determined by its exit conditions and sync status. + +Run States: +- Running: Active run that is logging data and/or sending heartbeats. +- Crashed: Run that stopped sending heartbeats unexpectedly. +- Finished: Run completed successfully (`exit_code=0`) with all data synced. +- Failed: Run completed with errors (`exit_code!=0`). +- Killed: Run was forcibly stopped before it could finish. + +```python +self, +exit_code: 'int | None' = None, +quiet: 'bool | None' = None +``` + +##### Arguments + + +Integer indicating the run's exit status. Use 0 for success, any other value marks the run as failed. + + + +Deprecated. Configure logging verbosity using `wandb.Settings(quiet=...)`. + + +## method Run.finish_artifact() + +Finishes a non-finalized artifact as output of a run. + +Subsequent "upserts" with the same distributed ID will result in a new version. + +```python +self, +artifact_or_path: 'Artifact | str', +name: 'str | None' = None, +type: 'str | None' = None, +aliases: 'list[str] | None' = None, +distributed_id: 'str | None' = None +``` + +##### Arguments + + +A path to the contents of this artifact, +can be in the following forms: + - `/local/directory` + - `/local/directory/file.txt` + - `s3://bucket/path` +You can also pass an Artifact object created by calling +`wandb.Artifact`. + + + +An artifact name. May be prefixed with entity/project. +Valid names can be in the following forms: + - name:version + - name:alias + - digest +This will default to the basename of the path prepended with the current +run id if not specified. + + + +The type of artifact to log, examples include `dataset`, `model` + + + +Aliases to apply to this artifact, defaults to `["latest"]` + + + +Unique string that all distributed jobs share. If None, defaults to the run's group name. + + +##### Returns + +An `Artifact` object. + +## method Run.link_artifact() + +Link the artifact to a collection. + +The term “link” refers to pointers that connect where W&B stores the +artifact and where the artifact is accessible in the registry. W&B +does not duplicate artifacts when you link an artifact to a collection. + +View linked artifacts in the Registry UI for the specified collection. + +```python +self, +artifact: 'Artifact', +target_path: 'str', +aliases: 'list[str] | None' = None +``` + +##### Arguments + + +The artifact object to link to the collection. + + + +The path of the collection. Path consists of the prefix "wandb-registry-" along with the registry name and the collection name `wandb-registry-{REGISTRY_NAME}/{COLLECTION_NAME}`. + + + +Add one or more aliases to the linked artifact. The "latest" alias is automatically applied to the most recent artifact you link. + + +##### Returns + +The linked artifact. + +## method Run.link_model() + +Log a model artifact version and link it to a registered model in the model registry. + +Linked model versions are visible in the UI for the specified registered model. + +This method will: +- Check if 'name' model artifact has been logged. If so, use the artifact version that matches the files +located at 'path' or log a new version. Otherwise log files under 'path' as a new model artifact, 'name' +of type 'model'. +- Check if registered model with name 'registered_model_name' exists in the 'model-registry' project. +If not, create a new registered model with name 'registered_model_name'. +- Link version of model artifact 'name' to registered model, 'registered_model_name'. +- Attach aliases from 'aliases' list to the newly linked model artifact version. + +```python +self, +path: 'StrPath', +registered_model_name: 'str', +name: 'str | None' = None, +aliases: 'list[str] | None' = None +``` + +##### Arguments + + +(str) A path to the contents of this model, can be in the +following forms: +- `/local/directory` +- `/local/directory/file.txt` +- `s3://bucket/path` + + + +The name of the registered model that the model is to be linked to. A registered model is a collection of model versions linked to the model registry, typically representing a team's specific ML Task. The entity that this registered model belongs to will be derived from the run. + + + +The name of the model artifact that files in 'path' will be logged to. This will default to the basename of the path prepended with the current run id if not specified. + + + +Aliases that will only be applied on this linked artifact inside the registered model. The alias "latest" will always be applied to the latest version of an artifact that is linked. + + +##### Returns + +The linked artifact if linking was successful, otherwise `None`. + +##### Raises + + +If registered_model_name is a path or if model artifact 'name' is of a type that does not contain the substring 'model'. + + + +If name has invalid special characters. + + +## method Run.log() + +Upload run data. + +Use `log` to log data from runs, such as scalars, images, video, +histograms, plots, and tables. See [Log objects and media](https://docs.wandb.ai/models/track/log) for +code snippets, best practices, and more. + +Basic usage: + +```python +import wandb + +with wandb.init() as run: + run.log({"train-loss": 0.5, "accuracy": 0.9}) +``` + +The previous code snippet saves the loss and accuracy to the run's +history and updates the summary values for these metrics. + +Visualize logged data in a workspace at [wandb.ai](https://wandb.ai), +or locally on a [self-hosted instance](https://docs.wandb.ai/platform/hosting) +of the W&B app, or export data to visualize and explore locally, such as in a +Jupyter notebook, with the [Public API](https://docs.wandb.ai/models/track/public-api-guide). + +Logged values don't have to be scalars. You can log any +[W&B supported Data Type](https://docs.wandb.ai/models/ref/python/data-types) +such as images, audio, video, and more. For example, you can use +`wandb.Table` to log structured data. See +[Log tables, visualize and query data](https://docs.wandb.ai/models/tables/tables-walkthrough) +tutorial for more details. + +W&B organizes metrics with a forward slash (`/`) in their name +into sections named using the text before the final slash. For example, +the following results in two sections named "train" and "validate": + +```python +with wandb.init() as run: + # Log metrics in the "train" section. + run.log( + { + "train/accuracy": 0.9, + "train/loss": 30, + "validate/accuracy": 0.8, + "validate/loss": 20, + } + ) +``` + +Only one level of nesting is supported; `run.log({"a/b/c": 1})` +produces a section named "a". + +`run.log()` is not intended to be called more than a few times per second. +For optimal performance, limit your logging to once every N iterations, +or collect data over multiple iterations and log it in a single step. + +By default, each call to `log` creates a new "step". +The step must always increase, and it is not possible to log +to a previous step. You can use any metric as the X axis in charts. +See [Custom log axes](https://docs.wandb.ai/models/track/log/customize-logging-axes) +for more details. + +In many cases, it is better to treat the W&B step like +you'd treat a timestamp rather than a training step. + +```python +with wandb.init() as run: + # Example: log an "epoch" metric for use as an X axis. + run.log({"epoch": 40, "train-loss": 0.5}) +``` + +It is possible to use multiple `wandb.Run.log()` invocations to log to +the same step with the `step` and `commit` parameters. +The following are all equivalent: + +```python +with wandb.init() as run: + # Normal usage: + run.log({"train-loss": 0.5, "accuracy": 0.8}) + run.log({"train-loss": 0.4, "accuracy": 0.9}) + + # Implicit step without auto-incrementing: + run.log({"train-loss": 0.5}, commit=False) + run.log({"accuracy": 0.8}) + run.log({"train-loss": 0.4}, commit=False) + run.log({"accuracy": 0.9}) + + # Explicit step: + run.log({"train-loss": 0.5}, step=current_step) + run.log({"accuracy": 0.8}, step=current_step) + current_step += 1 + run.log({"train-loss": 0.4}, step=current_step) + run.log({"accuracy": 0.9}, step=current_step, commit=True) +``` + +```python +self, +data: 'dict[str, Any]', +step: 'int | None' = None, +commit: 'bool | None' = None +``` + +##### Arguments + + +A `dict` with `str` keys and values that are serializable Python objects including: `int`, `float` and `string`; any of the `wandb.data_types`; lists, tuples and NumPy arrays of serializable Python objects; other `dict`s of this structure. + + + +The step number to log. If `None`, then an implicit auto-incrementing step is used. See the notes in the description. + + + +If true, finalize and upload the step. If false, then accumulate data for the step. See the notes in the description. If `step` is `None`, then the default is `commit=True`; otherwise, the default is `commit=False`. + + +##### Raises + + +If called before `wandb.init()`. + + + +If invalid data is passed. + + +##### Examples + +For more and more detailed examples, see +[our guides to logging](https://docs.wandb.ai/models/track/log). + +Basic usage + +```python +import wandb + +with wandb.init() as run: + run.log({"train-loss": 0.5, "accuracy": 0.9 +``` + +Incremental logging + +```python +import wandb + +with wandb.init() as run: + run.log({"loss": 0.2}, commit=False) + # Somewhere else when I'm ready to report this step: + run.log({"accuracy": 0.8}) +``` + +Histogram + +```python +import numpy as np +import wandb + +# sample gradients at random from normal distribution +gradients = np.random.randn(100, 100) +with wandb.init() as run: + run.log({"gradients": wandb.Histogram(gradients)}) +``` + +Image from NumPy + +```python +import numpy as np +import wandb + +with wandb.init() as run: + examples = [] + for i in range(3): + pixels = np.random.randint(low=0, high=256, size=(100, 100, 3)) + image = wandb.Image(pixels, caption=f"random field {i}") + examples.append(image) + run.log({"examples": examples}) +``` + +Image from PIL + +```python +import numpy as np +from PIL import Image as PILImage +import wandb + +with wandb.init() as run: + examples = [] + for i in range(3): + pixels = np.random.randint( + low=0, + high=256, + size=(100, 100, 3), + dtype=np.uint8, + ) + pil_image = PILImage.fromarray(pixels, mode="RGB") + image = wandb.Image(pil_image, caption=f"random field {i}") + examples.append(image) + run.log({"examples": examples}) +``` + +Video from NumPy + +```python +import numpy as np +import wandb + +with wandb.init() as run: + # axes are (time, channel, height, width) + frames = np.random.randint( + low=0, + high=256, + size=(10, 3, 100, 100), + dtype=np.uint8, + ) + run.log({"video": wandb.Video(frames, fps=4)}) +``` + +Matplotlib plot + +```python +from matplotlib import pyplot as plt +import numpy as np +import wandb + +with wandb.init() as run: + fig, ax = plt.subplots() + x = np.linspace(0, 10) + y = x * x + ax.plot(x, y) # plot y = x^2 + run.log({"chart": fig}) +``` + +PR Curve + +```python +import wandb + +with wandb.init() as run: + run.log({"pr": wandb.plot.pr_curve(y_test, y_probas, labels)}) +``` + +3D Object + +```python +import wandb + +with wandb.init() as run: + run.log( + { + "generated_samples": [ + wandb.Object3D(open("sample.obj")), + wandb.Object3D(open("sample.gltf")), + wandb.Object3D(open("sample.glb")), + ] + } + ) +``` + +## method Run.log_artifact() + +Declare an artifact as an output of a run. + +```python +self, +artifact_or_path: 'Artifact | StrPath', +name: 'str | None' = None, +type: 'str | None' = None, +aliases: 'list[str] | None' = None, +tags: 'list[str] | None' = None +``` + +##### Arguments + + +(str or Artifact) A path to the contents of this artifact, +can be in the following forms: + - `/local/directory` + - `/local/directory/file.txt` + - `s3://bucket/path` +You can also pass an Artifact object created by calling +`wandb.Artifact`. + + + +(str, optional) An artifact name. Valid names can be in the following forms: + - name:version + - name:alias + - digest +This will default to the basename of the path prepended with the current +run id if not specified. + + + +(str) The type of artifact to log, examples include `dataset`, `model` + + + +(list, optional) Aliases to apply to this artifact, defaults to `["latest"]` + + + +(list, optional) Tags to apply to this artifact, if any. + + +##### Returns + +An `Artifact` object. + +## method Run.log_code() + +Save the current state of your code to a W&B Artifact. + +By default, it walks the current directory and logs all files that end with `.py`. + +```python +self, +root: 'str | None' = '.', +name: 'str | None' = None, +include_fn: 'Callable[[str, str], bool] | Callable[[str], bool]' = _is_py_requirements_or_dockerfile, +exclude_fn: 'Callable[[str, str], bool] | Callable[[str], bool]' = exclude_wandb_fn +``` + +##### Arguments + + +The relative (to `os.getcwd()`) or absolute path to recursively find code from. + + + +(str, optional) The name of our code artifact. By default, we'll name the artifact `source-$PROJECT_ID-$ENTRYPOINT_RELPATH`. There may be scenarios where you want many runs to share the same artifact. Specifying name allows you to achieve that. + + + +A callable that accepts a file path and (optionally) root path and returns True when it should be included and False otherwise. This defaults to `lambda path, root: path.endswith(".py")`. + + + +A callable that accepts a file path and (optionally) root path and returns `True` when it should be excluded and `False` otherwise. This defaults to a function that excludes all files within `/.wandb/` and `/wandb/` directories. + + +##### Returns + +An `Artifact` object if code was logged + +##### Examples + +Basic usage + +```python +import wandb + +with wandb.init() as run: + run.log_code() +``` + +Advanced usage + +```python +import wandb + +with wandb.init() as run: + run.log_code( + root="../", + include_fn=lambda path: path.endswith(".py") or path.endswith(".ipynb"), + exclude_fn=lambda path, root: os.path.relpath(path, root).startswith( + "cache/" + ), + ) +``` + +## method Run.log_model() + +Logs a model artifact containing the contents inside the 'path' to a run and marks it as an output to this run. + +The name of model artifact can only contain alphanumeric characters, +underscores, and hyphens. + +```python +self, +path: 'StrPath', +name: 'str | None' = None, +aliases: 'list[str] | None' = None +``` + +##### Arguments + + +(str) A path to the contents of this model, +can be in the following forms: + - `/local/directory` + - `/local/directory/file.txt` + - `s3://bucket/path` + + + +A name to assign to the model artifact that the file contents will be added to. This will default to the basename of the path prepended with the current run id if not specified. + + + +Aliases to apply to the created model artifact, defaults to `["latest"]` + + +##### Returns + +None + +##### Raises + + +If name has invalid special characters. + + +## method Run.mark_preempting() + +Mark this run as preempting. + +Also tells the internal process to immediately report this to server. + +```python +self +``` + +## method Run.pin_config_keys() + +Pin config keys to display in the References section on Run Overview. + +Pinned keys appear prominently above Notes on the Run Overview page. +String values are rendered as markdown; non-strings are rendered as +plain text. Calling this again replaces the previously pinned list. + +```python +self, +keys: 'Sequence[str]' = () +``` + +##### Arguments + + +Config key names to pin, matching keys set via ``run.config``. These are exact key strings (dots and slashes are treated literally, not as path separators). Order is preserved and determines display order. + + +## method Run.restore() + +Download the specified file from cloud storage. + +File is placed into the current directory or run directory. +By default, will only download the file if it doesn't already exist. + +```python +self, +name: 'str', +run_path: 'str | None' = None, +replace: 'bool' = False, +root: 'str | None' = None +``` + +##### Arguments + + +The name of the file. + + + +Optional path to a run to pull files from, i.e. `username/project_name/run_id` if wandb.init has not been called, this is required. + + + +Whether to download the file even if it already exists locally + + + +The directory to download the file to. Defaults to the current directory or the run directory if wandb.init was called. + + +##### Returns + +None if it can't find the file, otherwise a file object open for reading. + +##### Raises + + +If W&B can't connect to the W&B backend. + + + +If the file is not found or can't find run_path. + + +## method Run.save() + +Sync one or more files to W&B. + +Relative paths are relative to the current working directory. + +A Unix glob, such as "myfiles/*", is expanded at the time `save` is +called regardless of the `policy`. In particular, new files are not +picked up automatically. + +`glob_str` is expanded using Python's `glob` module: see +https://docs.python.org/3/library/glob.html for the exact syntax and +behavior. Notably, the characters `*`, `?`, and `[]` are treated as +glob metacharacters, not literal characters, even if they appear in a +real filename (e.g. "myfile[1].txt"). If your file's name contains +any of these characters and you want to match it literally rather +than as a pattern, either escape it yourself with `glob.escape()` +before calling `save`, or pass `glob=False` to disable pattern +expansion entirely and treat `glob_str` as a literal path. + +A `base_path` may be provided to control the directory structure of +uploaded files. It should be a prefix of `glob_str`, and the directory +structure beneath it is preserved. + +When given an absolute path or glob and no `base_path`, one +directory level is preserved as in the example above. + +Files are automatically deduplicated: calling `save()` multiple times +on the same file without modifications will not re-upload it. + +```python +self, +glob_str: 'str | os.PathLike', +base_path: 'str | os.PathLike | None' = None, +policy: 'PolicyName' = 'live', +glob: 'bool' = True +``` + +##### Arguments + + +A relative or absolute path or Unix glob. + + + +A path to use to infer a directory structure; see examples. + + + +One of `live`, `now`, or `end`. +- live: upload the file as it changes, overwriting the previous version +- now: upload the file once now +- end: upload file when the run ends + + + +Whether to treat `glob_str` as a glob pattern. Defaults to `True` for backward compatibility. Set to `False` to treat `glob_str` as a literal path, e.g. when its name contains glob metacharacters like `[`, `]`, `*`, or `?` that you don't want interpreted as a pattern. + + +##### Returns + +Paths to the symlinks created for the matched files. For historical reasons, this may return a boolean in legacy code. ```python import wandb run = wandb.init() run.save("these/are/myfiles/*") # => Saves files in a "these/are/myfiles/" folder in the run. run.save("these/are/myfiles/*", base_path="these") # => Saves files in an "are/myfiles/" folder in the run. run.save("/Users/username/Documents/run123/*.txt") # => Saves files in a "run123/" folder in the run. See note below. run.save("/Users/username/Documents/run123/*.txt", base_path="/Users") # => Saves files in a "username/Documents/run123/" folder in the run. run.save("files/*/saveme.txt") # => Saves each "saveme.txt" file in an appropriate subdirectory # of "files/". run.save("files/myfile[1].txt", glob=False) # => Saves the literal file "files/myfile[1].txt" without # interpreting "[1]" as a glob character class. # Explicitly finish the run since a context manager is not used. run.finish() ``` + +## method Run.status() + +Get sync info from the internal backend, about the current run's sync status. + +```python +self +``` + +## method Run.unwatch() + +Remove pytorch model topology, gradient and parameter hooks. + +```python +self, +models: 'torch.nn.Module | Sequence[torch.nn.Module] | None' = None +``` + +##### Arguments + + +Optional list of pytorch models that have had watch called on them. + + +## method Run.upsert_artifact() + +Declare (or append to) a non-finalized artifact as output of a run. + +Note that you must call run.finish_artifact() to finalize the artifact. +This is useful when distributed jobs need to all contribute to the same artifact. + +```python +self, +artifact_or_path: 'Artifact | str', +name: 'str | None' = None, +type: 'str | None' = None, +aliases: 'list[str] | None' = None, +distributed_id: 'str | None' = None +``` + +##### Arguments + + +A path to the contents of this artifact, +can be in the following forms: +- `/local/directory` +- `/local/directory/file.txt` +- `s3://bucket/path` + + + +An artifact name. May be prefixed with "entity/project". Defaults +to the basename of the path prepended with the current run ID +if not specified. Valid names can be in the following forms: +- name:version +- name:alias +- digest + + + +The type of artifact to log. Common examples include `dataset`, `model`. + + + +Aliases to apply to this artifact, defaults to `["latest"]`. + + + +Unique string that all distributed jobs share. If None, defaults to the run's group name. + + +##### Returns + +An `Artifact` object. + +## method Run.use_artifact() + +Declare an artifact as an input to a run. + +Call `download` or `file` on the returned object to get the contents locally. + +```python +self, +artifact_or_name: 'str | Artifact', +type: 'str | None' = None, +aliases: 'list[str] | None' = None, +use_as: 'str | None' = None +``` + +##### Arguments + + +The name of the artifact to use. May be prefixed +with the name of the project the artifact was logged to +("entity" or "entity/project"). If no +entity is specified in the name, the Run or API setting's entity is used. +Valid names can be in the following forms +- name:version +- name:alias + + + +The type of artifact to use. + + + +Aliases to apply to this artifact + + + +This argument is deprecated and does nothing. + + +##### Returns + +An `Artifact` object. + +##### Examples + +```python +import wandb + +run = wandb.init(project="") + +# Use an artifact by name and alias +artifact_a = run.use_artifact(artifact_or_name=":") + +# Use an artifact by name and version +artifact_b = run.use_artifact(artifact_or_name=":v") + +# Use an artifact by entity/project/name:alias +artifact_c = run.use_artifact( + artifact_or_name="//:" +) + +# Use an artifact by entity/project/name:version +artifact_d = run.use_artifact( + artifact_or_name="//:v" +) + +# Explicitly finish the run since a context manager is not used. +run.finish() +``` + +## method Run.use_model() + +Download the files logged in a model artifact 'name'. + +```python +self, +name: 'str' +``` + +##### Arguments + + +A model artifact name. 'name' must match the name of an existing logged +model artifact. May be prefixed with `entity/project/`. Valid names +can be in the following forms +- model_artifact_name:version +- model_artifact_name:alias + + +##### Returns + +`path`: Path to downloaded model artifact file(s). + +##### Raises + + +If model artifact 'name' is of a type that does not contain the substring 'model'. + + +## method Run.watch() + +Hook into given PyTorch model to monitor gradients and the model's computational graph. + +This function can track parameters, gradients, or both during training. + +```python +self, +models: 'torch.nn.Module | Sequence[torch.nn.Module]', +criterion: 'torch.F | None' = None, +log: "Literal['gradients', 'parameters', 'all'] | None" = 'gradients', +log_freq: 'int' = 1000, +idx: 'int | None' = None, +log_graph: 'bool' = False +``` + +##### Arguments + + +A single model or a sequence of models to be monitored. + + + +The loss function being optimized (optional). + + + +Specifies whether to log "gradients", "parameters", or "all". Set to None to disable logging. (default="gradients"). + + + +Frequency (in batches) to log gradients and parameters. (default=1000) + + + +Index used when tracking multiple models with `wandb.watch`. (default=None) + + + +Whether to log the model's computational graph. (default=False) + + +##### Raises + + +If `wandb.init()` has not been called or if any of the models are not instances of `torch.nn.Module`. + + +## method Run.write_logs() + +Write text to the run's Logs tab. + +Use `write_logs` to directly write text to the Logs tab instead of +relying on automatic stdout/stderr capture. Calls after the run has +finished are silently ignored. + +Consider using the `capture_loggers` setting which integrates with +Python's `logging` module. + +```python +self, +text: 'str' +``` + +##### Arguments + + +The text to write. A trailing newline is added if not present. + + diff --git a/models/ref/python/experiments/run/run-properties.mdx b/models/ref/python/experiments/run/run-properties.mdx new file mode 100644 index 0000000000..88c1d1d490 --- /dev/null +++ b/models/ref/python/experiments/run/run-properties.mdx @@ -0,0 +1,135 @@ +--- +title: Run properties +sidebarTitle: Properties +page_kind: class-properties +parent_slug: run +kind: class +namespace: wandb.sdk.wandb_run +--- + +## Class wandb.Run + +## property config + +Config object associated with this run. + +## property config_static + +Static config object associated with this run. + +## property dir + +The directory where files associated with the run are saved. + +## property disabled + +True if the run is disabled, False otherwise. + +## property entity + +The name of the W&B entity associated with the run. + +Entity can be a username or the name of a team or organization. + +## property group + +Returns the name of the group associated with this run. + +Grouping runs together allows related experiments to be organized and +visualized collectively in the W&B UI. This is especially useful for +scenarios such as distributed training or cross-validation, where +multiple runs should be viewed and managed as a unified experiment. + +In shared mode, where all processes share the same run object, +setting a group is usually unnecessary, since there is only one +run and no grouping is required. + +## property id + +Identifier for this run. + +## property job_type + +Name of the job type associated with the run. + +View a run's job type in the run's Overview page in the W&B App. + +You can use this to categorize runs by their job type, such as +"training", "evaluation", or "inference". This is useful for organizing +and filtering runs in the W&B UI, especially when you have multiple +runs with different job types in the same project. For more +information, see [Organize runs](https://docs.wandb.ai/models/runs#organize-runs). + +## property name + +Display name of the run. + +Display names are not guaranteed to be unique and may be descriptive. +By default, they are randomly generated. + +## property notes + +Notes associated with the run, if there are any. + +Notes can be a multiline string and can also use markdown and latex +equations inside `$$`, like `$x + 3$`. + +## property offline + +True if the run is offline, False otherwise. + +## property path + +Path to the run. + +Run paths include entity, project, and run ID, in the format +`entity/project/run_id`. + +## property project + +Name of the W&B project associated with the run. + +## property project_url + +URL of the W&B project associated with the run, if there is one. + +Offline runs do not have a project URL. + +## property resumed + +True if the run was resumed, False otherwise. + +## property settings + +A frozen copy of run's Settings object. + +## property start_time + +Unix timestamp (in seconds) of when the run started. + +## property step + +The W&B step of the next `log()` call. + +Raises an error in mode="shared" runs. + +## property sweep_id + +Identifier for the sweep associated with the run, if there is one. + +## property sweep_url + +URL of the sweep associated with the run, if there is one. + +Offline runs do not have a sweep URL. + +## property tags + +Tags associated with the run, if there are any. + +## property url + +The url for the W&B run, if there is one. + +Offline runs will not have a url. + diff --git a/models/ref/python/experiments/settings.mdx b/models/ref/python/experiments/settings.mdx index 4d4244d534..f917640777 100644 --- a/models/ref/python/experiments/settings.mdx +++ b/models/ref/python/experiments/settings.mdx @@ -7,11 +7,50 @@ namespace: wandb.sdk.wandb_settings import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + + + + +## Class wandb.Settings + + + +Settings for the W&B SDK. + +This class manages configuration settings for the W&B SDK, +ensuring type safety and validation of all settings. Settings are accessible +as attributes and can be initialized programmatically, through environment +variables (`WANDB_ prefix`), and with configuration files. + +The settings are organized into three categories: +1. Public settings: Core configuration options that users can safely modify to customize + W&B's behavior for their specific needs. +2. Internal settings: Settings prefixed with 'x_' that handle low-level SDK behavior. + These settings are primarily for internal use and debugging. While they can be modified, + they are not considered part of the public API and may change without notice in future + versions. +3. Computed settings: Read-only settings that are automatically derived from other settings or + the environment. + +Settings are loaded from multiple sources. When the same setting is supplied +by more than one source, the source listed later wins. From lowest to highest +precedence: + +1. Default values defined on this `Settings` model. +2. Configuration files (`~/.config/wandb/settings`, or the `settings` file in + the directory named by the `WANDB_CONFIG_DIR` environment variable). +3. Environment variables (those prefixed with `WANDB_`, e.g. `WANDB_MODE`). +4. Values detected from the runtime environment, such as the hostname, the + running program/script path, the Python executable, the Docker image, and + Jupyter notebook details. +5. SageMaker settings, when running in an Amazon SageMaker environment. +6. The `settings` parameter of `wandb.setup()`. +7. The `settings` parameter of `wandb.init()`. +8. Certain `wandb.init()` parameters (for example, `mode=` overrides the + `mode` setting). -## class wandb.Settings ```python *, allow_media_symlink: bool = False, @@ -147,7 +186,7 @@ x_service_transport: str | None = None, x_service_wait: float = 30.0, x_skip_transaction_log: bool = False, x_start_time: float | None = None, -x_stats_pid: int = 3570, +x_stats_pid: int = 62075, x_stats_sampling_interval: float = 15.0, x_stats_neuron_monitor_config_path: str | None = None, x_stats_dcgm_exporter: str | None = None, @@ -170,504 +209,639 @@ x_sync_dir_suffix: str = '', x_update_finish_state: bool = True ``` +## Args + +Whether to symlink media files to the run directory. + +If true, media files will be symlinked or hardlinked to the +run directory instead of copied. This may result in faster +logging and reduced disk usage. However, deleting or modifying +the original files before upload to the W&B server will be +reflected in the uploaded data. + + + +Flag to allow table artifacts to be synced in offline mode. + +To revert to the old behavior, set this to False. + + + +Flag to allow modification of `Config` values after they've been set. + + + +Deprecated and will be removed. + -Settings for the W&B SDK. + +The W&B API key. + -This class manages configuration settings for the W&B SDK, -ensuring type safety and validation of all settings. Settings are accessible -as attributes and can be initialized programmatically, through environment -variables (`WANDB_ prefix`), and with configuration files. + +Mapping of Azure account URLs to their corresponding access keys for Azure integration. + -The settings are organized into three categories: -1. Public settings: Core configuration options that users can safely modify to customize - W&B's behavior for their specific needs. -2. Internal settings: Settings prefixed with 'x_' that handle low-level SDK behavior. - These settings are primarily for internal use and debugging. While they can be modified, - they are not considered part of the public API and may change without notice in future - versions. -3. Computed settings: Read-only settings that are automatically derived from other settings or - the environment. + +Override for the 'app' URL for the W&B UI. -Settings are loaded from multiple sources. When the same setting is supplied -by more than one source, the source listed later wins. From lowest to highest -precedence: +The `app_url` is normally computed based on `base_url`, but this can be +used to set it explicitly. -1. Default values defined on this `Settings` model. -2. Configuration files (`~/.config/wandb/settings`, or the `settings` file in - the directory named by the `WANDB_CONFIG_DIR` environment variable). -3. Environment variables (those prefixed with `WANDB_`, e.g. `WANDB_MODE`). -4. Values detected from the runtime environment, such as the hostname, the - running program/script path, the Python executable, the Docker image, and - Jupyter notebook details. -5. SageMaker settings, when running in an Amazon SageMaker environment. -6. The `settings` parameter of `wandb.setup()`. -7. The `settings` parameter of `wandb.init()`. -8. Certain `wandb.init()` parameters (for example, `mode=` overrides the - `mode` setting). +WANDB_APP_URL is the corresponding environment variable. + + +The URL of the W&B backend for data synchronization. + + +Directory containing the code to be tracked by W&B. + -## Args + +Paths to files to load configuration from into the `Config` object. + -- `allow_media_symlink`: Whether to symlink media files to the run directory. - - If true, media files will be symlinked or hardlinked to the - run directory instead of copied. This may result in faster - logging and reduced disk usage. However, deleting or modifying - the original files before upload to the W&B server will be - reflected in the uploaded data. -- `allow_offline_artifacts`: Flag to allow table artifacts to be synced in offline mode. - - To revert to the old behavior, set this to False. -- `allow_val_change`: Flag to allow modification of `Config` values after they've been set. -- `anonymous`: Deprecated and will be removed. -- `api_key`: The W&B API key. -- `azure_account_url_to_access_key`: Mapping of Azure account URLs to their corresponding access keys for Azure integration. -- `app_url_override`: Override for the 'app' URL for the W&B UI. - - The `app_url` is normally computed based on `base_url`, but this can be - used to set it explicitly. - - WANDB_APP_URL is the corresponding environment variable. -- `base_url`: The URL of the W&B backend for data synchronization. -- `code_dir`: Directory containing the code to be tracked by W&B. -- `config_paths`: Paths to files to load configuration from into the `Config` object. -- `console`: The type of console capture to be applied. - - Possible values are: - - "auto" - Automatically selects the console capture method based on the - system environment and settings. - - "off" - Disables console capture. - - "redirect" - Redirects low-level file descriptors for capturing output. - - "wrap" - Overrides the write methods of sys.stdout/sys.stderr. Will be - mapped to either "wrap_raw" or "wrap_emu" based on the state of the system. - - "wrap_raw" - Same as "wrap" but captures raw output directly instead of - through an emulator. Derived from the `wrap` setting and should not be set manually. - - "wrap_emu" - Same as "wrap" but captures output through an emulator. - Derived from the `wrap` setting and should not be set manually. -- `console_multipart`: Enable multipart console logging. - - When True, the SDK writes console output to timestamped files - under the `logs/` directory instead of a single `output.log`. - - Each part is uploaded as soon as it is closed, giving users live - access to logs while the run is active. Rollover cadence is - controlled by `console_chunk_max_bytes` and/or `console_chunk_max_seconds`. - If both limits are `0`, all logs are uploaded once at run finish. - - Note: Uploaded chunks are immutable; terminal control sequences - that modify previous lines (e.g., progress bars using carriage returns) - only affect the current chunk. -- `console_chunk_max_bytes`: Size-based rollover threshold for multipart console logs, in bytes. - - Starts a new console log file when the current part reaches this - size. Has an effect only when `console_multipart` is `True`. - Can be combined with `console_chunk_max_seconds`; whichever limit is - hit first triggers the rollover. A value of `0` disables the - size-based limit. -- `console_chunk_max_seconds`: Time-based rollover threshold for multipart console logs, in seconds. - - Starts a new console log file after this many seconds have elapsed - since the current part began. Requires `console_multipart` to be - `True`. May be used with `console_chunk_max_bytes`; the first limit - reached closes the part. A value of `0` disables the time-based - limit. -- `capture_loggers`: Names of Python loggers to capture into the run's Logs tab. - - A mapping of logger name to minimum log level. When set, wandb installs a - logging.Handler on each named logger and removes it when the run finishes. - Log records emitted by those loggers are published as console output to the - run, similar to stdout/stderr capture. - - Log records are formatted the same as `logging.basicConfig()`, like - `INFO:my_module:Some message.` This is not currently customizable. - - To capture all logs, pass the name of the root logger, which is 'root'. - - This is independent of the `console` setting: both can be active - simultaneously. - - Example: - ```python - wandb.init( - settings=wandb.Settings( - console="off", - capture_loggers={ - "my_app": "INFO", - "my_app.training": "ERROR", - }, - ), - ) - ``` -- `credentials_file`: Path to file for writing temporary access tokens. -- `disable_code`: Whether to disable capturing the code. -- `disable_git`: Whether to disable capturing the git state. -- `disable_git_fork_point`: Whether to disable inferring fork point from remote branches - - When set to True, the SDK will use the latest commit from the upstream - branch, if one is set. Otherwise skip generating the diff patch. - - When set to False, the SDK will try to use the latest commit from the upstream branch, - if one is set. - Otherwise, it will find the closest commit from all remote branches. - This may impact performance for repos with many upstream branches. -- `disable_job_creation`: Whether to disable the creation of a job artifact for W&B Launch. -- `docker`: The Docker image used to execute the script. -- `email`: The email address of the user. -- `entity`: The W&B entity, such as a user or a team. -- `organization`: The W&B organization. -- `force`: Whether to pass the `force` flag to `wandb.login()`. -- `fork_from`: Specifies a point in a previous execution of a run to fork from. - - The point is defined by the run ID, a metric, and its value. - Currently, only the metric '_step' is supported. -- `git_commit`: The git commit hash to associate with the run. -- `git_remote`: The git remote to associate with the run. -- `git_remote_url`: The URL of the git remote repository. -- `git_root`: Root directory of the git repository. -- `host`: Hostname of the machine running the script. -- `http_proxy`: Custom proxy servers for http requests to W&B. -- `https_proxy`: Custom proxy servers for https requests to W&B. -- `identity_token_file`: Path to file containing an identity token (JWT) for authentication. -- `ignore_globs`: Unix glob patterns relative to `files_dir` specifying files to exclude from upload. -- `init_timeout`: Time in seconds to wait for the `wandb.init` call to complete before timing out. -- `finish_timeout`: Time in seconds to wait for data to upload at the end of a run. - - Setting this can limit costs caused by slow uploads to W&B at the end of a - run, with the trade-off that the run will be marked crashed and may be - missing some data. The default is for `run.finish()` to block until all - data finishes uploading. - - If this is set to a number greater than zero, W&B gives up on uploading a - run's data after this many seconds at the end of a run, unblocking your - script. After some time, the run becomes Crashed or Failed in the UI. Any - unuploaded data is still stored on disk and can be uploaded with `wandb - sync`. - - Use the `finish_timeout_raises` setting to raise an error in addition to - printing a warning message. - - Runs shut down by `wandb.teardown()` (which automatically runs at the end - of a script in an atexit hook) will also respect this setting. -- `finish_timeout_raises`: Whether to raise a TimeoutError if finish_timeout expires. - - Using this together with the `finish_timeout` setting causes `run.finish()` - to raise a TimeoutError after a timeout in addition to printing a message. - - Note that `run.finish()` is called implicitly when using a Run as a context - manager: - - with wandb.init() as run: - ... # run.finish() executes at the end of the `with` block - - This does not cause `wandb.teardown()` to raise an error (since it runs - at the end of a script anyway). -- `insecure_disable_ssl`: Whether to insecurely disable SSL verification. -- `job_name`: Name of the Launch job running the script. -- `job_source`: Source type for Launch. -- `label_disable`: Whether to disable automatic labeling features. -- `launch_config_path`: Path to the launch configuration file. -- `login_timeout`: Time in seconds to wait for login operations before timing out. -- `mode`: The operating mode for W&B logging and synchronization. -- `notebook_name`: Name of the notebook if running in a Jupyter-like environment. -- `program`: Path to the script that created the run, if available. -- `program_abspath`: The absolute path from the root repository directory to the script that - created the run. - - Root repository directory is defined as the directory containing the - .git directory, if it exists. Otherwise, it's the current working directory. -- `program_relpath`: The relative path to the script that created the run. -- `project`: The W&B project ID. -- `quiet`: Flag to suppress non-essential output. -- `reinit`: What to do when `wandb.init()` is called while a run is active. - - Options: - - "default": Use "finish_previous" in notebooks and "return_previous" - otherwise. - - "return_previous": Return the most recently created run - that is not yet finished. This does not update `wandb.run`; see - the "create_new" option. - - "finish_previous": Finish all active runs, then return a new run. - - "create_new": Create a new run without modifying other active runs. - Does not update `wandb.run` and top-level functions like `wandb.log`. - Because of this, some older integrations that rely on the global run - will not work. - - Can also be a boolean, but this is deprecated. False is the same as - "return_previous", and True is the same as "finish_previous". -- `relogin`: Flag to force a new login attempt. -- `resume`: Specifies the resume behavior for the run. - - Options: - - "must": Resumes from an existing run with the same ID. If no such run exists, - it will result in failure. - - "allow": Attempts to resume from an existing run with the same ID. If none is - found, a new run will be created. - - "never": Always starts a new run. If a run with the same ID already exists, - it will result in failure. - - "auto": Automatically resumes from the most recent failed run on the same - machine. -- `resume_from`: Specifies a point in a previous execution of a run to resume from. - - The point is defined by the run ID, a metric, and its value. - Currently, only the metric '_step' is supported. -- `root_dir`: The root directory to use as the base for all run-related paths. - - In particular, this is used to derive the wandb directory and the run directory. -- `run_group`: Group identifier for related runs. - - Used for grouping runs in the UI. -- `run_id`: The ID of the run. -- `run_job_type`: Type of job being run (e.g., training, evaluation). -- `run_name`: Human-readable name for the run. -- `run_notes`: Additional notes or description for the run. -- `run_tags`: Tags to associate with the run for organization and filtering. -- `sagemaker_disable`: Flag to disable SageMaker-specific functionality. -- `save_code`: Whether to save the code associated with the run. -- `settings_system`: Path to the system-wide settings file. -- `stop_fn`: A callback to execute to stop the run. - - A run can be stopped through the web UI, or after a fatal error - (if configured via a setting). - - By default, to stop a run, W&B sends a SIGINT to the main thread. - Set this callback to override this behavior, like to use a different - signal or to take some other action before interrupting. - - The callback runs in a separate thread. It runs soon after a stop is - requested, but not immediately. -- `max_end_of_run_history_metrics`: Maximum number of history sparklines to display at the end of a run. -- `max_end_of_run_summary_metrics`: Maximum number of summary metrics to display at the end of a run. -- `show_errors`: Whether to display error messages. -- `show_info`: Whether to display informational messages. -- `show_warnings`: Whether to display warning messages. -- `silent`: Flag to suppress all output. -- `stop_on_fatal_error`: Whether to stop the run after a fatal error. - - After W&B hits an unrecoverable error while uploading data, it prints - a message and stops uploading, but still allows logging more data. - This is usually desirable: your training metrics get stored on disk - and can be recovered using `wandb sync`, even if they aren't uploaded. - - This is not useful if your files get deleted after training. - In that case, setting this to True will stop the run after a fatal error, - as if the stop button was pressed in the web UI. -- `strict`: Whether to enable strict mode for validation and error checking. -- `summary_timeout`: Time in seconds to wait for summary operations before timing out. -- `sweep_id`: Identifier of the sweep this run belongs to. -- `sweep_param_path`: Path to the sweep parameters configuration. -- `symlink`: Whether to use symlinks (True by default except on Windows). -- `sync_tensorboard`: Whether to synchronize TensorBoard logs with W&B. -- `table_raise_on_max_row_limit_exceeded`: Whether to raise an exception when table row limits are exceeded. -- `use_dot_wandb`: Whether to use a hidden `.wandb` or visible `wandb` directory for run data. - - If True, the SDK uses `.wandb`. If False, `wandb`. - If not set, defaults to `.wandb` if it already exists, otherwise `wandb`. -- `username`: Username. -- `x_disable_meta`: Flag to disable the collection of system metadata. -- `x_disable_stats`: Flag to disable the collection of system metrics. -- `x_extra_http_headers`: Additional headers to add to all outgoing HTTP requests. -- `x_label`: Label to assign to system metrics and console logs collected for the run. + +The type of console capture to be applied. - This is used to group data by on the frontend and can be used to distinguish data - from different processes in a distributed training job. -- `x_primary`: Determines whether to save internal wandb files and metadata. +Possible values are: +- "auto" - Automatically selects the console capture method based on the + system environment and settings. +- "off" - Disables console capture. +- "redirect" - Redirects low-level file descriptors for capturing output. +- "wrap" - Overrides the write methods of sys.stdout/sys.stderr. Will be + mapped to either "wrap_raw" or "wrap_emu" based on the state of the system. +- "wrap_raw" - Same as "wrap" but captures raw output directly instead of + through an emulator. Derived from the `wrap` setting and should not be set manually. +- "wrap_emu" - Same as "wrap" but captures output through an emulator. + Derived from the `wrap` setting and should not be set manually. + - In a distributed setting, this is useful for avoiding file overwrites - from secondary processes when only system metrics and logs are needed, - as the primary process handles the main logging. -- `x_save_requirements`: Flag to save the requirements file. -- `x_server_side_derived_summary`: Flag to delegate automatic computation of summary from history to the server. + +Enable multipart console logging. - This does not disable user-provided summary updates. -- `x_service_wait`: Time in seconds to wait for the wandb-core internal service to start. -- `x_skip_transaction_log`: Whether to skip saving the run events to the transaction log. +When True, the SDK writes console output to timestamped files +under the `logs/` directory instead of a single `output.log`. - This is only relevant for online runs. Can be used to reduce the amount of - data written to disk. +Each part is uploaded as soon as it is closed, giving users live +access to logs while the run is active. Rollover cadence is +controlled by `console_chunk_max_bytes` and/or `console_chunk_max_seconds`. +If both limits are `0`, all logs are uploaded once at run finish. - Should be used with caution, as it removes the gurantees about - recoverability. -- `x_stats_sampling_interval`: Sampling interval for the system monitor in seconds. -- `x_stats_open_metrics_endpoints`: OpenMetrics `/metrics` endpoints to monitor for system metrics. -- `x_stats_open_metrics_filters`: Filter to apply to metrics collected from OpenMetrics `/metrics` endpoints. +Note: Uploaded chunks are immutable; terminal control sequences +that modify previous lines (e.g., progress bars using carriage returns) +only affect the current chunk. + - Supports two formats: - - `{"metric regex pattern, including endpoint name as prefix": {"label": "label value regex pattern"}}` - - `("metric regex pattern 1", "metric regex pattern 2", ...)` -- `x_stats_open_metrics_http_headers`: HTTP headers to add to OpenMetrics requests. -- `x_stats_disk_paths`: System paths to monitor for disk usage. -- `x_stats_cpu_count`: System CPU count. + +Size-based rollover threshold for multipart console logs, in bytes. - If set, overrides the auto-detected value in the run metadata. -- `x_stats_cpu_logical_count`: Logical CPU count. +Starts a new console log file when the current part reaches this +size. Has an effect only when `console_multipart` is `True`. +Can be combined with `console_chunk_max_seconds`; whichever limit is +hit first triggers the rollover. A value of `0` disables the +size-based limit. + - If set, overrides the auto-detected value in the run metadata. -- `x_stats_gpu_count`: GPU device count. + +Time-based rollover threshold for multipart console logs, in seconds. - If set, overrides the auto-detected value in the run metadata. -- `x_stats_gpu_type`: GPU device type. +Starts a new console log file after this many seconds have elapsed +since the current part began. Requires `console_multipart` to be +`True`. May be used with `console_chunk_max_bytes`; the first limit +reached closes the part. A value of `0` disables the time-based +limit. + + + +Names of Python loggers to capture into the run's Logs tab. - If set, overrides the auto-detected value in the run metadata. -- `x_stats_gpu_device_ids`: GPU device indices to monitor. +A mapping of logger name to minimum log level. When set, wandb installs a +logging.Handler on each named logger and removes it when the run finishes. +Log records emitted by those loggers are published as console output to the +run, similar to stdout/stderr capture. - If not set, the system monitor captures metrics for all GPUs. - Assumes 0-based indexing matching CUDA/ROCm device enumeration. -- `x_stats_track_process_tree`: Monitor the entire process tree for resource usage, starting from `x_stats_pid`. +Log records are formatted the same as `logging.basicConfig()`, like +`INFO:my_module:Some message.` This is not currently customizable. - When `True`, the system monitor aggregates the RSS, CPU%, and thread count - from the process with PID `x_stats_pid` and all of its descendants. - This can have a performance overhead and is disabled by default. -- `x_stats_no_cgroup`: Disable cgroup v2 CPU and memory limits for system metric percentages. -- `x_sync_dir_suffix`: Suffix to add to the run's directory name (sync_dir). +To capture all logs, pass the name of the root logger, which is 'root'. + +This is independent of the `console` setting: both can be active +simultaneously. + +Example: +```python +wandb.init( + settings=wandb.Settings( + console="off", + capture_loggers={ + "my_app": "INFO", + "my_app.training": "ERROR", + }, + ), +) +``` + - This is set in wandb.init() to avoid naming conflicts. - If set, it is joined to the default name with a dash. -- `x_update_finish_state`: Flag to indicate whether this process can update the run's final state on the server. + +Path to file for writing temporary access tokens. + - Set to False in distributed training when only the main process should determine the final state. + +Whether to disable capturing the code. + + +Whether to disable capturing the git state. + + +Whether to disable inferring fork point from remote branches +When set to True, the SDK will use the latest commit from the upstream +branch, if one is set. Otherwise skip generating the diff patch. +When set to False, the SDK will try to use the latest commit from the upstream branch, +if one is set. +Otherwise, it will find the closest commit from all remote branches. +This may impact performance for repos with many upstream branches. + + +Whether to disable the creation of a job artifact for W&B Launch. + -## Properties + +The Docker image used to execute the script. + -### property app_url + +The email address of the user. + -The URL for the W&B UI, usually https://wandb.ai. + +The W&B entity, such as a user or a team. + -This is different from `base_url` (like https://api.wandb.ai) which -is used to access W&B APIs programmatically. + +The W&B organization. + -### property colab_url + +Whether to pass the `force` flag to `wandb.login()`. + -The URL to the Colab notebook, if running in Colab. + +Specifies a point in a previous execution of a run to fork from. -### property deployment +The point is defined by the run ID, a metric, and its value. +Currently, only the metric '_step' is supported. + + +The git commit hash to associate with the run. + + +The git remote to associate with the run. + -### property files_dir + +The URL of the git remote repository. + -Absolute path to the local directory where the run's files are stored. + +Root directory of the git repository. + -### property is_local + +Hostname of the machine running the script. + + +Custom proxy servers for http requests to W&B. + + +Custom proxy servers for https requests to W&B. + -### property log_dir + +Path to file containing an identity token (JWT) for authentication. + -The directory for storing log files. + +Unix glob patterns relative to `files_dir` specifying files to exclude from upload. + -### property log_internal + +Time in seconds to wait for the `wandb.init` call to complete before timing out. + -The path to the file to use for internal logs. + +Time in seconds to wait for data to upload at the end of a run. -### property log_symlink_internal +Setting this can limit costs caused by slow uploads to W&B at the end of a +run, with the trade-off that the run will be marked crashed and may be +missing some data. The default is for `run.finish()` to block until all +data finishes uploading. -The path to the symlink to the internal log file of the most recent run. +If this is set to a number greater than zero, W&B gives up on uploading a +run's data after this many seconds at the end of a run, unblocking your +script. After some time, the run becomes Crashed or Failed in the UI. Any +unuploaded data is still stored on disk and can be uploaded with `wandb +sync`. + +Use the `finish_timeout_raises` setting to raise an error in addition to +printing a warning message. -### property log_symlink_user +Runs shut down by `wandb.teardown()` (which automatically runs at the end +of a script in an atexit hook) will also respect this setting. + + + +Whether to raise a TimeoutError if finish_timeout expires. + +Using this together with the `finish_timeout` setting causes `run.finish()` +to raise a TimeoutError after a timeout in addition to printing a message. + +Note that `run.finish()` is called implicitly when using a Run as a context +manager: + + with wandb.init() as run: + ... # run.finish() executes at the end of the `with` block + +This does not cause `wandb.teardown()` to raise an error (since it runs +at the end of a script anyway). + + + +Whether to insecurely disable SSL verification. + + + +Name of the Launch job running the script. + + + +Source type for Launch. + -The path to the symlink to the user-process log file of the most recent run. + +Whether to disable automatic labeling features. + -### property log_user + +Path to the launch configuration file. + + + +Time in seconds to wait for login operations before timing out. + + + +The operating mode for W&B logging and synchronization. + + + +Name of the notebook if running in a Jupyter-like environment. + + + +Path to the script that created the run, if available. + + + +The absolute path from the root repository directory to the script that +created the run. + +Root repository directory is defined as the directory containing the +.git directory, if it exists. Otherwise, it's the current working directory. + + + +The relative path to the script that created the run. + + + +The W&B project ID. + + + +Flag to suppress non-essential output. + + + +What to do when `wandb.init()` is called while a run is active. -The path to the file to use for user-process logs. +Options: +- "default": Use "finish_previous" in notebooks and "return_previous" + otherwise. +- "return_previous": Return the most recently created run + that is not yet finished. This does not update `wandb.run`; see + the "create_new" option. +- "finish_previous": Finish all active runs, then return a new run. +- "create_new": Create a new run without modifying other active runs. + Does not update `wandb.run` and top-level functions like `wandb.log`. + Because of this, some older integrations that rely on the global run + will not work. -### property project_url +Can also be a boolean, but this is deprecated. False is the same as +"return_previous", and True is the same as "finish_previous". + -The W&B URL where the project can be viewed. + +Flag to force a new login attempt. + -### property resume_fname + +Specifies the resume behavior for the run. -The path to the resume file. +Options: +- "must": Resumes from an existing run with the same ID. If no such run exists, + it will result in failure. +- "allow": Attempts to resume from an existing run with the same ID. If none is + found, a new run will be created. +- "never": Always starts a new run. If a run with the same ID already exists, + it will result in failure. +- "auto": Automatically resumes from the most recent failed run on the same + machine. + + + +Specifies a point in a previous execution of a run to resume from. + +The point is defined by the run ID, a metric, and its value. +Currently, only the metric '_step' is supported. + + + +The root directory to use as the base for all run-related paths. + +In particular, this is used to derive the wandb directory and the run directory. + + + +Group identifier for related runs. + +Used for grouping runs in the UI. + + + +The ID of the run. + + + +Type of job being run (e.g., training, evaluation). + + + +Human-readable name for the run. + + + +Additional notes or description for the run. + + + +Tags to associate with the run for organization and filtering. + + + +Flag to disable SageMaker-specific functionality. + + + +Whether to save the code associated with the run. + + + +Path to the system-wide settings file. + + + +A callback to execute to stop the run. + +A run can be stopped through the web UI, or after a fatal error +(if configured via a setting). + +By default, to stop a run, W&B sends a SIGINT to the main thread. +Set this callback to override this behavior, like to use a different +signal or to take some other action before interrupting. + +The callback runs in a separate thread. It runs soon after a stop is +requested, but not immediately. + + + +Maximum number of history sparklines to display at the end of a run. + + + +Maximum number of summary metrics to display at the end of a run. + -### property run_mode + +Whether to display error messages. + -The mode of the run. Can be either "run" or "offline-run". + +Whether to display informational messages. + -### property run_url + +Whether to display warning messages. + -The W&B URL where the run can be viewed. + +Flag to suppress all output. + -### property settings_workspace + +Whether to stop the run after a fatal error. -The path to the workspace settings file. +After W&B hits an unrecoverable error while uploading data, it prints +a message and stops uploading, but still allows logging more data. +This is usually desirable: your training metrics get stored on disk +and can be recovered using `wandb sync`, even if they aren't uploaded. -### property sweep_url +This is not useful if your files get deleted after training. +In that case, setting this to True will stop the run after a fatal error, +as if the stop button was pressed in the web UI. + -The W&B URL where the sweep can be viewed. + +Whether to enable strict mode for validation and error checking. + -### property sync_dir + +Time in seconds to wait for summary operations before timing out. + -The directory for storing the run's files. + +Identifier of the sweep this run belongs to. + -### property sync_file + +Path to the sweep parameters configuration. + -Path to the append-only binary transaction log file. + +Whether to use symlinks (True by default except on Windows). + -### property sync_symlink_latest + +Whether to synchronize TensorBoard logs with W&B. + -Path to the symlink to the most recent run's transaction log file. + +Whether to raise an exception when table row limits are exceeded. + -### property timespec + +Whether to use a hidden `.wandb` or visible `wandb` directory for run data. -The time specification for the run. +If True, the SDK uses `.wandb`. If False, `wandb`. +If not set, defaults to `.wandb` if it already exists, otherwise `wandb`. + -### property wandb_dir + +Username. + -Full path to the wandb directory. + +Flag to disable the collection of system metadata. + + +Flag to disable the collection of system metrics. + + +Additional headers to add to all outgoing HTTP requests. + -## Methods + +Label to assign to system metrics and console logs collected for the run. -### method Settings.validate_anonymous() +This is used to group data by on the frontend and can be used to distinguish data +from different processes in a distributed training job. + -```python -value: 'object' -``` + +Determines whether to save internal wandb files and metadata. +In a distributed setting, this is useful for avoiding file overwrites +from secondary processes when only system metrics and logs are needed, +as the primary process handles the main logging. + + +Flag to save the requirements file. + -##### Arguments + +Flag to delegate automatic computation of summary from history to the server. -- `value`: +This does not disable user-provided summary updates. + + +Time in seconds to wait for the wandb-core internal service to start. + + +Whether to skip saving the run events to the transaction log. +This is only relevant for online runs. Can be used to reduce the amount of +data written to disk. -### method Settings.validate_x_extra_http_headers() +Should be used with caution, as it removes the gurantees about +recoverability. + -```python -(value) -``` + +Sampling interval for the system monitor in seconds. + + +OpenMetrics `/metrics` endpoints to monitor for system metrics. + + +Filter to apply to metrics collected from OpenMetrics `/metrics` endpoints. -##### Arguments +Supports two formats: + - `{"metric regex pattern, including endpoint name as prefix": {"label": "label value regex pattern"}}` + - `("metric regex pattern 1", "metric regex pattern 2", ...)` + -- `value`: + +HTTP headers to add to OpenMetrics requests. + + +System paths to monitor for disk usage. + + +System CPU count. +If set, overrides the auto-detected value in the run metadata. + -### method Settings.validate_x_stats_coreweave_metadata_base_url() + +Logical CPU count. -```python -(value) -``` +If set, overrides the auto-detected value in the run metadata. + + + +GPU device count. + +If set, overrides the auto-detected value in the run metadata. + + + +GPU device type. + +If set, overrides the auto-detected value in the run metadata. + + + +GPU device indices to monitor. + +If not set, the system monitor captures metrics for all GPUs. +Assumes 0-based indexing matching CUDA/ROCm device enumeration. + + + +Monitor the entire process tree for resource usage, starting from `x_stats_pid`. + +When `True`, the system monitor aggregates the RSS, CPU%, and thread count +from the process with PID `x_stats_pid` and all of its descendants. +This can have a performance overhead and is disabled by default. + + +Disable cgroup v2 CPU and memory limits for system metric percentages. + + +Suffix to add to the run's directory name (sync_dir). -##### Arguments +This is set in wandb.init() to avoid naming conflicts. +If set, it is joined to the default name with a dash. + -- `value`: + +Flag to indicate whether this process can update the run's final state on the server. +Set to False in distributed training when only the main process should determine the final state. + diff --git a/models/ref/python/experiments/settings/settings-methods.mdx b/models/ref/python/experiments/settings/settings-methods.mdx new file mode 100644 index 0000000000..54a0579ffa --- /dev/null +++ b/models/ref/python/experiments/settings/settings-methods.mdx @@ -0,0 +1,47 @@ +--- +title: Settings methods +sidebarTitle: Methods +page_kind: class-methods +parent_slug: settings +kind: class +namespace: wandb.sdk.wandb_settings +--- + +## Class wandb.Settings + +## method Settings.validate_anonymous() + +```python +value: 'object' +``` + +##### Arguments + + + + + +## method Settings.validate_x_extra_http_headers() + +```python +(value) +``` + +##### Arguments + + + + + +## method Settings.validate_x_stats_coreweave_metadata_base_url() + +```python +(value) +``` + +##### Arguments + + + + + diff --git a/models/ref/python/experiments/settings/settings-properties.mdx b/models/ref/python/experiments/settings/settings-properties.mdx new file mode 100644 index 0000000000..e025c274bd --- /dev/null +++ b/models/ref/python/experiments/settings/settings-properties.mdx @@ -0,0 +1,98 @@ +--- +title: Settings properties +sidebarTitle: Properties +page_kind: class-properties +parent_slug: settings +kind: class +namespace: wandb.sdk.wandb_settings +--- + +## Class wandb.Settings + +## property app_url + +The URL for the W&B UI, usually https://wandb.ai. + +This is different from `base_url` (like https://api.wandb.ai) which +is used to access W&B APIs programmatically. + +## property colab_url + +The URL to the Colab notebook, if running in Colab. + +## property deployment + + + +## property files_dir + +Absolute path to the local directory where the run's files are stored. + +## property is_local + + + +## property log_dir + +The directory for storing log files. + +## property log_internal + +The path to the file to use for internal logs. + +## property log_symlink_internal + +The path to the symlink to the internal log file of the most recent run. + +## property log_symlink_user + +The path to the symlink to the user-process log file of the most recent run. + +## property log_user + +The path to the file to use for user-process logs. + +## property project_url + +The W&B URL where the project can be viewed. + +## property resume_fname + +The path to the resume file. + +## property run_mode + +The mode of the run. Can be either "run" or "offline-run". + +## property run_url + +The W&B URL where the run can be viewed. + +## property settings_workspace + +The path to the workspace settings file. + +## property sweep_url + +The W&B URL where the sweep can be viewed. + +## property sync_dir + +The directory for storing the run's files. + +## property sync_file + +Path to the append-only binary transaction log file. + +## property sync_symlink_latest + +Path to the symlink to the most recent run's transaction log file. + +## property timespec + +The time specification for the run. + +## property wandb_dir + +Full path to the wandb directory. + diff --git a/models/ref/python/functions/agent.mdx b/models/ref/python/functions/agent.mdx index 36bc4e68a0..36f7af78f0 100644 --- a/models/ref/python/functions/agent.mdx +++ b/models/ref/python/functions/agent.mdx @@ -7,7 +7,7 @@ namespace: wandb.wandb_agent import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + @@ -40,7 +40,6 @@ many agents to run. - `count`: The number of sweep config trials to try. - `forward_signals`: Whether to forward signals the agent receives to the child processes. Only supported by CLI agent. - ## Returns None diff --git a/models/ref/python/functions/box3d.mdx b/models/ref/python/functions/box3d.mdx index 082e50903a..234bb7fb79 100644 --- a/models/ref/python/functions/box3d.mdx +++ b/models/ref/python/functions/box3d.mdx @@ -7,7 +7,7 @@ namespace: wandb.sdk.data_types.object_3d import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + @@ -37,7 +37,6 @@ A 3D bounding box. The box is specified by its center, size and orientation. - `label`: An optional label for the box. - `score`: An optional score for the box. Typically used to indicate the confidence of a detection. - ## Returns A Box3D object. diff --git a/models/ref/python/functions/controller.mdx b/models/ref/python/functions/controller.mdx index 54121a5c6c..356591b2c8 100644 --- a/models/ref/python/functions/controller.mdx +++ b/models/ref/python/functions/controller.mdx @@ -7,7 +7,7 @@ namespace: wandb.sdk.wandb_sweep import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + @@ -34,7 +34,6 @@ Public sweep controller constructor. - ## Examples ```python diff --git a/models/ref/python/functions/finish.mdx b/models/ref/python/functions/finish.mdx index 4807bdc223..47702b420e 100644 --- a/models/ref/python/functions/finish.mdx +++ b/models/ref/python/functions/finish.mdx @@ -7,7 +7,7 @@ namespace: wandb.sdk.wandb_run import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + @@ -37,7 +37,6 @@ Run States: - `exit_code`: Integer indicating the run's exit status. Use 0 for success, any other value marks the run as failed. - `quiet`: Deprecated. Configure logging verbosity using `wandb.Settings(quiet=...)`. - ## Returns None diff --git a/models/ref/python/functions/init.mdx b/models/ref/python/functions/init.mdx index 99a10d2148..1dcf0d766c 100644 --- a/models/ref/python/functions/init.mdx +++ b/models/ref/python/functions/init.mdx @@ -7,7 +7,7 @@ namespace: wandb.sdk.wandb_init import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + @@ -117,7 +117,6 @@ Run IDs must not contain any of the following special characters `/ \ # ? % :` - `settings`: Specifies a dictionary or `wandb.Settings` object with advanced settings for the run. - `anonymous`: - ## Returns A `Run` object. @@ -130,7 +129,6 @@ A `Run` object. - `UsageError`: If the user provided invalid arguments. - `KeyboardInterrupt`: If user interrupts the run. - ## Examples `wandb.init()` returns a `Run` object. Use the run object to log data, diff --git a/models/ref/python/functions/login.mdx b/models/ref/python/functions/login.mdx index 19cdd64f2a..94f42950eb 100644 --- a/models/ref/python/functions/login.mdx +++ b/models/ref/python/functions/login.mdx @@ -7,7 +7,7 @@ namespace: wandb.sdk.wandb_login import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + @@ -63,12 +63,10 @@ If none of the above is true, then this gets the API key from the first of: - `referrer`: The referrer to use in the URL login request for analytics. - `anonymous`: - ## Returns `bool`: If `key` is configured. - ## Raises - `AuthenticationError`: If `api_key` fails verification with the server. @@ -76,4 +74,3 @@ If none of the above is true, then this gets the API key from the first of: - diff --git a/models/ref/python/functions/restore.mdx b/models/ref/python/functions/restore.mdx index d9cd2262c9..38fc7b9fbc 100644 --- a/models/ref/python/functions/restore.mdx +++ b/models/ref/python/functions/restore.mdx @@ -7,7 +7,7 @@ namespace: wandb.sdk.wandb_run import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + @@ -35,7 +35,6 @@ By default, will only download the file if it doesn't already exist. - `replace`: Whether to download the file even if it already exists locally - `root`: The directory to download the file to. Defaults to the current directory or the run directory if wandb.init was called. - ## Returns None if it can't find the file, otherwise a file object open for reading. @@ -47,4 +46,3 @@ None if it can't find the file, otherwise a file object open for reading. - diff --git a/models/ref/python/functions/setup.mdx b/models/ref/python/functions/setup.mdx index 869c730f24..9135c0619b 100644 --- a/models/ref/python/functions/setup.mdx +++ b/models/ref/python/functions/setup.mdx @@ -7,7 +7,7 @@ namespace: wandb.sdk.wandb_setup import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + @@ -41,7 +41,6 @@ See also `wandb.teardown()`. - ## Examples ```python diff --git a/models/ref/python/functions/sweep.mdx b/models/ref/python/functions/sweep.mdx index 18c68f709d..4866ad9fd6 100644 --- a/models/ref/python/functions/sweep.mdx +++ b/models/ref/python/functions/sweep.mdx @@ -7,7 +7,7 @@ namespace: wandb.sdk.wandb_sweep import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + @@ -41,7 +41,6 @@ for information on how to define your sweep. - `project`: The name of the project where W&B runs created from the sweep are sent to. If the project is not specified, the run is sent to a project labeled 'Uncategorized'. - `prior_runs`: The run IDs of existing runs to add to this sweep. - ## Returns `str`: A unique identifier for the sweep. @@ -50,4 +49,3 @@ for information on how to define your sweep. - diff --git a/models/ref/python/functions/teardown.mdx b/models/ref/python/functions/teardown.mdx index f0e729e0d5..6905a3480a 100644 --- a/models/ref/python/functions/teardown.mdx +++ b/models/ref/python/functions/teardown.mdx @@ -7,7 +7,7 @@ namespace: wandb.sdk.wandb_setup import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + @@ -34,7 +34,6 @@ such as when using Python's `multiprocessing` module. - `exit_code`: - ## Returns None diff --git a/models/ref/python/public-api/api.mdx b/models/ref/python/public-api/api.mdx index ed79767573..9ce37caed2 100644 --- a/models/ref/python/public-api/api.mdx +++ b/models/ref/python/public-api/api.mdx @@ -7,16 +7,11 @@ namespace: wandb.apis.public.api import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.Api -```python -overrides: 'dict[str, Any] | None' = None, -timeout: 'int | None' = None, -api_key: 'str | None' = None -``` +## Class wandb.Api @@ -24,1403 +19,33 @@ Used for querying the W&B server. -## Args - -- `overrides`: You can set `base_url` if you are using a W&B server other than `https://api.wandb.ai`. You can also set defaults for `entity`, `project`, and `run`. -- `timeout`: HTTP timeout in seconds for API requests. If not specified, the default timeout will be used. -- `api_key`: API key to use for authentication. If not provided, the API key from the current environment or configuration will be used. Prompts for an API key if none is provided or configured in the environment. - - - - -## Examples - -```python -import wandb - -wandb.Api() -``` - -## Properties - -### property default_entity - -Returns the default W&B entity. - -### property user_agent - -Returns W&B public user agent. - -### property viewer - -Returns the viewer object. - - - -## Methods - -### method Api.artifact() - -```python -(self, -name: 'str', -type: 'str | None' = None) -``` - -Returns a single artifact. - -##### Arguments - -- `name`: The artifact's name. The name of an artifact resembles a filepath that consists, at a minimum, the name of the project the artifact was logged to, the name of the artifact, and the artifact's version or alias. Optionally append the entity that logged the artifact as a prefix followed by a forward slash. If no entity is specified in the name, the Run or API setting's entity is used. -- `type`: The type of artifact to fetch. - - -##### Raises - -- `ValueError`: If the artifact name is not specified. -- `ValueError`: If the artifact type is specified but does not match the type of the fetched artifact. - - -##### Examples - -In the following code snippets "entity", "project", "artifact", -"version", and "alias" are placeholders for your W&B entity, name -of the project the artifact is in, the name of the artifact, -and artifact's version, respectively. - -```python -import wandb - -# Specify the project, artifact's name, and the artifact's alias -wandb.Api().artifact(name="project/artifact:alias") - -# Specify the project, artifact's name, and a specific artifact version -wandb.Api().artifact(name="project/artifact:version") - -# Specify the entity, project, artifact's name, and the artifact's alias -wandb.Api().artifact(name="entity/project/artifact:alias") - -# Specify the entity, project, artifact's name, and a specific artifact version -wandb.Api().artifact(name="entity/project/artifact:version") -``` - -### method Api.artifact_collection() - -```python -self, -type_name: 'str', -name: 'str' -``` - -Returns a single artifact collection by type. - -You can use the returned `ArtifactCollection` object to retrieve -information about specific artifacts in that collection, and more. - -##### Arguments - -- `type_name`: The type of artifact collection to fetch. -- `name`: An artifact collection name. Optionally append the entity that logged the artifact as a prefix followed by a forward slash. - - - - -##### Examples - -In the proceeding code snippet "type", "entity", "project", and -"artifact_name" are placeholders for the collection type, your W&B -entity, name of the project the artifact is in, and the name of -the artifact, respectively. - -```python -import wandb - -collections = wandb.Api().artifact_collection( - type_name="type", name="entity/project/artifact_name" -) - -# Get the first artifact in the collection -artifact_example = collections.artifacts()[0] - -# Download the contents of the artifact to the specified root directory. -artifact_example.download() -``` - -### method Api.artifact_collection_exists() - -```python -self, -name: 'str', -type: 'str' -``` - -Whether an artifact collection exists within a specified project and entity. - -##### Arguments - -- `name`: An artifact collection name. Optionally append the entity that logged the artifact as a prefix followed by a forward slash. If entity or project is not specified, infer the collection from the override params if they exist. Otherwise, entity is pulled from the user settings and project will default to "uncategorized". -- `type`: The type of artifact collection. - - - - -##### Examples - -In the proceeding code snippet "type", and "collection_name" refer to the type -of the artifact collection and the name of the collection, respectively. - -```python -import wandb - -wandb.Api.artifact_collection_exists(type="type", name="collection_name") -``` - -### method Api.artifact_collections() - -```python -self, -project_name: 'str', -type_name: 'str', -order: 'str | None' = None, -per_page: 'int' = 50, -start: 'str | None' = None -``` - -Returns a collection of matching artifact collections. - -##### Arguments - -- `project_name`: The name of the project to filter on. -- `type_name`: The name of the artifact type to filter on. -- `order`: Optional string to specify the order of the results. If prefixed with '+', sorts ascending (default). If prefixed with '-', sorts descending. -- `per_page`: Sets the page size for query pagination. Usually there is no reason to change this. -- `start`: Pagination cursor for resuming a past query, captured from a previous paginator's `.cursor` attribute. - - - - -### method Api.artifact_exists() - -```python -self, -name: 'str', -type: 'str | None' = None -``` - -Whether an artifact version exists within the specified project and entity. - -##### Arguments - -- `name`: The name of artifact. Add the artifact's entity and project as a prefix. Append the version or the alias of the artifact with a colon. If the entity or project is not specified, W&B uses override parameters if populated. Otherwise, the entity is pulled from the user settings and the project is set to "Uncategorized". -- `type`: The type of artifact. - - - - -##### Examples - -In the proceeding code snippets "entity", "project", "artifact", -"version", and "alias" are placeholders for your W&B entity, name of -the project the artifact is in, the name of the artifact, and -artifact's version, respectively. - -```python -import wandb - -wandb.Api().artifact_exists("entity/project/artifact:version") -wandb.Api().artifact_exists("entity/project/artifact:alias") -``` - -### method Api.artifact_type() - -```python -self, -type_name: 'str', -project: 'str | None' = None -``` - -Returns the matching `ArtifactType`. - -##### Arguments - -- `type_name`: The name of the artifact type to retrieve. -- `project`: If given, a project name or path to filter on. - - - - -### method Api.artifact_types() - -```python -self, -project: 'str | None' = None, -start: 'str | None' = None -``` - -Returns a collection of matching artifact types. - -##### Arguments - -- `project`: The project name or path to filter on. -- `start`: Pagination cursor for resuming a past query, captured from a previous paginator's `.cursor` attribute. - - - - -### method Api.artifact_versions() - -```python -(self, type_name, name, per_page=50) -``` - -Deprecated. Use `Api.artifacts(type_name, name)` method instead. - -##### Arguments - -- `type_name`: -- `name`: -- `per_page`: - - - - -### method Api.artifacts() - -```python -self, -type_name: 'str', -name: 'str', -order: 'str | None' = None, -per_page: 'int' = 50, -tags: 'list[str] | None' = None, -start: 'str | None' = None -``` - -Return an `Artifacts` collection. - -##### Arguments - -- `type_name`: The type of artifacts to fetch. -- `name`: The artifact's collection name. Optionally append the entity that logged the artifact as a prefix followed by a forward slash. -- `order`: Optional string to specify the order of the results. If prefixed with '+', sorts ascending (default). If prefixed with '-', sorts descending. -- `per_page`: Sets the page size for query pagination. Usually there is no reason to change this. -- `tags`: Only return artifacts with all of these tags. -- `start`: Pagination cursor for resuming a past query, captured from a previous paginator's `.cursor` attribute. - - - - -##### Examples - -In the proceeding code snippet, "type", "entity", "project", and -"artifact_name" are placeholders for the artifact type, W&B entity, -name of the project the artifact was logged to, -and the name of the artifact, respectively. - -```python -import wandb - -wandb.Api().artifacts(type_name="type", name="entity/project/artifact_name") -``` - -Pause iteration and resume later from the same position by saving -the paginator's `.cursor` and passing it as `start=`: - -```python -from itertools import islice - -import wandb - -api = wandb.Api() - -# Consume the first page of results, then save the cursor. -page_size = 10 -artifacts = api.artifacts( - type_name="type", - name="entity/project/artifact_name", - per_page=page_size, -) -first_page = list(islice(artifacts, page_size)) - -saved_cursor = artifacts.cursor - -# Later (e.g. in a new process), resume iteration from the saved cursor. -remaining_artifacts = api.artifacts( - type_name="type", - name="entity/project/artifact_name", - per_page=page_size, - start=saved_cursor, -) -``` - -### method Api.automation() - -```python -self, -name: 'str', *, -entity: 'str | None' = None -``` - -Returns the only Automation matching the parameters. - -##### Arguments - -- `name`: The name of the automation to fetch. -- `entity`: The entity to fetch the automation for. - - -##### Raises - -- `ValueError`: If zero or multiple Automations match the search criteria. - - -##### Examples - -Get an existing automation named "my-automation": - -```python -import wandb - -api = wandb.Api() -automation = api.automation(name="my-automation") -``` - -Get an existing automation named "other-automation", from the entity "my-team": - -```python -automation = api.automation(name="other-automation", entity="my-team") -``` - -### method Api.automations() - -```python -self, -entity: 'str | None' = None, *, -name: 'str | None' = None, -per_page: 'int' = 50, -start: 'str | None' = None -``` - -Returns an iterator over all Automations that match the given parameters. - -If no parameters are provided, the returned iterator will contain all -Automations that the user has access to. - -##### Arguments - -- `entity`: The entity to fetch the automations for. -- `name`: The name of the automation to fetch. -- `per_page`: The number of automations to fetch per page. Defaults to 50. Usually there is no reason to change this. -- `start`: Pagination cursor for resuming a past query, captured from a previous paginator's `.cursor` attribute. - - - - -##### Examples - -Fetch all existing automations for the entity "my-team": - -```python -import wandb - -api = wandb.Api() -automations = api.automations(entity="my-team") -``` - -### method Api.create_automation() - ```python -self, -obj: 'NewAutomation', *, -fetch_existing: 'bool' = False, **kwargs: 'Unpack[WriteAutomationsKwargs]' +overrides: 'dict[str, Any] | None' = None, +timeout: 'int | None' = None, +api_key: 'str | None' = None ``` -Create a new Automation. - -##### Arguments +## Args -- `obj`: The automation to create. -- `fetch_existing`: If True, and a conflicting automation already exists, attempt to fetch the existing automation instead of raising an error. -- `kwargs`: + +You can set `base_url` if you are using a W&B server other than `https://api.wandb.ai`. You can also set defaults for `entity`, `project`, and `run`. + + +HTTP timeout in seconds for API requests. If not specified, the default timeout will be used. + + +API key to use for authentication. If not provided, the API key from the current environment or configuration will be used. Prompts for an API key if none is provided or configured in the environment. + -##### Examples -Create a new automation named "my-automation" that sends a Slack notification -when a run within a specific project logs a metric exceeding a custom threshold: +## Examples ```python import wandb -from wandb.automations import OnRunMetric, RunEvent, SendNotification - -api = wandb.Api() - -project = api.project("my-project", entity="my-team") - -# Use the first Slack integration for the team -slack_hook = next(api.slack_integrations(entity="my-team")) - -event = OnRunMetric( - scope=project, - filter=RunEvent.metric("custom-metric") > 10, -) -action = SendNotification.from_integration(slack_hook) - -automation = api.create_automation( - event >> action, - name="my-automation", - description="Send a Slack message whenever 'custom-metric' exceeds 10.", -) -``` -### method Api.create_custom_chart() - -```python -self, -entity: 'str', -name: 'str', -display_name: 'str', -spec_type: "Literal['vega2']", -access: "Literal['private', 'public']", -spec: 'str | dict' -``` - -Create a custom chart preset and return its id. - -##### Arguments - -- `entity`: The entity (user or team) that owns the chart -- `name`: Unique identifier for the chart preset -- `display_name`: Human-readable name shown in the UI -- `spec_type`: Type of specification. Must be "vega2" for Vega-Lite v2 specifications. -- `access`: Access level for the chart: - - "private": Chart is only accessible to the entity that created it - - "public": Chart is publicly accessible -- `spec`: The Vega/Vega-Lite specification as a dictionary or JSON string - - -##### Raises - -- `wandb.Error`: If chart creation fails -- `UnsupportedError`: If the server doesn't support custom charts - - -##### Examples - -```python - import wandb - - api = wandb.Api() - - # Define a simple bar chart specification - vega_spec = { - "$schema": "https://vega.github.io/schema/vega-lite/v6.json", - "mark": "bar", - "data": {"name": "wandb"}, - "encoding": { - "x": {"field": "${field:x}", "type": "ordinal"}, - "y": {"field": "${field:y}", "type": "quantitative"}, - }, - } - - # Create the custom chart - chart_id = api.create_custom_chart( - entity="my-team", - name="my-bar-chart", - display_name="My Custom Bar Chart", - spec_type="vega2", - access="private", - spec=vega_spec, - ) - - # Use with wandb.plot_table() - chart = wandb.plot_table( - vega_spec_name=chart_id, - data_table=my_table, - fields={"x": "category", "y": "value"}, - ) - ``` - -### method Api.create_project() - -```python -self, -name: 'str', -entity: 'str' -``` - -Create a new project. - -##### Arguments - -- `name`: The name of the new project. -- `entity`: The entity of the new project. - - - - -### method Api.create_registry() - -```python -self, -name: 'str', -visibility: "Literal['organization', 'restricted']", -organization: 'str | None' = None, -description: 'str | None' = None, -artifact_types: 'list[str] | None' = None +wandb.Api() ``` -Create a new registry. - -##### Arguments - -- `name`: The name of the registry. Name must be unique within the organization. -- `visibility`: The visibility of the registry. organization: Anyone in the organization can view this registry. You can edit their roles later from the settings in the UI. restricted: Only invited members via the UI can access this registry. Public sharing is disabled. -- `organization`: The organization of the registry. If no organization is set in the settings, the organization will be fetched from the entity if the entity only belongs to one organization. -- `description`: The description of the registry. -- `artifact_types`: The accepted artifact types of the registry. A type is no more than 128 characters and do not include characters `/` or `:`. If not specified, all types are accepted. Allowed types added to the registry cannot be removed later. - - - - -##### Examples - -```python -import wandb - -api = wandb.Api() -registry = api.create_registry( - name="my-registry", - visibility="restricted", - organization="my-org", - description="This is a test registry", - artifact_types=["model"], -) -``` - -### method Api.create_run() - -```python -self, *, -run_id: 'str | None' = None, -project: 'str | None' = None, -entity: 'str | None' = None -``` - -Create a new run. - -##### Arguments - -- `run_id`: The ID to assign to the run. If not specified, W&B creates a random ID. -- `project`: The project where to log the run to. If no project is specified, log the run to a project called "Uncategorized". -- `entity`: The entity that owns the project. If no entity is specified, log the run to the default entity. - - - - -### method Api.create_run_queue() - -```python -self, -name: 'str', -type: 'public.RunQueueResourceType', -entity: 'str | None' = None, -prioritization_mode: 'public.RunQueuePrioritizationMode | None' = None, -config: 'dict | None' = None, -template_variables: 'dict | None' = None -``` - -Create a new run queue in W&B Launch. - -##### Arguments - -- `name`: Name of the queue to create -- `type`: Type of resource to be used for the queue. One of "local-container", "local-process", "kubernetes","sagemaker", or "gcp-vertex". -- `entity`: Name of the entity to create the queue. If `None`, use the configured or default entity. -- `prioritization_mode`: Version of prioritization to use. Either "V0" or `None`. -- `config`: Default resource configuration to be used for the queue. Use handlebars (eg. `{{var}}`) to specify template variables. -- `template_variables`: A dictionary of template variable schemas to use with the config. - - - - -### method Api.create_team() - -```python -self, -team: 'str', -admin_username: 'str | None' = None -``` - -Create a new team. - -For W&B Multi-tenant Cloud users, set the Default API organization in -your user settings in the W&B UI before calling `create_team()`. -This setting determines the organization the new team will belong to. - -##### Arguments - -- `team`: The name of the team. -- `admin_username`: Username of the admin user of the team. Defaults to the current user. - - - - -### method Api.create_user() - -```python -self, -email: 'str', -admin: 'bool | None' = False -``` - -Create a new user. - -##### Arguments - -- `email`: The email address of the user. -- `admin`: Set user as a global instance administrator. - - - - -### method Api.delete_automation() - -```python -self, -obj: 'Automation | str' -``` - -Delete an automation. - -##### Arguments - -- `obj`: The automation to delete, or its ID. - - - - -### method Api.flush() - -```python -(self) -``` - -Flush the local cache. - -The api object keeps a local cache of runs, so if the state of the run -may change while executing your script you must clear the local cache -with `api.flush()` to get the latest values associated with the run. - - - - - -### method Api.from_path() - -```python -(self, -path: 'str') -``` - -Return a run, sweep, project or report from a path. - -##### Arguments - -- `path`: The path to the project, run, sweep or report - - - - -##### Examples - -In the proceeding code snippets "project", "team", "run_id", "sweep_id", -and "report_name" are placeholders for the project, team, run ID, -sweep ID, and the name of a specific report, respectively. - -```python -import wandb - -api = wandb.Api() - -project = api.from_path("project") -team_project = api.from_path("team/project") -run = api.from_path("team/project/runs/run_id") -sweep = api.from_path("team/project/sweeps/sweep_id") -report = api.from_path("team/project/reports/report_name") -``` - -### method Api.integrations() - -```python -self, -entity: 'str | None' = None, *, -per_page: 'int' = 50, -start: 'str | None' = None -``` - -Return an iterator of all integrations for an entity. - -##### Arguments - -- `entity`: The entity (e.g. team name) for which to fetch integrations. If not provided, the user's default entity will be used. -- `per_page`: Number of integrations to fetch per page. Defaults to 50. Usually there is no reason to change this. -- `start`: - - - - -### method Api.job() - -```python -self, -name: 'str | None', -path: 'str | None' = None -``` - -Return a `Job` object. - -##### Arguments - -- `name`: The name of the job. -- `path`: The root path to download the job artifact. - - - - -### method Api.list_jobs() - -```python -self, -entity: 'str', -project: 'str' -``` - -Return a list of jobs, if any, for the given entity and project. - -##### Arguments - -- `entity`: The entity for the listed jobs. -- `project`: The project for the listed jobs. - - - - -### method Api.organization() - -```python -self, -name: 'str | None' = None -``` - -Return the matching `Organization`. - -##### Arguments - -- `name`: The name of the organization. If omitted, this method will attempt to infer and return the current default organization. - - - - -### method Api.project() - -```python -self, -name: 'str', -entity: 'str | None' = None -``` - -Return the `Project` with the given name (and entity, if given). - -##### Arguments - -- `name`: The project name. -- `entity`: Name of the entity requested. If None, will fall back to the default entity passed to `Api`. If no default entity, will raise a `ValueError`. - - - - -### method Api.projects() - -```python -self, -entity: 'str | None' = None, -per_page: 'int' = 200 -``` - -Get projects for a given entity. - -##### Arguments - -- `entity`: Name of the entity requested. If None, will fall back to the default entity passed to `Api`. If no default entity, will raise a `ValueError`. -- `per_page`: Sets the page size for query pagination. Usually there is no reason to change this. - - - - -### method Api.queued_run() - -```python -(self, -entity: 'str', -project: 'str', -queue_name: 'str', -run_queue_item_id: 'str', project_queue=None, priority=None) -``` - -Return a single queued run based on the path. - -Parses paths of the form `entity/project/queue_id/run_queue_item_id`. - -##### Arguments - -- `entity`: -- `project`: -- `queue_name`: -- `run_queue_item_id`: -- `project_queue`: -- `priority`: - - - - -### method Api.registries() - -```python -self, -organization: 'str | None' = None, -filter: 'dict[str, Any] | None' = None, -order: 'str | None' = None, -per_page: 'int' = 100, -start: 'str | None' = None -``` - -Returns a lazy iterator of `Registry` objects. - -Use the iterator to search and filter registries, collections, -or artifact versions across your organization's registry. - -##### Arguments - -- `organization`: The organization of the registry to fetch. If not specified, use the organization specified in the user's settings. -- `filter`: Optional MongoDB-style filter to apply to each object in the lazy registry iterator. Fields available to filter for registries are `name`, `description`, `created_at`, `updated_at`. Fields available to filter for collections are `name`, `tag`, `description`, `created_at`, `updated_at` Fields available to filter for versions are `tag`, `alias`, `created_at`, `updated_at`, `metadata` -- `order`: Optional string to specify the order of the results. If prefixed with '+', sorts ascending (default). If prefixed with '-', sorts descending. -- `per_page`: Sets the page size for query pagination. -- `start`: Pagination cursor for resuming a past query, captured from a previous paginator's `.cursor` attribute. - - - - -##### Examples - -Find all registries with the names that contain "model" - -```python -import wandb - -api = wandb.Api() # specify an org if your entity belongs to multiple orgs -api.registries(filter={"name": {"$regex": "model"}}) -``` - -Find all collections in the registries with the name "my_collection" and the tag "my_tag" - -```python -api.registries().collections(filter={"name": "my_collection", "tag": "my_tag"}) -``` - -Find all artifact versions in the registries with a collection name that contains "my_collection" and a version that has the alias "best" - -```python -api.registries().collections( - filter={"name": {"$regex": "my_collection"}} -).versions(filter={"alias": "best"}) -``` - -Find all artifact versions in the registries that contain "model" and have the tag "prod" or alias "best" - -```python -api.registries(filter={"name": {"$regex": "model"}}).versions( - filter={"$or": [{"tag": "prod"}, {"alias": "best"}]} -) -``` - -Pause iteration and resume later from the same position by saving -the paginator's `.cursor` and passing it as `start=`: - -```python -from itertools import islice - -import wandb - -api = wandb.Api() - -# Consume the first page of results, then save the cursor. -page_size = 10 -registries = api.registries(per_page=page_size) -first_page = list(islice(registries, page_size)) - -saved_cursor = registries.cursor - -# Later (e.g. in a new process), resume iteration from the saved cursor. -remaining_registries = api.registries(per_page=page_size, start=saved_cursor) -``` - -### method Api.registry() - -```python -self, -name: 'str', -organization: 'str | None' = None -``` - -Return a registry given a registry name. - -##### Arguments - -- `name`: The name of the registry. This is without the `wandb-registry-` prefix. -- `organization`: The organization of the registry. If no organization is set in the settings, the organization will be fetched from the entity if the entity only belongs to one organization. - - - - -##### Examples - -Fetch and update a registry - -```python -import wandb - -api = wandb.Api() -registry = api.registry(name="my-registry", organization="my-org") -registry.description = "This is an updated description" -registry.save() -``` - -### method Api.reports() - -```python -self, -path: 'str' = '', -name: 'str | None' = None, -per_page: 'int' = 50 -``` - -Get reports for a given project path. - -Note: `wandb.Api.reports()` API is in beta and will likely change in -future releases. - -##### Arguments - -- `path`: The path to the project the report resides in. Specify the entity that created the project as a prefix followed by a forward slash. -- `name`: Name of the report requested. -- `per_page`: Sets the page size for query pagination. Usually there is no reason to change this. - - - - -##### Examples - -```python -import wandb - -wandb.Api.reports("entity/project") -``` - -### method Api.run() - -```python -(self, path='') -``` - -Return a single run by parsing path in the form `entity/project/run_id`. - -##### Arguments - -- `path`: Path to run in the form `entity/project/run_id`. If `api.entity` is set, this can be in the form `project/run_id` and if `api.project` is set this can just be the run_id. - - -##### Raises - -- `RunNotFoundError`: If a run is not found, or run data is not able to be loaded. - - -### method Api.run_queue() - -```python -(self, -entity: 'str', -name: 'str') -``` - -Return the named `RunQueue` for entity. - -See `Api.create_run_queue` for more information on how to create a run queue. - -##### Arguments - -- `entity`: -- `name`: - - - - -### method Api.runs() - -```python -(self, -path: 'str | None' = None, -filters: 'dict[str, Any] | None' = None, -order: 'str' = '+created_at', -per_page: 'int' = 50, -include_sweeps: 'bool' = False, -lazy: 'bool' = True) -``` - -Returns a `Runs` object, which lazily iterates over `Run` objects. - -Fields you can filter by include: -- `createdAt`: The timestamp when the run was created. (in ISO 8601 format, e.g. "2023-01-01T12:00:00Z") -- `displayName`: The human-readable display name of the run. (e.g. "eager-fox-1") -- `duration`: The total runtime of the run in seconds. -- `group`: The group name used to organize related runs together. -- `host`: The hostname where the run was executed. -- `jobType`: The type of job or purpose of the run. -- `name`: The unique identifier of the run. (e.g. "a1b2cdef") -- `state`: The current state of the run. -- `tags`: The tags associated with the run. -- `username`: The username of the user who initiated the run - -Additionally, you can filter by items in the run config or summary metrics. -Such as `config.experiment_name`, `summary_metrics.loss`, etc. - -For more complex filtering, you can use MongoDB query operators. -For details, see: https://docs.mongodb.com/manual/reference/operator/query -The following operations are supported: -- `$and` -- `$or` -- `$nor` -- `$eq` -- `$ne` -- `$gt` -- `$gte` -- `$lt` -- `$lte` -- `$in` -- `$nin` -- `$exists` -- `$regex` - -##### Arguments - -- `path`: (str) path to project, should be in the form: "entity/project" -- `filters`: (dict) queries for specific runs using the MongoDB query language. You can filter by run properties such as config.key, summary_metrics.key, state, entity, createdAt, etc. For example: `{"config.experiment_name": "foo"}` would find runs with a config entry of experiment name set to "foo" -- `order`: (str) Order can be `created_at`, `heartbeat_at`, `config.*.value`, or `summary_metrics.*`. If you prepend order with a + order is ascending (default). If you prepend order with a - order is descending. The default order is run.created_at from oldest to newest. -- `per_page`: (int) Sets the page size for query pagination. -- `include_sweeps`: (bool) Whether to eagerly fetch the sweep object in each run result. -- `lazy`: (bool) Whether to use lazy loading for faster performance. When True (default), only essential run metadata is loaded initially. Heavy fields like config, summaryMetrics, and systemMetrics are loaded on-demand when accessed. Set to False for full data upfront. - - - - -##### Examples - -```python -import wandb -from wandb.apis.public import Api - -# Find runs in project where config.experiment_name has been set to "foo" -Api.runs(path="my_entity/project", filters={"config.experiment_name": "foo"}) -``` - -```python -# Find runs in project where config.experiment_name has been set to "foo" or "bar" -Api.runs( - path="my_entity/project", - filters={ - "$or": [ - {"config.experiment_name": "foo"}, - {"config.experiment_name": "bar"}, - ] - }, -) -``` - -```python -# Find runs in project where config.experiment_name matches a regex -Api.runs( - path="my_entity/project", - filters={"config.experiment_name": {"$regex": "b.*"}}, -) -``` - -Note: - Regular expressions use Google's RE2 syntax: - https://github.com/google/re2/wiki/Syntax - -```python -# Find runs in project where the run name matches a regex -Api.runs( - path="my_entity/project", filters={"display_name": {"$regex": "^foo.*"}} -) -``` - -```python -# Find runs in project sorted by ascending loss -Api.runs(path="my_entity/project", order="+summary_metrics.loss") -``` - -### method Api.slack_integrations() - -```python -self, *, -entity: 'str | None' = None, -per_page: 'int' = 50, -start: 'str | None' = None -``` - -Returns an iterator of Slack integrations for an entity. - -##### Arguments - -- `entity`: The entity (e.g. team name) for which to fetch integrations. If not provided, the user's default entity will be used. -- `per_page`: Number of integrations to fetch per page. Defaults to 50. Usually there is no reason to change this. -- `start`: - - - - -##### Examples - -Get all registered Slack integrations for the team "my-team": - -```python -import wandb - -api = wandb.Api() -slack_integrations = api.slack_integrations(entity="my-team") -``` - -Find only Slack integrations that post to channel names starting with "team-alerts-": - -```python -slack_integrations = api.slack_integrations(entity="my-team") -team_alert_integrations = [ - ig - for ig in slack_integrations - if ig.channel_name.startswith("team-alerts-") -] -``` - -### method Api.sweep() - -```python -(self, path='') -``` - -Return a sweep by parsing path in the form `entity/project/sweep_id`. - -##### Arguments - -- `path`: Path to sweep in the form entity/project/sweep_id. If `api.entity` is set, this can be in the form project/sweep_id and if `api.project` is set this can just be the sweep_id. - - - - -### method Api.sync_tensorboard() - -```python -(self, root_dir, run_id=None, project=None, entity=None) -``` - -Sync a local directory containing tfevent files to wandb. - -##### Arguments - -- `root_dir`: -- `run_id`: -- `project`: -- `entity`: - - - - -### method Api.team() - -```python -self, -team: 'str' -``` - -Return the matching `Team` with the given name. - -##### Arguments - -- `team`: The name of the team. - - - - -### method Api.update_automation() - -```python -self, -obj: 'Automation', *, -create_missing: 'bool' = False, **kwargs: 'Unpack[WriteAutomationsKwargs]' -``` - -Update an existing automation. - -##### Arguments - -- `obj`: The automation to update. Must be an existing automation. -- `create_missing`: If True, and the automation does not exist, create it. -- `kwargs`: - - - - -##### Examples - -Disable and edit the description of an existing automation ("my-automation"): - -```python -import wandb - -api = wandb.Api() - -automation = api.automation(name="my-automation") -automation.enabled = False -automation.description = "Kept for reference, but no longer used." - -updated_automation = api.update_automation(automation) -``` - -OR - -```python -import wandb - -api = wandb.Api() - -automation = api.automation(name="my-automation") - -updated_automation = api.update_automation( - automation, - enabled=False, - description="Kept for reference, but no longer used.", -) -``` - -### method Api.upsert_run_queue() - -```python -(self, -name: 'str', -resource_config: 'dict', -resource_type: 'public.RunQueueResourceType', -entity: 'str | None' = None, -template_variables: 'dict | None' = None, -external_links: 'dict | None' = None, -prioritization_mode: 'public.RunQueuePrioritizationMode | None' = None) -``` - -Upsert a run queue in W&B Launch. - -##### Arguments - -- `name`: Name of the queue to create -- `resource_config`: Optional default resource configuration to be used for the queue. Use handlebars (eg. `{{var}}`) to specify template variables. -- `resource_type`: Type of resource to be used for the queue. One of "local-container", "local-process", "kubernetes", "sagemaker", or "gcp-vertex". -- `entity`: Optional name of the entity to create the queue. If `None`, use the configured or default entity. -- `template_variables`: A dictionary of template variable schemas to be used with the config. -- `external_links`: Optional dictionary of external links to be used with the queue. -- `prioritization_mode`: Optional version of prioritization to use. Either "V0" or None - - - - -### method Api.user() - -```python -self, -username_or_email: 'str' -``` - -Return a user from a username or email address. - -This function only works for local administrators. Use `api.viewer` - to get your own user object. - -##### Arguments - -- `username_or_email`: The username or email address of the user. - - - - -### method Api.users() - -```python -self, -username_or_email: 'str' -``` - -Return all users from a partial username or email address query. - -This function only works for local administrators. Use `api.viewer` - to get your own user object. - -##### Arguments - -- `username_or_email`: The prefix or suffix of the user you want to find. - - - - -### method Api.webhook_integrations() - -```python -self, -entity: 'str | None' = None, *, -per_page: 'int' = 50, -start: 'str | None' = None -``` - -Returns an iterator of webhook integrations for an entity. - -##### Arguments - -- `entity`: The entity (e.g. team name) for which to fetch integrations. If not provided, the user's default entity will be used. -- `per_page`: Number of integrations to fetch per page. Defaults to 50. Usually there is no reason to change this. -- `start`: - - - - -##### Examples - -Get all registered webhook integrations for the team "my-team": - -```python -import wandb - -api = wandb.Api() -webhook_integrations = api.webhook_integrations(entity="my-team") -``` - -Find only webhook integrations that post requests to "https://my-fake-url.com": - -```python -webhook_integrations = api.webhook_integrations(entity="my-team") -my_webhooks = [ - ig - for ig in webhook_integrations - if ig.url_endpoint.startswith("https://my-fake-url.com") -] -``` - - - diff --git a/models/ref/python/public-api/api/api-methods.mdx b/models/ref/python/public-api/api/api-methods.mdx new file mode 100644 index 0000000000..9c432b7327 --- /dev/null +++ b/models/ref/python/public-api/api/api-methods.mdx @@ -0,0 +1,1720 @@ +--- +title: Api methods +sidebarTitle: Methods +page_kind: class-methods +parent_slug: api +kind: class +namespace: wandb.apis.public.api +--- + +## Class wandb.Api + +## method Api.artifact() + +Returns a single artifact. + +```python +(self, +name: 'str', +type: 'str | None' = None) +``` + +##### Arguments + + +The artifact's name. The name of an artifact resembles a filepath that consists, at a minimum, the name of the project the artifact was logged to, the name of the artifact, and the artifact's version or alias. Optionally append the entity that logged the artifact as a prefix followed by a forward slash. If no entity is specified in the name, the Run or API setting's entity is used. + + + +The type of artifact to fetch. + + +##### Returns + +An `Artifact` object. + +##### Raises + + +If the artifact name is not specified. + + + +If the artifact type is specified but does not match the type of the fetched artifact. + + +##### Examples + +In the following code snippets "entity", "project", "artifact", +"version", and "alias" are placeholders for your W&B entity, name +of the project the artifact is in, the name of the artifact, +and artifact's version, respectively. + +```python +import wandb + +# Specify the project, artifact's name, and the artifact's alias +wandb.Api().artifact(name="project/artifact:alias") + +# Specify the project, artifact's name, and a specific artifact version +wandb.Api().artifact(name="project/artifact:version") + +# Specify the entity, project, artifact's name, and the artifact's alias +wandb.Api().artifact(name="entity/project/artifact:alias") + +# Specify the entity, project, artifact's name, and a specific artifact version +wandb.Api().artifact(name="entity/project/artifact:version") +``` + +## method Api.artifact_collection() + +Returns a single artifact collection by type. + +You can use the returned `ArtifactCollection` object to retrieve +information about specific artifacts in that collection, and more. + +```python +self, +type_name: 'str', +name: 'str' +``` + +##### Arguments + + +The type of artifact collection to fetch. + + + +An artifact collection name. Optionally append the entity that logged the artifact as a prefix followed by a forward slash. + + +##### Returns + +An `ArtifactCollection` object. + +##### Examples + +In the proceeding code snippet "type", "entity", "project", and +"artifact_name" are placeholders for the collection type, your W&B +entity, name of the project the artifact is in, and the name of +the artifact, respectively. + +```python +import wandb + +collections = wandb.Api().artifact_collection( + type_name="type", name="entity/project/artifact_name" +) + +# Get the first artifact in the collection +artifact_example = collections.artifacts()[0] + +# Download the contents of the artifact to the specified root directory. +artifact_example.download() +``` + +## method Api.artifact_collection_exists() + +Whether an artifact collection exists within a specified project and entity. + +```python +self, +name: 'str', +type: 'str' +``` + +##### Arguments + + +An artifact collection name. Optionally append the entity that logged the artifact as a prefix followed by a forward slash. If entity or project is not specified, infer the collection from the override params if they exist. Otherwise, entity is pulled from the user settings and project will default to "uncategorized". + + + +The type of artifact collection. + + +##### Returns + +True if the artifact collection exists, False otherwise. + +##### Examples + +In the proceeding code snippet "type", and "collection_name" refer to the type +of the artifact collection and the name of the collection, respectively. + +```python +import wandb + +wandb.Api.artifact_collection_exists(type="type", name="collection_name") +``` + +## method Api.artifact_collections() + +Returns a collection of matching artifact collections. + +```python +self, +project_name: 'str', +type_name: 'str', +order: 'str | None' = None, +per_page: 'int' = 50, +start: 'str | None' = None +``` + +##### Arguments + + +The name of the project to filter on. + + + +The name of the artifact type to filter on. + + + +Optional string to specify the order of the results. If prefixed with '+', sorts ascending (default). If prefixed with '-', sorts descending. + + + +Sets the page size for query pagination. Usually there is no reason to change this. + + + +Pagination cursor for resuming a past query, captured from a previous paginator's `.cursor` attribute. + + +##### Returns + +An iterable `ArtifactCollections` object. + +## method Api.artifact_exists() + +Whether an artifact version exists within the specified project and entity. + +```python +self, +name: 'str', +type: 'str | None' = None +``` + +##### Arguments + + +The name of artifact. Add the artifact's entity and project as a prefix. Append the version or the alias of the artifact with a colon. If the entity or project is not specified, W&B uses override parameters if populated. Otherwise, the entity is pulled from the user settings and the project is set to "Uncategorized". + + + +The type of artifact. + + +##### Returns + +True if the artifact version exists, False otherwise. + +##### Examples + +In the proceeding code snippets "entity", "project", "artifact", +"version", and "alias" are placeholders for your W&B entity, name of +the project the artifact is in, the name of the artifact, and +artifact's version, respectively. + +```python +import wandb + +wandb.Api().artifact_exists("entity/project/artifact:version") +wandb.Api().artifact_exists("entity/project/artifact:alias") +``` + +## method Api.artifact_type() + +Returns the matching `ArtifactType`. + +```python +self, +type_name: 'str', +project: 'str | None' = None +``` + +##### Arguments + + +The name of the artifact type to retrieve. + + + +If given, a project name or path to filter on. + + +##### Returns + +An `ArtifactType` object. + +## method Api.artifact_types() + +Returns a collection of matching artifact types. + +```python +self, +project: 'str | None' = None, +start: 'str | None' = None +``` + +##### Arguments + + +The project name or path to filter on. + + + +Pagination cursor for resuming a past query, captured from a previous paginator's `.cursor` attribute. + + +##### Returns + +An iterable `ArtifactTypes` object. + +## method Api.artifact_versions() + +Deprecated. Use `Api.artifacts(type_name, name)` method instead. + +```python +(self, type_name, name, per_page=50) +``` + +##### Arguments + + + + + + + + + + + + + +## method Api.artifacts() + +Return an `Artifacts` collection. + +```python +self, +type_name: 'str', +name: 'str', +order: 'str | None' = None, +per_page: 'int' = 50, +tags: 'list[str] | None' = None, +start: 'str | None' = None +``` + +##### Arguments + + +The type of artifacts to fetch. + + + +The artifact's collection name. Optionally append the entity that logged the artifact as a prefix followed by a forward slash. + + + +Optional string to specify the order of the results. If prefixed with '+', sorts ascending (default). If prefixed with '-', sorts descending. + + + +Sets the page size for query pagination. Usually there is no reason to change this. + + + +Only return artifacts with all of these tags. + + + +Pagination cursor for resuming a past query, captured from a previous paginator's `.cursor` attribute. + + +##### Returns + +An iterable `Artifacts` object. + +##### Examples + +In the proceeding code snippet, "type", "entity", "project", and +"artifact_name" are placeholders for the artifact type, W&B entity, +name of the project the artifact was logged to, +and the name of the artifact, respectively. + +```python +import wandb + +wandb.Api().artifacts(type_name="type", name="entity/project/artifact_name") +``` + +Pause iteration and resume later from the same position by saving +the paginator's `.cursor` and passing it as `start=`: + +```python +from itertools import islice + +import wandb + +api = wandb.Api() + +# Consume the first page of results, then save the cursor. +page_size = 10 +artifacts = api.artifacts( + type_name="type", + name="entity/project/artifact_name", + per_page=page_size, +) +first_page = list(islice(artifacts, page_size)) + +saved_cursor = artifacts.cursor + +# Later (e.g. in a new process), resume iteration from the saved cursor. +remaining_artifacts = api.artifacts( + type_name="type", + name="entity/project/artifact_name", + per_page=page_size, + start=saved_cursor, +) +``` + +## method Api.automation() + +Returns the only Automation matching the parameters. + +```python +self, +name: 'str', *, +entity: 'str | None' = None +``` + +##### Arguments + + +The name of the automation to fetch. + + + +The entity to fetch the automation for. + + +##### Raises + + +If zero or multiple Automations match the search criteria. + + +##### Examples + +Get an existing automation named "my-automation": + +```python +import wandb + +api = wandb.Api() +automation = api.automation(name="my-automation") +``` + +Get an existing automation named "other-automation", from the entity "my-team": + +```python +automation = api.automation(name="other-automation", entity="my-team") +``` + +## method Api.automations() + +Returns an iterator over all Automations that match the given parameters. + +If no parameters are provided, the returned iterator will contain all +Automations that the user has access to. + +```python +self, +entity: 'str | None' = None, *, +name: 'str | None' = None, +per_page: 'int' = 50, +start: 'str | None' = None +``` + +##### Arguments + + +The entity to fetch the automations for. + + + +The name of the automation to fetch. + + + +The number of automations to fetch per page. Defaults to 50. Usually there is no reason to change this. + + + +Pagination cursor for resuming a past query, captured from a previous paginator's `.cursor` attribute. + + +##### Returns + +A list of automations. + +##### Examples + +Fetch all existing automations for the entity "my-team": + +```python +import wandb + +api = wandb.Api() +automations = api.automations(entity="my-team") +``` + +## method Api.create_automation() + +Create a new Automation. + +```python +self, +obj: 'NewAutomation', *, +fetch_existing: 'bool' = False, **kwargs: 'Unpack[WriteAutomationsKwargs]' +``` + +##### Arguments + + +The automation to create. + + + +If True, and a conflicting automation already exists, attempt to fetch the existing automation instead of raising an error. + + + + + + +##### Returns + +The saved Automation. + +##### Examples + +Create a new automation named "my-automation" that sends a Slack notification +when a run within a specific project logs a metric exceeding a custom threshold: + +```python +import wandb +from wandb.automations import OnRunMetric, RunEvent, SendNotification + +api = wandb.Api() + +project = api.project("my-project", entity="my-team") + +# Use the first Slack integration for the team +slack_hook = next(api.slack_integrations(entity="my-team")) + +event = OnRunMetric( + scope=project, + filter=RunEvent.metric("custom-metric") > 10, +) +action = SendNotification.from_integration(slack_hook) + +automation = api.create_automation( + event >> action, + name="my-automation", + description="Send a Slack message whenever 'custom-metric' exceeds 10.", +) +``` + +## method Api.create_custom_chart() + +Create a custom chart preset and return its id. + +```python +self, +entity: 'str', +name: 'str', +display_name: 'str', +spec_type: "Literal['vega2']", +access: "Literal['private', 'public']", +spec: 'str | dict' +``` + +##### Arguments + + +The entity (user or team) that owns the chart + + + +Unique identifier for the chart preset + + + +Human-readable name shown in the UI + + + +Type of specification. Must be "vega2" for Vega-Lite v2 specifications. + + + +Access level for the chart: +- "private": Chart is only accessible to the entity that created it +- "public": Chart is publicly accessible + + + +The Vega/Vega-Lite specification as a dictionary or JSON string + + +##### Returns + +The ID of the created chart preset in the format "entity/name" + +##### Raises + + +If chart creation fails + + + +If the server doesn't support custom charts + + +##### Examples + +```python + import wandb + + api = wandb.Api() + + # Define a simple bar chart specification + vega_spec = { + "$schema": "https://vega.github.io/schema/vega-lite/v6.json", + "mark": "bar", + "data": {"name": "wandb"}, + "encoding": { + "x": {"field": "${field:x}", "type": "ordinal"}, + "y": {"field": "${field:y}", "type": "quantitative"}, + }, + } + + # Create the custom chart + chart_id = api.create_custom_chart( + entity="my-team", + name="my-bar-chart", + display_name="My Custom Bar Chart", + spec_type="vega2", + access="private", + spec=vega_spec, + ) + + # Use with wandb.plot_table() + chart = wandb.plot_table( + vega_spec_name=chart_id, + data_table=my_table, + fields={"x": "category", "y": "value"}, + ) + ``` + +## method Api.create_project() + +Create a new project. + +```python +self, +name: 'str', +entity: 'str' +``` + +##### Arguments + + +The name of the new project. + + + +The entity of the new project. + + +## method Api.create_registry() + +Create a new registry. + +```python +self, +name: 'str', +visibility: "Literal['organization', 'restricted']", +organization: 'str | None' = None, +description: 'str | None' = None, +artifact_types: 'list[str] | None' = None +``` + +##### Arguments + + +The name of the registry. Name must be unique within the organization. + + + +The visibility of the registry. organization: Anyone in the organization can view this registry. You can edit their roles later from the settings in the UI. restricted: Only invited members via the UI can access this registry. Public sharing is disabled. + + + +The organization of the registry. If no organization is set in the settings, the organization will be fetched from the entity if the entity only belongs to one organization. + + + +The description of the registry. + + + +The accepted artifact types of the registry. A type is no more than 128 characters and do not include characters `/` or `:`. If not specified, all types are accepted. Allowed types added to the registry cannot be removed later. + + +##### Returns + +A registry object. + +##### Examples + +```python +import wandb + +api = wandb.Api() +registry = api.create_registry( + name="my-registry", + visibility="restricted", + organization="my-org", + description="This is a test registry", + artifact_types=["model"], +) +``` + +## method Api.create_run() + +Create a new run. + +```python +self, *, +run_id: 'str | None' = None, +project: 'str | None' = None, +entity: 'str | None' = None +``` + +##### Arguments + + +The ID to assign to the run. If not specified, W&B creates a random ID. + + + +The project where to log the run to. If no project is specified, log the run to a project called "Uncategorized". + + + +The entity that owns the project. If no entity is specified, log the run to the default entity. + + +##### Returns + +The newly created `Run`. + +## method Api.create_run_queue() + +Create a new run queue in W&B Launch. + +```python +self, +name: 'str', +type: 'public.RunQueueResourceType', +entity: 'str | None' = None, +prioritization_mode: 'public.RunQueuePrioritizationMode | None' = None, +config: 'dict | None' = None, +template_variables: 'dict | None' = None +``` + +##### Arguments + + +Name of the queue to create + + + +Type of resource to be used for the queue. One of "local-container", "local-process", "kubernetes","sagemaker", or "gcp-vertex". + + + +Name of the entity to create the queue. If `None`, use the configured or default entity. + + + +Version of prioritization to use. Either "V0" or `None`. + + + +Default resource configuration to be used for the queue. Use handlebars (eg. `{{var}}`) to specify template variables. + + + +A dictionary of template variable schemas to use with the config. + + +##### Returns + +The newly created `RunQueue`. + +## method Api.create_team() + +Create a new team. + +```python +self, +team: 'str', +admin_username: 'str | None' = None +``` + +##### Arguments + + +The name of the team + + + +Username of the admin user of the team. Defaults to the current user. + + +##### Returns + +A `Team` object. + +## method Api.create_user() + +Create a new user. + +```python +self, +email: 'str', +admin: 'bool | None' = False +``` + +##### Arguments + + +The email address of the user. + + + +Set user as a global instance administrator. + + +##### Returns + +A `User` object. + +## method Api.delete_automation() + +Delete an automation. + +```python +self, +obj: 'Automation | str' +``` + +##### Arguments + + +The automation to delete, or its ID. + + +##### Returns + +True if the automation was deleted successfully. + +## method Api.flush() + +Flush the local cache. + +The api object keeps a local cache of runs, so if the state of the run +may change while executing your script you must clear the local cache +with `api.flush()` to get the latest values associated with the run. + +```python +(self) +``` + +## method Api.from_path() + +Return a run, sweep, project or report from a path. + +```python +(self, +path: 'str') +``` + +##### Arguments + + +The path to the project, run, sweep or report + + +##### Returns + +A `Project`, `Run`, `Sweep`, or `BetaReport` instance. + +##### Examples + +In the proceeding code snippets "project", "team", "run_id", "sweep_id", +and "report_name" are placeholders for the project, team, run ID, +sweep ID, and the name of a specific report, respectively. + +```python +import wandb + +api = wandb.Api() + +project = api.from_path("project") +team_project = api.from_path("team/project") +run = api.from_path("team/project/runs/run_id") +sweep = api.from_path("team/project/sweeps/sweep_id") +report = api.from_path("team/project/reports/report_name") +``` + +## method Api.integrations() + +Return an iterator of all integrations for an entity. + +```python +self, +entity: 'str | None' = None, *, +per_page: 'int' = 50, +start: 'str | None' = None +``` + +##### Arguments + + +The entity (e.g. team name) for which to fetch integrations. If not provided, the user's default entity will be used. + + + +Number of integrations to fetch per page. Defaults to 50. Usually there is no reason to change this. + + + + + + +## method Api.job() + +Return a `Job` object. + +```python +self, +name: 'str | None', +path: 'str | None' = None +``` + +##### Arguments + + +The name of the job. + + + +The root path to download the job artifact. + + +##### Returns + +A `Job` object. + +## method Api.list_jobs() + +Return a list of jobs, if any, for the given entity and project. + +```python +self, +entity: 'str', +project: 'str' +``` + +##### Arguments + + +The entity for the listed jobs. + + + +The project for the listed jobs. + + +##### Returns + +A list of matching jobs. + +## method Api.organization() + +Return the matching `Organization`. + +```python +self, +name: 'str | None' = None +``` + +##### Arguments + + +The name of the organization. If omitted, this method will attempt to infer and return the current default organization. + + +##### Returns + +An `Organization` object. + +## method Api.project() + +Return the `Project` with the given name (and entity, if given). + +```python +self, +name: 'str', +entity: 'str | None' = None +``` + +##### Arguments + + +The project name. + + + +Name of the entity requested. If None, will fall back to the default entity passed to `Api`. If no default entity, will raise a `ValueError`. + + +##### Returns + +A `Project` object. + +## method Api.projects() + +Get projects for a given entity. + +```python +self, +entity: 'str | None' = None, +per_page: 'int' = 200 +``` + +##### Arguments + + +Name of the entity requested. If None, will fall back to the default entity passed to `Api`. If no default entity, will raise a `ValueError`. + + + +Sets the page size for query pagination. Usually there is no reason to change this. + + +##### Returns + +A `Projects` object which is an iterable collection of `Project`objects. + +## method Api.queued_run() + +Return a single queued run based on the path. + +Parses paths of the form `entity/project/queue_id/run_queue_item_id`. + +```python +(self, +entity: 'str', +project: 'str', +queue_name: 'str', +run_queue_item_id: 'str', project_queue=None, priority=None) +``` + +##### Arguments + + + + + + + + + + + + + + + + + + + + + + + + + +## method Api.registries() + +Returns a lazy iterator of `Registry` objects. + +Use the iterator to search and filter registries, collections, +or artifact versions across your organization's registry. + +```python +self, +organization: 'str | None' = None, +filter: 'dict[str, Any] | None' = None, +order: 'str | None' = None, +per_page: 'int' = 100, +start: 'str | None' = None +``` + +##### Arguments + + +The organization of the registry to fetch. If not specified, use the organization specified in the user's settings. + + + +Optional MongoDB-style filter to apply to each object in the lazy registry iterator. Fields available to filter for registries are `name`, `description`, `created_at`, `updated_at`. Fields available to filter for collections are `name`, `tag`, `description`, `created_at`, `updated_at` Fields available to filter for versions are `tag`, `alias`, `created_at`, `updated_at`, `metadata` + + + +Optional string to specify the order of the results. If prefixed with '+', sorts ascending (default). If prefixed with '-', sorts descending. + + + +Sets the page size for query pagination. + + + +Pagination cursor for resuming a past query, captured from a previous paginator's `.cursor` attribute. + + +##### Returns + +A lazy iterator of `Registry` objects. + +##### Examples + +Find all registries with the names that contain "model" + +```python +import wandb + +api = wandb.Api() # specify an org if your entity belongs to multiple orgs +api.registries(filter={"name": {"$regex": "model"}}) +``` + +Find all collections in the registries with the name "my_collection" and the tag "my_tag" + +```python +api.registries().collections(filter={"name": "my_collection", "tag": "my_tag"}) +``` + +Find all artifact versions in the registries with a collection name that contains "my_collection" and a version that has the alias "best" + +```python +api.registries().collections( + filter={"name": {"$regex": "my_collection"}} +).versions(filter={"alias": "best"}) +``` + +Find all artifact versions in the registries that contain "model" and have the tag "prod" or alias "best" + +```python +api.registries(filter={"name": {"$regex": "model"}}).versions( + filter={"$or": [{"tag": "prod"}, {"alias": "best"}]} +) +``` + +Pause iteration and resume later from the same position by saving +the paginator's `.cursor` and passing it as `start=`: + +```python +from itertools import islice + +import wandb + +api = wandb.Api() + +# Consume the first page of results, then save the cursor. +page_size = 10 +registries = api.registries(per_page=page_size) +first_page = list(islice(registries, page_size)) + +saved_cursor = registries.cursor + +# Later (e.g. in a new process), resume iteration from the saved cursor. +remaining_registries = api.registries(per_page=page_size, start=saved_cursor) +``` + +## method Api.registry() + +Return a registry given a registry name. + +```python +self, +name: 'str', +organization: 'str | None' = None +``` + +##### Arguments + + +The name of the registry. This is without the `wandb-registry-` prefix. + + + +The organization of the registry. If no organization is set in the settings, the organization will be fetched from the entity if the entity only belongs to one organization. + + +##### Returns + +A registry object. + +##### Examples + +Fetch and update a registry + +```python +import wandb + +api = wandb.Api() +registry = api.registry(name="my-registry", organization="my-org") +registry.description = "This is an updated description" +registry.save() +``` + +## method Api.reports() + +Get reports for a given project path. + +Note: `wandb.Api.reports()` API is in beta and will likely change in +future releases. + +```python +self, +path: 'str' = '', +name: 'str | None' = None, +per_page: 'int' = 50 +``` + +##### Arguments + + +The path to the project the report resides in. Specify the entity that created the project as a prefix followed by a forward slash. + + + +Name of the report requested. + + + +Sets the page size for query pagination. Usually there is no reason to change this. + + +##### Returns + +A `Reports` object which is an iterable collection of `BetaReport` objects. + +##### Examples + +```python +import wandb + +wandb.Api.reports("entity/project") +``` + +## method Api.run() + +Return a single run by parsing path in the form `entity/project/run_id`. + +```python +(self, path='') +``` + +##### Arguments + + +Path to run in the form `entity/project/run_id`. If `api.entity` is set, this can be in the form `project/run_id` and if `api.project` is set this can just be the run_id. + + +##### Returns + +A `Run` object. + +##### Raises + + +If a run is not found, or run data is not able to be loaded. + + +## method Api.run_queue() + +Return the named `RunQueue` for entity. + +See `Api.create_run_queue` for more information on how to create a run queue. + +```python +(self, +entity: 'str', +name: 'str') +``` + +##### Arguments + + + + + + + + + +## method Api.runs() + +Returns a `Runs` object, which lazily iterates over `Run` objects. + +Fields you can filter by include: +- `createdAt`: The timestamp when the run was created. (in ISO 8601 format, e.g. "2023-01-01T12:00:00Z") +- `displayName`: The human-readable display name of the run. (e.g. "eager-fox-1") +- `duration`: The total runtime of the run in seconds. +- `group`: The group name used to organize related runs together. +- `host`: The hostname where the run was executed. +- `jobType`: The type of job or purpose of the run. +- `name`: The unique identifier of the run. (e.g. "a1b2cdef") +- `state`: The current state of the run. +- `tags`: The tags associated with the run. +- `username`: The username of the user who initiated the run + +Additionally, you can filter by items in the run config or summary metrics. +Such as `config.experiment_name`, `summary_metrics.loss`, etc. + +For more complex filtering, you can use MongoDB query operators. +For details, see: https://docs.mongodb.com/manual/reference/operator/query +The following operations are supported: +- `$and` +- `$or` +- `$nor` +- `$eq` +- `$ne` +- `$gt` +- `$gte` +- `$lt` +- `$lte` +- `$in` +- `$nin` +- `$exists` +- `$regex` + +```python +(self, +path: 'str | None' = None, +filters: 'dict[str, Any] | None' = None, +order: 'str' = '+created_at', +per_page: 'int' = 50, +include_sweeps: 'bool' = False, +lazy: 'bool' = True) +``` + +##### Arguments + + +(str) path to project, should be in the form: "entity/project" + + + +(dict) queries for specific runs using the MongoDB query language. You can filter by run properties such as config.key, summary_metrics.key, state, entity, createdAt, etc. For example: `{"config.experiment_name": "foo"}` would find runs with a config entry of experiment name set to "foo" + + + +(str) Order can be `created_at`, `heartbeat_at`, `config.*.value`, or `summary_metrics.*`. If you prepend order with a + order is ascending (default). If you prepend order with a - order is descending. The default order is run.created_at from oldest to newest. + + + +(int) Sets the page size for query pagination. + + + +(bool) Whether to eagerly fetch the sweep object in each run result. + + + +(bool) Whether to use lazy loading for faster performance. When True (default), only essential run metadata is loaded initially. Heavy fields like config, summaryMetrics, and systemMetrics are loaded on-demand when accessed. Set to False for full data upfront. + + +##### Returns + +A `Runs` object, which is an iterable collection of `Run` objects. + +##### Examples + +```python +import wandb +from wandb.apis.public import Api + +# Find runs in project where config.experiment_name has been set to "foo" +Api.runs(path="my_entity/project", filters={"config.experiment_name": "foo"}) +``` + +```python +# Find runs in project where config.experiment_name has been set to "foo" or "bar" +Api.runs( + path="my_entity/project", + filters={ + "$or": [ + {"config.experiment_name": "foo"}, + {"config.experiment_name": "bar"}, + ] + }, +) +``` + +```python +# Find runs in project where config.experiment_name matches a regex +Api.runs( + path="my_entity/project", + filters={"config.experiment_name": {"$regex": "b.*"}}, +) +``` + +Note: + Regular expressions use Google's RE2 syntax: + https://github.com/google/re2/wiki/Syntax + +```python +# Find runs in project where the run name matches a regex +Api.runs( + path="my_entity/project", filters={"display_name": {"$regex": "^foo.*"}} +) +``` + +```python +# Find runs in project sorted by ascending loss +Api.runs(path="my_entity/project", order="+summary_metrics.loss") +``` + +## method Api.slack_integrations() + +Returns an iterator of Slack integrations for an entity. + +```python +self, *, +entity: 'str | None' = None, +per_page: 'int' = 50, +start: 'str | None' = None +``` + +##### Arguments + + +The entity (e.g. team name) for which to fetch integrations. If not provided, the user's default entity will be used. + + + +Number of integrations to fetch per page. Defaults to 50. Usually there is no reason to change this. + + + + + + +##### Examples + +Get all registered Slack integrations for the team "my-team": + +```python +import wandb + +api = wandb.Api() +slack_integrations = api.slack_integrations(entity="my-team") +``` + +Find only Slack integrations that post to channel names starting with "team-alerts-": + +```python +slack_integrations = api.slack_integrations(entity="my-team") +team_alert_integrations = [ + ig + for ig in slack_integrations + if ig.channel_name.startswith("team-alerts-") +] +``` + +## method Api.sweep() + +Return a sweep by parsing path in the form `entity/project/sweep_id`. + +```python +(self, path='') +``` + +##### Arguments + + +Path to sweep in the form entity/project/sweep_id. If `api.entity` is set, this can be in the form project/sweep_id and if `api.project` is set this can just be the sweep_id. + + +##### Returns + +A `Sweep` object. + +## method Api.sync_tensorboard() + +Sync a local directory containing tfevent files to wandb. + +```python +(self, root_dir, run_id=None, project=None, entity=None) +``` + +##### Arguments + + + + + + + + + + + + + + + + + +## method Api.team() + +Return the matching `Team` with the given name. + +```python +self, +team: 'str' +``` + +##### Arguments + + +The name of the team. + + +##### Returns + +A `Team` object. + +## method Api.update_automation() + +Update an existing automation. + +```python +self, +obj: 'Automation', *, +create_missing: 'bool' = False, **kwargs: 'Unpack[WriteAutomationsKwargs]' +``` + +##### Arguments + + +The automation to update. Must be an existing automation. + + + +If True, and the automation does not exist, create it. + + + + + + +##### Returns + +The updated automation. + +##### Examples + +Disable and edit the description of an existing automation ("my-automation"): + +```python +import wandb + +api = wandb.Api() + +automation = api.automation(name="my-automation") +automation.enabled = False +automation.description = "Kept for reference, but no longer used." + +updated_automation = api.update_automation(automation) +``` + +OR + +```python +import wandb + +api = wandb.Api() + +automation = api.automation(name="my-automation") + +updated_automation = api.update_automation( + automation, + enabled=False, + description="Kept for reference, but no longer used.", +) +``` + +## method Api.upsert_run_queue() + +Upsert a run queue in W&B Launch. + +```python +(self, +name: 'str', +resource_config: 'dict', +resource_type: 'public.RunQueueResourceType', +entity: 'str | None' = None, +template_variables: 'dict | None' = None, +external_links: 'dict | None' = None, +prioritization_mode: 'public.RunQueuePrioritizationMode | None' = None) +``` + +##### Arguments + + +Name of the queue to create + + + +Optional default resource configuration to be used for the queue. Use handlebars (eg. `{{var}}`) to specify template variables. + + + +Type of resource to be used for the queue. One of "local-container", "local-process", "kubernetes", "sagemaker", or "gcp-vertex". + + + +Optional name of the entity to create the queue. If `None`, use the configured or default entity. + + + +A dictionary of template variable schemas to be used with the config. + + + +Optional dictionary of external links to be used with the queue. + + + +Optional version of prioritization to use. Either "V0" or None + + +##### Returns + +The upserted `RunQueue`. + +## method Api.user() + +Return a user from a username or email address. + +This function only works for local administrators. Use `api.viewer` + to get your own user object. + +```python +self, +username_or_email: 'str' +``` + +##### Arguments + + +The username or email address of the user. + + +##### Returns + +A `User` object or None if a user is not found. + +## method Api.users() + +Return all users from a partial username or email address query. + +This function only works for local administrators. Use `api.viewer` + to get your own user object. + +```python +self, +username_or_email: 'str' +``` + +##### Arguments + + +The prefix or suffix of the user you want to find. + + +##### Returns + +An array of `User` objects. + +## method Api.webhook_integrations() + +Returns an iterator of webhook integrations for an entity. + +```python +self, +entity: 'str | None' = None, *, +per_page: 'int' = 50, +start: 'str | None' = None +``` + +##### Arguments + + +The entity (e.g. team name) for which to fetch integrations. If not provided, the user's default entity will be used. + + + +Number of integrations to fetch per page. Defaults to 50. Usually there is no reason to change this. + + + + + + +##### Examples + +Get all registered webhook integrations for the team "my-team": + +```python +import wandb + +api = wandb.Api() +webhook_integrations = api.webhook_integrations(entity="my-team") +``` + +Find only webhook integrations that post requests to "https://my-fake-url.com": + +```python +webhook_integrations = api.webhook_integrations(entity="my-team") +my_webhooks = [ + ig + for ig in webhook_integrations + if ig.url_endpoint.startswith("https://my-fake-url.com") +] +``` + diff --git a/models/ref/python/public-api/api/api-properties.mdx b/models/ref/python/public-api/api/api-properties.mdx new file mode 100644 index 0000000000..9be18af634 --- /dev/null +++ b/models/ref/python/public-api/api/api-properties.mdx @@ -0,0 +1,23 @@ +--- +title: Api properties +sidebarTitle: Properties +page_kind: class-properties +parent_slug: api +kind: class +namespace: wandb.apis.public.api +--- + +## Class wandb.Api + +## property default_entity + +Returns the default W&B entity. + +## property user_agent + +Returns W&B public user agent. + +## property viewer + +Returns the viewer object. + diff --git a/models/ref/python/public-api/artifactcollection.mdx b/models/ref/python/public-api/artifactcollection.mdx index d19cd6022c..70be9860d5 100644 --- a/models/ref/python/public-api/artifactcollection.mdx +++ b/models/ref/python/public-api/artifactcollection.mdx @@ -7,12 +7,11 @@ namespace: wandb.apis.public.artifacts import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.apis.public.ArtifactCollection - +## Class wandb.apis.public.ArtifactCollection @@ -26,121 +25,5 @@ An artifact collection that represents a group of related artifacts. -## Properties - -### property aliases - -The aliases for all artifact versions contained in this collection. - -### property created_at - -The creation date of the artifact collection. - -### property description - -A description of the artifact collection. - -### property entity - -The entity (user or team) that owns the project. - -### property id - -The unique identifier of the artifact collection. - -### property name - -The name of the artifact collection. - -### property project - -The project that contains the artifact collection. - -### property tags - -The tags associated with the artifact collection. - -### property type - -Returns the type of the artifact collection. - -### property updated_at - -The date at which the artifact collection was last updated. - - - -## Methods - -### method ArtifactCollection.artifacts() - -```python -self, -per_page: 'int' = 50, -start: 'str | None' = None -``` - -Get all artifacts in the collection. - -##### Arguments - -- `per_page`: The number of artifacts to fetch per page. -- `start`: Pagination cursor for resuming a past query, captured from a previous paginator's `.cursor` attribute. - - - - -### method ArtifactCollection.change_type() - -```python -self, -new_type: 'str' -``` - -Deprecated, change type directly with `save` instead. - -##### Arguments - -- `new_type`: - - - - -### method ArtifactCollection.delete() - -```python -self -``` - -Delete the entire artifact collection. - - - - - -### method ArtifactCollection.is_sequence() - -```python -self -``` - -Return whether the artifact collection is a sequence. - - - - - -### method ArtifactCollection.save() - -```python -self -``` - -Persist any changes made to the artifact collection. - - - - - diff --git a/models/ref/python/public-api/artifactcollection/artifactcollection-methods.mdx b/models/ref/python/public-api/artifactcollection/artifactcollection-methods.mdx new file mode 100644 index 0000000000..9f6a0310e6 --- /dev/null +++ b/models/ref/python/public-api/artifactcollection/artifactcollection-methods.mdx @@ -0,0 +1,70 @@ +--- +title: ArtifactCollection methods +sidebarTitle: Methods +page_kind: class-methods +parent_slug: artifactcollection +kind: class +namespace: wandb.apis.public.artifacts +--- + +## Class wandb.apis.public.ArtifactCollection + +## method ArtifactCollection.artifacts() + +Get all artifacts in the collection. + +```python +self, +per_page: 'int' = 50, +start: 'str | None' = None +``` + +##### Arguments + + +The number of artifacts to fetch per page. + + + +Pagination cursor for resuming a past query, captured from a previous paginator's `.cursor` attribute. + + +## method ArtifactCollection.change_type() + +Deprecated, change type directly with `save` instead. + +```python +self, +new_type: 'str' +``` + +##### Arguments + + + + + +## method ArtifactCollection.delete() + +Delete the entire artifact collection. + +```python +self +``` + +## method ArtifactCollection.is_sequence() + +Return whether the artifact collection is a sequence. + +```python +self +``` + +## method ArtifactCollection.save() + +Persist any changes made to the artifact collection. + +```python +self +``` + diff --git a/models/ref/python/public-api/artifactcollection/artifactcollection-properties.mdx b/models/ref/python/public-api/artifactcollection/artifactcollection-properties.mdx new file mode 100644 index 0000000000..fefa5000f0 --- /dev/null +++ b/models/ref/python/public-api/artifactcollection/artifactcollection-properties.mdx @@ -0,0 +1,51 @@ +--- +title: ArtifactCollection properties +sidebarTitle: Properties +page_kind: class-properties +parent_slug: artifactcollection +kind: class +namespace: wandb.apis.public.artifacts +--- + +## Class wandb.apis.public.ArtifactCollection + +## property aliases + +The aliases for all artifact versions contained in this collection. + +## property created_at + +The creation date of the artifact collection. + +## property description + +A description of the artifact collection. + +## property entity + +The entity (user or team) that owns the project. + +## property id + +The unique identifier of the artifact collection. + +## property name + +The name of the artifact collection. + +## property project + +The project that contains the artifact collection. + +## property tags + +The tags associated with the artifact collection. + +## property type + +Returns the type of the artifact collection. + +## property updated_at + +The date at which the artifact collection was last updated. + diff --git a/models/ref/python/public-api/artifactcollections.mdx b/models/ref/python/public-api/artifactcollections.mdx index 63999a8e65..feba6b737f 100644 --- a/models/ref/python/public-api/artifactcollections.mdx +++ b/models/ref/python/public-api/artifactcollections.mdx @@ -7,12 +7,11 @@ namespace: wandb.apis.public.artifacts import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.apis.public.ArtifactCollections - +## Class wandb.apis.public.ArtifactCollections @@ -28,43 +27,3 @@ Artifact collections of a specific type in a project. -## Methods - -### method RelayPaginator.convert_objects() - -```python -self -``` - -Convert the last fetched response data into the iterated objects. - - - - - -### method Paginator.__next__() - -```python -self -``` - -Return the next item from the iterator. When exhausted, raise StopIteration - - - - - -### method Paginator.update_variables() - -```python -self -``` - -Update the query variables for the next page fetch. - - - - - - - diff --git a/models/ref/python/public-api/artifactcollections/artifactcollections-methods.mdx b/models/ref/python/public-api/artifactcollections/artifactcollections-methods.mdx new file mode 100644 index 0000000000..510272faa3 --- /dev/null +++ b/models/ref/python/public-api/artifactcollections/artifactcollections-methods.mdx @@ -0,0 +1,35 @@ +--- +title: ArtifactCollections methods +sidebarTitle: Methods +page_kind: class-methods +parent_slug: artifactcollections +kind: class +namespace: wandb.apis.public.artifacts +--- + +## Class wandb.apis.public.ArtifactCollections + +## method RelayPaginator.convert_objects() + +Convert the last fetched response data into the iterated objects. + +```python +self +``` + +## method Paginator.__next__() + +Return the next item from the iterator. When exhausted, raise StopIteration + +```python +self +``` + +## method Paginator.update_variables() + +Update the query variables for the next page fetch. + +```python +self +``` + diff --git a/models/ref/python/public-api/artifactfiles.mdx b/models/ref/python/public-api/artifactfiles.mdx index 083e9d3161..48997ca88e 100644 --- a/models/ref/python/public-api/artifactfiles.mdx +++ b/models/ref/python/public-api/artifactfiles.mdx @@ -7,12 +7,11 @@ namespace: wandb.apis.public.artifacts import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.apis.public.ArtifactFiles - +## Class wandb.apis.public.ArtifactFiles @@ -26,51 +25,5 @@ A paginator for files in an artifact. -## Properties - -### property path - -Returns the path of the artifact. - - - -## Methods - -### method RelayPaginator.convert_objects() - -```python -self -``` - -Convert the last fetched response data into the iterated objects. - - - - - -### method Paginator.__next__() - -```python -self -``` - -Return the next item from the iterator. When exhausted, raise StopIteration - - - - - -### method Paginator.update_variables() - -```python -self -``` - -Update the query variables for the next page fetch. - - - - - diff --git a/models/ref/python/public-api/artifactfiles/artifactfiles-methods.mdx b/models/ref/python/public-api/artifactfiles/artifactfiles-methods.mdx new file mode 100644 index 0000000000..3801fb6ef7 --- /dev/null +++ b/models/ref/python/public-api/artifactfiles/artifactfiles-methods.mdx @@ -0,0 +1,35 @@ +--- +title: ArtifactFiles methods +sidebarTitle: Methods +page_kind: class-methods +parent_slug: artifactfiles +kind: class +namespace: wandb.apis.public.artifacts +--- + +## Class wandb.apis.public.ArtifactFiles + +## method RelayPaginator.convert_objects() + +Convert the last fetched response data into the iterated objects. + +```python +self +``` + +## method Paginator.__next__() + +Return the next item from the iterator. When exhausted, raise StopIteration + +```python +self +``` + +## method Paginator.update_variables() + +Update the query variables for the next page fetch. + +```python +self +``` + diff --git a/models/ref/python/public-api/artifactfiles/artifactfiles-properties.mdx b/models/ref/python/public-api/artifactfiles/artifactfiles-properties.mdx new file mode 100644 index 0000000000..915c4c581a --- /dev/null +++ b/models/ref/python/public-api/artifactfiles/artifactfiles-properties.mdx @@ -0,0 +1,15 @@ +--- +title: ArtifactFiles properties +sidebarTitle: Properties +page_kind: class-properties +parent_slug: artifactfiles +kind: class +namespace: wandb.apis.public.artifacts +--- + +## Class wandb.apis.public.ArtifactFiles + +## property path + +Returns the path of the artifact. + diff --git a/models/ref/python/public-api/artifacts.mdx b/models/ref/python/public-api/artifacts.mdx index acd90db310..d56f30b1c9 100644 --- a/models/ref/python/public-api/artifacts.mdx +++ b/models/ref/python/public-api/artifacts.mdx @@ -7,12 +7,11 @@ namespace: wandb.apis.public.artifacts import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.apis.public.Artifacts - +## Class wandb.apis.public.Artifacts @@ -30,31 +29,3 @@ Optionally pass in filters to narrow down the results based on specific criteria -## Methods - -### method Paginator.__next__() - -```python -self -``` - -Return the next item from the iterator. When exhausted, raise StopIteration - - - - - -### method Paginator.update_variables() - -```python -self -``` - -Update the query variables for the next page fetch. - - - - - - - diff --git a/models/ref/python/public-api/artifacts/artifacts-methods.mdx b/models/ref/python/public-api/artifacts/artifacts-methods.mdx new file mode 100644 index 0000000000..f44b51d4de --- /dev/null +++ b/models/ref/python/public-api/artifacts/artifacts-methods.mdx @@ -0,0 +1,27 @@ +--- +title: Artifacts methods +sidebarTitle: Methods +page_kind: class-methods +parent_slug: artifacts +kind: class +namespace: wandb.apis.public.artifacts +--- + +## Class wandb.apis.public.Artifacts + +## method Paginator.__next__() + +Return the next item from the iterator. When exhausted, raise StopIteration + +```python +self +``` + +## method Paginator.update_variables() + +Update the query variables for the next page fetch. + +```python +self +``` + diff --git a/models/ref/python/public-api/artifacttype.mdx b/models/ref/python/public-api/artifacttype.mdx index 5d610f142d..4e5a36427c 100644 --- a/models/ref/python/public-api/artifacttype.mdx +++ b/models/ref/python/public-api/artifacttype.mdx @@ -7,12 +7,11 @@ namespace: wandb.apis.public.artifacts import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.apis.public.ArtifactType - +## Class wandb.apis.public.ArtifactType @@ -26,57 +25,5 @@ An artifact object that satisfies query based on the specified type. -## Properties - -### property id - -The unique identifier of the artifact type. - -### property name - -The name of the artifact type. - - - -## Methods - -### method ArtifactType.collection() - -```python -self, -name: 'str' -``` - -Get a specific artifact collection by name. - -##### Arguments - -- `name`: The name of the artifact collection to retrieve. - - - - -### method ArtifactType.collections() - -```python -self, -filters: 'Mapping[str, Any] | None' = None, -order: 'str | None' = None, -per_page: 'int' = 50, -start: 'str | None' = None -``` - -Get all artifact collections associated with this artifact type. - -##### Arguments - -- `filters`: Optional mapping of filters to apply to the query. -- `order`: Optional string to specify the order of the results. If prefixed with '+', sorts ascending (default). If prefixed with '-', sorts descending. The default order is the collection ID in descending order. -- `per_page`: The number of artifact collections to fetch per page. Default is 50. -- `start`: Pagination cursor for resuming a past query, captured from a previous paginator's `.cursor` attribute. - - - - diff --git a/models/ref/python/public-api/artifacttype/artifacttype-methods.mdx b/models/ref/python/public-api/artifacttype/artifacttype-methods.mdx new file mode 100644 index 0000000000..5bb6c46cf6 --- /dev/null +++ b/models/ref/python/public-api/artifacttype/artifacttype-methods.mdx @@ -0,0 +1,56 @@ +--- +title: ArtifactType methods +sidebarTitle: Methods +page_kind: class-methods +parent_slug: artifacttype +kind: class +namespace: wandb.apis.public.artifacts +--- + +## Class wandb.apis.public.ArtifactType + +## method ArtifactType.collection() + +Get a specific artifact collection by name. + +```python +self, +name: 'str' +``` + +##### Arguments + + +The name of the artifact collection to retrieve. + + +## method ArtifactType.collections() + +Get all artifact collections associated with this artifact type. + +```python +self, +filters: 'Mapping[str, Any] | None' = None, +order: 'str | None' = None, +per_page: 'int' = 50, +start: 'str | None' = None +``` + +##### Arguments + + +Optional mapping of filters to apply to the query. + + + +Optional string to specify the order of the results. If prefixed with '+', sorts ascending (default). If prefixed with '-', sorts descending. The default order is the collection ID in descending order. + + + +The number of artifact collections to fetch per page. Default is 50. + + + +Pagination cursor for resuming a past query, captured from a previous paginator's `.cursor` attribute. + + diff --git a/models/ref/python/public-api/artifacttype/artifacttype-properties.mdx b/models/ref/python/public-api/artifacttype/artifacttype-properties.mdx new file mode 100644 index 0000000000..14d1f554eb --- /dev/null +++ b/models/ref/python/public-api/artifacttype/artifacttype-properties.mdx @@ -0,0 +1,19 @@ +--- +title: ArtifactType properties +sidebarTitle: Properties +page_kind: class-properties +parent_slug: artifacttype +kind: class +namespace: wandb.apis.public.artifacts +--- + +## Class wandb.apis.public.ArtifactType + +## property id + +The unique identifier of the artifact type. + +## property name + +The name of the artifact type. + diff --git a/models/ref/python/public-api/artifacttypes.mdx b/models/ref/python/public-api/artifacttypes.mdx index 753e175cf1..6b0e0f31f3 100644 --- a/models/ref/python/public-api/artifacttypes.mdx +++ b/models/ref/python/public-api/artifacttypes.mdx @@ -7,12 +7,11 @@ namespace: wandb.apis.public.artifacts import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.apis.public.ArtifactTypes - +## Class wandb.apis.public.ArtifactTypes @@ -28,43 +27,3 @@ An lazy iterator of `ArtifactType` objects for a specific project. -## Methods - -### method RelayPaginator.convert_objects() - -```python -self -``` - -Convert the last fetched response data into the iterated objects. - - - - - -### method Paginator.__next__() - -```python -self -``` - -Return the next item from the iterator. When exhausted, raise StopIteration - - - - - -### method Paginator.update_variables() - -```python -self -``` - -Update the query variables for the next page fetch. - - - - - - - diff --git a/models/ref/python/public-api/artifacttypes/artifacttypes-methods.mdx b/models/ref/python/public-api/artifacttypes/artifacttypes-methods.mdx new file mode 100644 index 0000000000..a1d4c2d57d --- /dev/null +++ b/models/ref/python/public-api/artifacttypes/artifacttypes-methods.mdx @@ -0,0 +1,35 @@ +--- +title: ArtifactTypes methods +sidebarTitle: Methods +page_kind: class-methods +parent_slug: artifacttypes +kind: class +namespace: wandb.apis.public.artifacts +--- + +## Class wandb.apis.public.ArtifactTypes + +## method RelayPaginator.convert_objects() + +Convert the last fetched response data into the iterated objects. + +```python +self +``` + +## method Paginator.__next__() + +Return the next item from the iterator. When exhausted, raise StopIteration + +```python +self +``` + +## method Paginator.update_variables() + +Update the query variables for the next page fetch. + +```python +self +``` + diff --git a/models/ref/python/public-api/betareport.mdx b/models/ref/python/public-api/betareport.mdx index 449e06c1c2..356a1e09d7 100644 --- a/models/ref/python/public-api/betareport.mdx +++ b/models/ref/python/public-api/betareport.mdx @@ -7,11 +7,22 @@ namespace: wandb.apis.public.reports import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + + + + +## Class wandb.apis.public.BetaReport + + + +BetaReport is a class associated with reports created in W&B. + +Provides access to report attributes (name, description, user, spec, +timestamps) and methods for retrieving associated runs, +sections, and for rendering the report as HTML. -## class wandb.apis.public.BetaReport ```python (service_api: 'ServiceApi', attrs: 'dict', @@ -19,23 +30,23 @@ entity: 'str | None' = None, project: 'str | None' = None) ``` +## Args + -BetaReport is a class associated with reports created in W&B. + -Provides access to report attributes (name, description, user, spec, -timestamps) and methods for retrieving associated runs, -sections, and for rendering the report as HTML. + + + -## Args + -- `service_api`: -- `attrs`: -- `entity`: -- `project`: + + ## Attributes @@ -51,90 +62,3 @@ sections, and for rendering the report as HTML. - -## Properties - -### property created_at - - - -### property description - - - -### property display_name - - - -### property id - - - -### property name - - - -### property sections - -Get the panel sections (groups) from the report. - -### property spec - - - -### property updated_at - - - -### property url - - - -### property user - - - - - -## Methods - -### method BetaReport.runs() - -```python -self, -section: 'dict[str, Any]', -per_page: 'int' = 50, -only_selected: 'bool' = True -``` - -Get runs associated with a section of the report. - -##### Arguments - -- `section`: -- `per_page`: -- `only_selected`: - - - - -### method BetaReport.to_html() - -```python -self, -height: 'int' = 1024, -hidden: 'bool' = False -``` - -Generate HTML containing an iframe displaying this report. - -##### Arguments - -- `height`: -- `hidden`: - - - - - - diff --git a/models/ref/python/public-api/betareport/betareport-methods.mdx b/models/ref/python/public-api/betareport/betareport-methods.mdx new file mode 100644 index 0000000000..bba60ee32f --- /dev/null +++ b/models/ref/python/public-api/betareport/betareport-methods.mdx @@ -0,0 +1,56 @@ +--- +title: BetaReport methods +sidebarTitle: Methods +page_kind: class-methods +parent_slug: betareport +kind: class +namespace: wandb.apis.public.reports +--- + +## Class wandb.apis.public.BetaReport + +## method BetaReport.runs() + +Get runs associated with a section of the report. + +```python +self, +section: 'dict[str, Any]', +per_page: 'int' = 50, +only_selected: 'bool' = True +``` + +##### Arguments + + + + + + + + + + + + + +## method BetaReport.to_html() + +Generate HTML containing an iframe displaying this report. + +```python +self, +height: 'int' = 1024, +hidden: 'bool' = False +``` + +##### Arguments + + + + + + + + + diff --git a/models/ref/python/public-api/betareport/betareport-properties.mdx b/models/ref/python/public-api/betareport/betareport-properties.mdx new file mode 100644 index 0000000000..39031ffc32 --- /dev/null +++ b/models/ref/python/public-api/betareport/betareport-properties.mdx @@ -0,0 +1,49 @@ +--- +title: BetaReport properties +sidebarTitle: Properties +page_kind: class-properties +parent_slug: betareport +kind: class +namespace: wandb.apis.public.reports +--- + +## Class wandb.apis.public.BetaReport + +## property created_at + + + +## property description + + + +## property display_name + + + +## property id + + + +## property name + + + +## property sections + +Get the panel sections (groups) from the report. + +## property spec + + + +## property updated_at + + + +## property url + + + +## property user + diff --git a/models/ref/python/public-api/downloadhistoryresult.mdx b/models/ref/python/public-api/downloadhistoryresult.mdx index b58f99b449..ea452b64b7 100644 --- a/models/ref/python/public-api/downloadhistoryresult.mdx +++ b/models/ref/python/public-api/downloadhistoryresult.mdx @@ -7,29 +7,37 @@ namespace: wandb.apis.public.runhistory.downloads import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + + + + +## Class wandb.apis.public.DownloadHistoryResult + + + +Result of downloading a run's history exports. -## class wandb.apis.public.DownloadHistoryResult ```python paths: 'list[pathlib.Path]', contains_live_data: 'bool', errors: 'dict[pathlib.Path, str] | None' = None ``` +## Args + -Result of downloading a run's history exports. - + + -## Args + -- `paths`: -- `contains_live_data`: -- `errors`: + + ## Attributes @@ -39,8 +47,3 @@ Result of downloading a run's history exports. - - - - - diff --git a/models/ref/python/public-api/file.mdx b/models/ref/python/public-api/file.mdx index f6ccad2f6c..0788a32f7b 100644 --- a/models/ref/python/public-api/file.mdx +++ b/models/ref/python/public-api/file.mdx @@ -7,12 +7,11 @@ namespace: wandb.apis.public.files import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.apis.public.File - +## Class wandb.apis.public.File @@ -45,53 +44,5 @@ file logged to a specific run. You can search using the following keys: -## Properties - -### property path_uri - -Returns the URI path to the file in the storage bucket. - -### property size - -Returns the size of the file in bytes. - - - -## Methods - -### method File.delete() - -```python -self -``` - -Delete the file from the W&B server. - - - - - -### method File.download() - -```python -self, -root: 'str' = '.', -replace: 'bool' = False, -exist_ok: 'bool' = False, -api: 'Api | None' = None -``` - -Downloads a file previously saved by a run from the wandb server. - -##### Arguments - -- `root`: Local directory to save the file. Defaults to the current working directory ("."). -- `replace`: If `True`, download will overwrite a local file if it exists. Defaults to `False`. -- `exist_ok`: If `True`, will not raise ValueError if file already exists and will not re-download unless replace=True. Defaults to `False`. -- `api`: If specified, the `Api` instance used to download the file. - - - - diff --git a/models/ref/python/public-api/file/file-methods.mdx b/models/ref/python/public-api/file/file-methods.mdx new file mode 100644 index 0000000000..c018a35fcf --- /dev/null +++ b/models/ref/python/public-api/file/file-methods.mdx @@ -0,0 +1,49 @@ +--- +title: File methods +sidebarTitle: Methods +page_kind: class-methods +parent_slug: file +kind: class +namespace: wandb.apis.public.files +--- + +## Class wandb.apis.public.File + +## method File.delete() + +Delete the file from the W&B server. + +```python +self +``` + +## method File.download() + +Downloads a file previously saved by a run from the wandb server. + +```python +self, +root: 'str' = '.', +replace: 'bool' = False, +exist_ok: 'bool' = False, +api: 'Api | None' = None +``` + +##### Arguments + + +Local directory to save the file. Defaults to the current working directory ("."). + + + +If `True`, download will overwrite a local file if it exists. Defaults to `False`. + + + +If `True`, will not raise ValueError if file already exists and will not re-download unless replace=True. Defaults to `False`. + + + +If specified, the `Api` instance used to download the file. + + diff --git a/models/ref/python/public-api/file/file-properties.mdx b/models/ref/python/public-api/file/file-properties.mdx new file mode 100644 index 0000000000..79f8b8a1a0 --- /dev/null +++ b/models/ref/python/public-api/file/file-properties.mdx @@ -0,0 +1,19 @@ +--- +title: File properties +sidebarTitle: Properties +page_kind: class-properties +parent_slug: file +kind: class +namespace: wandb.apis.public.files +--- + +## Class wandb.apis.public.File + +## property path_uri + +Returns the URI path to the file in the storage bucket. + +## property size + +Returns the size of the file in bytes. + diff --git a/models/ref/python/public-api/files.mdx b/models/ref/python/public-api/files.mdx index cc469f6e5d..56a2c9db4e 100644 --- a/models/ref/python/public-api/files.mdx +++ b/models/ref/python/public-api/files.mdx @@ -7,11 +7,21 @@ namespace: wandb.apis.public.files import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + + + + +## Class wandb.apis.public.Files + + + +A lazy iterator over a collection of `File` objects. + +Access and manage files uploaded to W&B during a run. Handles pagination +automatically when iterating through large collections of files. -## class wandb.apis.public.Files ```python (service_api: 'ServiceApi', run: 'Run', @@ -21,24 +31,31 @@ upload: 'bool' = False, pattern: 'str | None' = None) ``` +## Args + +The service API instance to use for querying W&B. + -A lazy iterator over a collection of `File` objects. - -Access and manage files uploaded to W&B during a run. Handles pagination -automatically when iterating through large collections of files. + +The run object that contains the files + + +A list of file names to filter the files + + +The number of files to fetch per page + -## Args - -- `service_api`: The service API instance to use for querying W&B. -- `run`: The run object that contains the files -- `names`: A list of file names to filter the files -- `per_page`: The number of files to fetch per page -- `upload`: If `True`, fetch the upload URL for each file -- `pattern`: Pattern to match when returning files from W&B This pattern uses mySQL's LIKE syntax, so matching all files that end with .json would be "%.json". If both names and pattern are provided, a ValueError will be raised. + +If `True`, fetch the upload URL for each file + + +Pattern to match when returning files from W&B This pattern uses mySQL's LIKE syntax, so matching all files that end with .json would be "%.json". If both names and pattern are provided, a ValueError will be raised. + @@ -64,21 +81,3 @@ for file in files: file.download(root="download_directory", replace=True) ``` - - -## Methods - -### method Paginator.__next__() - -```python -self -``` - -Return the next item from the iterator. When exhausted, raise StopIteration - - - - - - - diff --git a/models/ref/python/public-api/files/files-methods.mdx b/models/ref/python/public-api/files/files-methods.mdx new file mode 100644 index 0000000000..fcecbae0d0 --- /dev/null +++ b/models/ref/python/public-api/files/files-methods.mdx @@ -0,0 +1,19 @@ +--- +title: Files methods +sidebarTitle: Methods +page_kind: class-methods +parent_slug: files +kind: class +namespace: wandb.apis.public.files +--- + +## Class wandb.apis.public.Files + +## method Paginator.__next__() + +Return the next item from the iterator. When exhausted, raise StopIteration + +```python +self +``` + diff --git a/models/ref/python/public-api/incompleterunhistoryerror.mdx b/models/ref/python/public-api/incompleterunhistoryerror.mdx index 3425cc2fd0..8ce15f9e65 100644 --- a/models/ref/python/public-api/incompleterunhistoryerror.mdx +++ b/models/ref/python/public-api/incompleterunhistoryerror.mdx @@ -7,12 +7,11 @@ namespace: wandb.apis.public.runhistory.downloads import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.apis.public.IncompleteRunHistoryError - +## Class wandb.apis.public.IncompleteRunHistoryError @@ -31,39 +30,3 @@ parquet files yet, typically because the run is still ongoing. -## Methods - -### method BaseException.add_note() - -```python -(self, object, /) -``` - -Exception.add_note(note) -- -add a note to the exception - -##### Arguments - -- `object`: - - - - -### method BaseException.with_traceback() - -```python -(self, object, /) -``` - -Exception.with_traceback(tb) -- -set self.__traceback__ to tb and return self. - -##### Arguments - -- `object`: - - - - - - diff --git a/models/ref/python/public-api/incompleterunhistoryerror/incompleterunhistoryerror-methods.mdx b/models/ref/python/public-api/incompleterunhistoryerror/incompleterunhistoryerror-methods.mdx new file mode 100644 index 0000000000..031c52071c --- /dev/null +++ b/models/ref/python/public-api/incompleterunhistoryerror/incompleterunhistoryerror-methods.mdx @@ -0,0 +1,41 @@ +--- +title: IncompleteRunHistoryError methods +sidebarTitle: Methods +page_kind: class-methods +parent_slug: incompleterunhistoryerror +kind: class +namespace: wandb.apis.public.runhistory.downloads +--- + +## Class wandb.apis.public.IncompleteRunHistoryError + +## method BaseException.add_note() + +Exception.add_note(note) -- +add a note to the exception + +```python +(self, object, /) +``` + +##### Arguments + + + + + +## method BaseException.with_traceback() + +Exception.with_traceback(tb) -- +set self.__traceback__ to tb and return self. + +```python +(self, object, /) +``` + +##### Arguments + + + + + diff --git a/models/ref/python/public-api/member.mdx b/models/ref/python/public-api/member.mdx index 738b94e2e6..cfaa7b52d4 100644 --- a/models/ref/python/public-api/member.mdx +++ b/models/ref/python/public-api/member.mdx @@ -7,16 +7,11 @@ namespace: wandb.apis.public.teams import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.apis.public.Member -```python -(service_api: 'ServiceApi', -team: 'str', -attrs: 'Mapping[str, Any]') -``` +## Class wandb.apis.public.Member @@ -24,30 +19,25 @@ A member of a team. -## Args - -- `service_api`: The service API instance to use for querying W&B. -- `team`: The name of the team this member belongs to -- `attrs`: The member attributes - - - - - - - - -## Methods - -### method Member.delete() - ```python -(self) +(service_api: 'ServiceApi', +team: 'str', +attrs: 'Mapping[str, Any]') ``` -Remove a member from a team. +## Args + + +The service API instance to use for querying W&B. + + +The name of the team this member belongs to + + +The member attributes + diff --git a/models/ref/python/public-api/member/member-methods.mdx b/models/ref/python/public-api/member/member-methods.mdx new file mode 100644 index 0000000000..b4d0cf8f10 --- /dev/null +++ b/models/ref/python/public-api/member/member-methods.mdx @@ -0,0 +1,23 @@ +--- +title: Member methods +sidebarTitle: Methods +page_kind: class-methods +parent_slug: member +kind: class +namespace: wandb.apis.public.teams +--- + +## Class wandb.apis.public.Member + +## method Member.delete() + +Remove a member from a team. + +```python +(self) +``` + +##### Returns + +Boolean indicating success + diff --git a/models/ref/python/public-api/organization.mdx b/models/ref/python/public-api/organization.mdx index 92062f5bbb..7c8394e3b0 100644 --- a/models/ref/python/public-api/organization.mdx +++ b/models/ref/python/public-api/organization.mdx @@ -7,17 +7,11 @@ namespace: wandb.apis.public.organizations import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.apis.public.Organization -```python -service_api: 'InitVar[ServiceApi]', *, -id: 'GQLId', -name: 'str', -org_entity: '_OrgEntity' -``` +## Class wandb.apis.public.Organization @@ -28,17 +22,30 @@ Users should never need to instantiate this class directly. Use +```python +service_api: 'InitVar[ServiceApi]', *, +id: 'GQLId', +name: 'str', +org_entity: '_OrgEntity' +``` + ## Args -- `service_api`: -- `id`: -- `name`: -- `org_entity`: + + + + + + + + + + diff --git a/models/ref/python/public-api/project.mdx b/models/ref/python/public-api/project.mdx index b57d06c2ba..47bcc1961e 100644 --- a/models/ref/python/public-api/project.mdx +++ b/models/ref/python/public-api/project.mdx @@ -7,17 +7,11 @@ namespace: wandb.apis.public.projects import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.apis.public.Project -```python -service_api: 'ServiceApi', -entity: 'str', -project: 'str', -attrs: 'Mapping[str, Any]' -``` +## Class wandb.apis.public.Project @@ -25,94 +19,30 @@ A project is a namespace for runs. -## Args - -- `service_api`: The service API used to query W&B. -- `entity`: The entity which owns the project. -- `project`: The name of the project to query. -- `attrs`: The attributes of the project. - - - - - - -## Properties - -### property id - - - -### property owner - -Returns the project owner as a User object. - -### property path - -Returns the path of the project. The path is a list containing the -entity and project name. - -### property url - -Returns the URL of the project. - - - -## Methods - -### method Project.artifacts_types() - ```python -self, -per_page: 'int' = 50 -``` - -Returns all artifact types associated with this project. - -##### Arguments - -- `per_page`: - - - - -### method Project.collections() - -```python -self, -filters: 'Mapping[str, Any] | None' = None, -order: 'str | None' = None, -per_page: 'int' = 50 +service_api: 'ServiceApi', +entity: 'str', +project: 'str', +attrs: 'Mapping[str, Any]' ``` -Returns all artifact collections associated with this project. - -##### Arguments - -- `filters`: Optional mapping of filters to apply to the query. -- `order`: Optional string to specify the order of the results. If you prepend order with a + order is ascending (default). If you prepend order with a - order is descending. -- `per_page`: The number of artifact collections to fetch per page. Default is 50. - - - - -### method Project.sweeps() - -```python -self, -per_page: 'int' = 50, -filters: 'dict[str, Any] | None' = None, -order: 'str | None' = None -``` +## Args -Return a paginated collection of sweeps in this project. + +The service API used to query W&B. + -##### Arguments + +The entity which owns the project. + -- `per_page`: The number of sweeps to fetch per request to the API. -- `filters`: (dict) queries for specific sweeps using the runs filters, See wandb/apis/public/api.py:runs for more details. -- `order`: + +The name of the project to query. + + +The attributes of the project. + diff --git a/models/ref/python/public-api/project/project-methods.mdx b/models/ref/python/public-api/project/project-methods.mdx new file mode 100644 index 0000000000..0d2cc02bba --- /dev/null +++ b/models/ref/python/public-api/project/project-methods.mdx @@ -0,0 +1,80 @@ +--- +title: Project methods +sidebarTitle: Methods +page_kind: class-methods +parent_slug: project +kind: class +namespace: wandb.apis.public.projects +--- + +## Class wandb.apis.public.Project + +## method Project.artifacts_types() + +Returns all artifact types associated with this project. + +```python +self, +per_page: 'int' = 50 +``` + +##### Arguments + + + + + +## method Project.collections() + +Returns all artifact collections associated with this project. + +```python +self, +filters: 'Mapping[str, Any] | None' = None, +order: 'str | None' = None, +per_page: 'int' = 50 +``` + +##### Arguments + + +Optional mapping of filters to apply to the query. + + + +Optional string to specify the order of the results. If you prepend order with a + order is ascending (default). If you prepend order with a - order is descending. + + + +The number of artifact collections to fetch per page. Default is 50. + + +## method Project.sweeps() + +Return a paginated collection of sweeps in this project. + +```python +self, +per_page: 'int' = 50, +filters: 'dict[str, Any] | None' = None, +order: 'str | None' = None +``` + +##### Arguments + + +The number of sweeps to fetch per request to the API. + + + +(dict) queries for specific sweeps using the runs filters, See wandb/apis/public/api.py:runs for more details. + + + + + + +##### Returns + +A `Sweeps` object, which is an iterable collection of `Sweep` objects. + diff --git a/models/ref/python/public-api/project/project-properties.mdx b/models/ref/python/public-api/project/project-properties.mdx new file mode 100644 index 0000000000..f77d47c96d --- /dev/null +++ b/models/ref/python/public-api/project/project-properties.mdx @@ -0,0 +1,28 @@ +--- +title: Project properties +sidebarTitle: Properties +page_kind: class-properties +parent_slug: project +kind: class +namespace: wandb.apis.public.projects +--- + +## Class wandb.apis.public.Project + +## property id + + + +## property owner + +Returns the project owner as a User object. + +## property path + +Returns the path of the project. The path is a list containing the +entity and project name. + +## property url + +Returns the URL of the project. + diff --git a/models/ref/python/public-api/projectartifactcollections.mdx b/models/ref/python/public-api/projectartifactcollections.mdx index e9aedbe814..ed868af60e 100644 --- a/models/ref/python/public-api/projectartifactcollections.mdx +++ b/models/ref/python/public-api/projectartifactcollections.mdx @@ -7,12 +7,11 @@ namespace: wandb.apis.public.artifacts import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.apis.public.ProjectArtifactCollections - +## Class wandb.apis.public.ProjectArtifactCollections @@ -28,43 +27,3 @@ Artifact collections in a project. -## Methods - -### method RelayPaginator.convert_objects() - -```python -self -``` - -Convert the last fetched response data into the iterated objects. - - - - - -### method Paginator.__next__() - -```python -self -``` - -Return the next item from the iterator. When exhausted, raise StopIteration - - - - - -### method Paginator.update_variables() - -```python -self -``` - -Update the query variables for the next page fetch. - - - - - - - diff --git a/models/ref/python/public-api/projectartifactcollections/projectartifactcollections-methods.mdx b/models/ref/python/public-api/projectartifactcollections/projectartifactcollections-methods.mdx new file mode 100644 index 0000000000..8ec6cb1ff7 --- /dev/null +++ b/models/ref/python/public-api/projectartifactcollections/projectartifactcollections-methods.mdx @@ -0,0 +1,35 @@ +--- +title: ProjectArtifactCollections methods +sidebarTitle: Methods +page_kind: class-methods +parent_slug: projectartifactcollections +kind: class +namespace: wandb.apis.public.artifacts +--- + +## Class wandb.apis.public.ProjectArtifactCollections + +## method RelayPaginator.convert_objects() + +Convert the last fetched response data into the iterated objects. + +```python +self +``` + +## method Paginator.__next__() + +Return the next item from the iterator. When exhausted, raise StopIteration + +```python +self +``` + +## method Paginator.update_variables() + +Update the query variables for the next page fetch. + +```python +self +``` + diff --git a/models/ref/python/public-api/projects.mdx b/models/ref/python/public-api/projects.mdx index 29d68cc1e9..3e9d4f760d 100644 --- a/models/ref/python/public-api/projects.mdx +++ b/models/ref/python/public-api/projects.mdx @@ -7,16 +7,11 @@ namespace: wandb.apis.public.projects import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.apis.public.Projects -```python -service_api: 'ServiceApi', -entity: 'str', -per_page: 'int' = 50 -``` +## Class wandb.apis.public.Projects @@ -26,12 +21,25 @@ An iterable interface to access projects created and saved by the entity. +```python +service_api: 'ServiceApi', +entity: 'str', +per_page: 'int' = 50 +``` + ## Args -- `service_api`: The service API used to query W&B. -- `entity`: The entity which owns the projects. -- `per_page`: The number of projects to fetch per request to the API. + +The service API used to query W&B. + + +The entity which owns the projects. + + + +The number of projects to fetch per request to the API. + @@ -51,45 +59,3 @@ for project in projects: print(f"- Is benchmark: {project.is_benchmark}") ``` - - -## Methods - -### method RelayPaginator.convert_objects() - -```python -self -``` - -Convert the last fetched response data into the iterated objects. - - - - - -### method Paginator.__next__() - -```python -self -``` - -Return the next item from the iterator. When exhausted, raise StopIteration - - - - - -### method Paginator.update_variables() - -```python -self -``` - -Update the query variables for the next page fetch. - - - - - - - diff --git a/models/ref/python/public-api/projects/projects-methods.mdx b/models/ref/python/public-api/projects/projects-methods.mdx new file mode 100644 index 0000000000..3083b1ea33 --- /dev/null +++ b/models/ref/python/public-api/projects/projects-methods.mdx @@ -0,0 +1,35 @@ +--- +title: Projects methods +sidebarTitle: Methods +page_kind: class-methods +parent_slug: projects +kind: class +namespace: wandb.apis.public.projects +--- + +## Class wandb.apis.public.Projects + +## method RelayPaginator.convert_objects() + +Convert the last fetched response data into the iterated objects. + +```python +self +``` + +## method Paginator.__next__() + +Return the next item from the iterator. When exhausted, raise StopIteration + +```python +self +``` + +## method Paginator.update_variables() + +Update the query variables for the next page fetch. + +```python +self +``` + diff --git a/models/ref/python/public-api/registry.mdx b/models/ref/python/public-api/registry.mdx index b479fd49a0..bcf7ae3689 100644 --- a/models/ref/python/public-api/registry.mdx +++ b/models/ref/python/public-api/registry.mdx @@ -7,18 +7,11 @@ namespace: wandb.apis.public.registries.registry import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.apis.public.Registry -```python -(service_api: 'ServiceApi', -organization: 'str', -entity: 'str', -name: 'str', -attrs: 'RegistryFragment | None' = None) -``` +## Class wandb.apis.public.Registry @@ -26,340 +19,35 @@ A single registry in the Registry. -## Args - -- `service_api`: -- `organization`: -- `entity`: -- `name`: -- `attrs`: - - - - - - -## Properties - -### property allow_all_artifact_types - -Return whether all artifact types are allowed in the registry. - -If `True`, artifacts of any type can be added. If `False`, artifacts are -restricted to the types listed in `artifact_types`. - -### property artifact_types - -Returns the artifact types allowed in the registry. - -If `allow_all_artifact_types` is `True` then `artifact_types` reflects the -types previously saved or currently used in the registry. -If `allow_all_artifact_types` is `False` then artifacts are restricted to the -types in `artifact_types`. - -Note: - Previously saved artifact types cannot be removed. - -### property created_at - -Timestamp of when the registry was created. - -### property description - -Description of the registry. - -### property entity - -Organization entity of the registry. - -### property full_name - -Full name of the registry including the `wandb-registry-` prefix. - -### property id - -The unique ID for this registry. - -### property name - -Name of the registry without the `wandb-registry-` prefix. - -### property organization - -Organization name of the registry. - -### property path - - - -### property updated_at - -Timestamp of when the registry was last updated. - -### property visibility - -Visibility of the registry. - - - -## Methods - -### method Registry.add_members() - -```python -self, *members: 'User | UserMember | Team | TeamMember | str' -``` - -Adds users or teams to this registry. - -##### Arguments - -- `members`: The users or teams to add to the registry. Accepts `User` objects, `Team` objects, or their string IDs. - - -##### Raises - -- `TypeError`: If no members are passed as arguments. -- `ValueError`: If unable to infer or parse the user or team IDs. - - -##### Examples - -```python -import wandb - -api = wandb.Api() - -# Fetch an existing registry -registry = api.registry(name="my-registry", organization="my-org") - -user1 = api.user(username="some-user") -user2 = api.user(username="other-user") -registry.add_members(user1, user2) - -my_team = api.team(name="my-team") -registry.add_members(my_team) -``` - -### method Registry.collections() - ```python -self, -filter: 'dict[str, Any] | None' = None, -order: 'str | None' = None, -per_page: 'PositiveInt' = 100, -start: 'str | None' = None -``` - -Returns the collections belonging to this registry. - -##### Arguments - -- `filter`: Optional mapping of filters to apply to the collections query. -- `order`: Optional string to specify the order of the results. If prefixed with '+', sorts ascending (default). If prefixed with '-', sorts descending. -- `per_page`: The number of results to fetch per page. Usually there is no reason to change this. -- `start`: Pagination cursor for resuming a past query, captured from a previous paginator's `.cursor` attribute. - - - - -### method Registry.create() - -```python -api: 'Api', +(service_api: 'ServiceApi', organization: 'str', +entity: 'str', name: 'str', -visibility: "Literal['organization', 'restricted']", -description: 'str | None' = None, -artifact_types: 'list[str] | None' = None -``` - -Create a new registry. - -The registry name must be unique within the organization. -This function should be called using `api.create_registry()` - -##### Arguments - -- `api`: The W&B API instance. -- `organization`: The name of the organization. -- `name`: The name of the registry (without the `wandb-registry-` prefix). -- `visibility`: The visibility level ('organization' or 'restricted'). -- `description`: An optional description for the registry. -- `artifact_types`: An optional list of allowed artifact types. - - -##### Raises - -- `ValueError`: If a registry with the same name already exists in the organization or if the creation fails. - - -### method Registry.delete() - -```python -self -``` - -Delete the registry. This is irreversible. - - - - - -### method Registry.load() - -```python -self -``` - -Load registry attributes from the backend. - - - - - -### method Registry.members() - -```python -self -``` - -Returns the current members (users and teams) of this registry. - - - - - -### method Registry.remove_members() - -```python -self, *members: 'User | UserMember | Team | TeamMember | str' -``` - -Removes users or teams from this registry. - -##### Arguments - -- `members`: The users or teams to remove from the registry. Accepts `User` objects, `Team` objects, or their string IDs. - - -##### Raises - -- `TypeError`: If no members are passed as arguments. -- `ValueError`: If unable to infer or parse the user or team IDs. - - -##### Examples - -```python -import wandb - -api = wandb.Api() - -# Fetch an existing registry -registry = api.registry(name="my-registry", organization="my-org") - -user1 = api.user(username="some-user") -user2 = api.user(username="other-user") -registry.remove_members(user1, user2) - -old_team = api.team(name="old-team") -registry.remove_members(old_team) -``` - -### method Registry.save() - -```python -self -``` - -Save registry attributes to the backend. - - - - - -### method Registry.team_members() - -```python -self -``` - -Returns the current member teams of this registry. - - - - - -### method Registry.update_member() - -```python -self, -member: 'User | UserMember | Team | TeamMember | str', -role: 'MemberRole | str' -``` - -Updates the role of a member (user or team) within this registry. - -##### Arguments - -- `member`: The user or team to update the role of. Accepts a `User` object, `Team` object, or their string ID. -- `role`: The new role to assign to the member. May be one of: - - "admin" - - "member" - - "viewer" - - "restricted_viewer" (if supported by the W&B server) - - -##### Raises - -- `ValueError`: If unable to infer the user or team ID. - - -##### Examples - -Make all users in the registry admins -```python -import wandb - -api = wandb.Api() - -# Fetch an existing registry -registry = api.registry(name="my-registry", organization="my-org") - -for member in registry.user_members(): - registry.update_member(member.user, role="admin") -``` - -### method Registry.user_members() - -```python -self +attrs: 'RegistryFragment | None' = None) ``` -Returns the current member users of this registry. +## Args + + + + -### method Registry.versions() + -```python -self, -filter: 'dict[str, Any] | None' = None, -per_page: 'PositiveInt' = 100, -start: 'str | None' = None -``` + -Returns the artifact versions belonging to this registry. + -##### Arguments + -- `filter`: Optional mapping of filters to apply to the artifact versions query. -- `per_page`: The number of results to fetch per page. Usually there is no reason to change this. -- `start`: Pagination cursor for resuming a past query, captured from a previous paginator's `.cursor` attribute. + + diff --git a/models/ref/python/public-api/registry/registry-methods.mdx b/models/ref/python/public-api/registry/registry-methods.mdx new file mode 100644 index 0000000000..352585ca9d --- /dev/null +++ b/models/ref/python/public-api/registry/registry-methods.mdx @@ -0,0 +1,307 @@ +--- +title: Registry methods +sidebarTitle: Methods +page_kind: class-methods +parent_slug: registry +kind: class +namespace: wandb.apis.public.registries.registry +--- + +## Class wandb.apis.public.Registry + +## method Registry.add_members() + +Adds users or teams to this registry. + +```python +self, *members: 'User | UserMember | Team | TeamMember | str' +``` + +##### Arguments + + +The users or teams to add to the registry. Accepts `User` objects, `Team` objects, or their string IDs. + + +##### Returns + +This registry for further method chaining, if needed. + +##### Raises + + +If no members are passed as arguments. + + + +If unable to infer or parse the user or team IDs. + + +##### Examples + +```python +import wandb + +api = wandb.Api() + +# Fetch an existing registry +registry = api.registry(name="my-registry", organization="my-org") + +user1 = api.user(username="some-user") +user2 = api.user(username="other-user") +registry.add_members(user1, user2) + +my_team = api.team(name="my-team") +registry.add_members(my_team) +``` + +## method Registry.collections() + +Returns the collections belonging to this registry. + +```python +self, +filter: 'dict[str, Any] | None' = None, +order: 'str | None' = None, +per_page: 'PositiveInt' = 100, +start: 'str | None' = None +``` + +##### Arguments + + +Optional mapping of filters to apply to the collections query. + + + +Optional string to specify the order of the results. If prefixed with '+', sorts ascending (default). If prefixed with '-', sorts descending. + + + +The number of results to fetch per page. Usually there is no reason to change this. + + + +Pagination cursor for resuming a past query, captured from a previous paginator's `.cursor` attribute. + + +## method Registry.create() + +Create a new registry. + +The registry name must be unique within the organization. +This function should be called using `api.create_registry()` + +```python +api: 'Api', +organization: 'str', +name: 'str', +visibility: "Literal['organization', 'restricted']", +description: 'str | None' = None, +artifact_types: 'list[str] | None' = None +``` + +##### Arguments + + +The W&B API instance. + + + +The name of the organization. + + + +The name of the registry (without the `wandb-registry-` prefix). + + + +The visibility level ('organization' or 'restricted'). + + + +An optional description for the registry. + + + +An optional list of allowed artifact types. + + +##### Returns + +`Registry`: The newly created Registry object. + +##### Raises + + +If a registry with the same name already exists in the organization or if the creation fails. + + +## method Registry.delete() + +Delete the registry. This is irreversible. + +```python +self +``` + +## method Registry.load() + +Load registry attributes from the backend. + +```python +self +``` + +## method Registry.members() + +Returns the current members (users and teams) of this registry. + +```python +self +``` + +## method Registry.remove_members() + +Removes users or teams from this registry. + +```python +self, *members: 'User | UserMember | Team | TeamMember | str' +``` + +##### Arguments + + +The users or teams to remove from the registry. Accepts `User` objects, `Team` objects, or their string IDs. + + +##### Returns + +This registry for further method chaining, if needed. + +##### Raises + + +If no members are passed as arguments. + + + +If unable to infer or parse the user or team IDs. + + +##### Examples + +```python +import wandb + +api = wandb.Api() + +# Fetch an existing registry +registry = api.registry(name="my-registry", organization="my-org") + +user1 = api.user(username="some-user") +user2 = api.user(username="other-user") +registry.remove_members(user1, user2) + +old_team = api.team(name="old-team") +registry.remove_members(old_team) +``` + +## method Registry.save() + +Save registry attributes to the backend. + +```python +self +``` + +## method Registry.team_members() + +Returns the current member teams of this registry. + +```python +self +``` + +## method Registry.update_member() + +Updates the role of a member (user or team) within this registry. + +```python +self, +member: 'User | UserMember | Team | TeamMember | str', +role: 'MemberRole | str' +``` + +##### Arguments + + +The user or team to update the role of. Accepts a `User` object, `Team` object, or their string ID. + + + +The new role to assign to the member. May be one of: +- "admin" +- "member" +- "viewer" +- "restricted_viewer" (if supported by the W&B server) + + +##### Returns + +This registry for further method chaining, if needed. + +##### Raises + + +If unable to infer the user or team ID. + + +##### Examples + +Make all users in the registry admins +```python +import wandb + +api = wandb.Api() + +# Fetch an existing registry +registry = api.registry(name="my-registry", organization="my-org") + +for member in registry.user_members(): + registry.update_member(member.user, role="admin") +``` + +## method Registry.user_members() + +Returns the current member users of this registry. + +```python +self +``` + +## method Registry.versions() + +Returns the artifact versions belonging to this registry. + +```python +self, +filter: 'dict[str, Any] | None' = None, +per_page: 'PositiveInt' = 100, +start: 'str | None' = None +``` + +##### Arguments + + +Optional mapping of filters to apply to the artifact versions query. + + + +The number of results to fetch per page. Usually there is no reason to change this. + + + +Pagination cursor for resuming a past query, captured from a previous paginator's `.cursor` attribute. + + diff --git a/models/ref/python/public-api/registry/registry-properties.mdx b/models/ref/python/public-api/registry/registry-properties.mdx new file mode 100644 index 0000000000..26ef988ae2 --- /dev/null +++ b/models/ref/python/public-api/registry/registry-properties.mdx @@ -0,0 +1,70 @@ +--- +title: Registry properties +sidebarTitle: Properties +page_kind: class-properties +parent_slug: registry +kind: class +namespace: wandb.apis.public.registries.registry +--- + +## Class wandb.apis.public.Registry + +## property allow_all_artifact_types + +Return whether all artifact types are allowed in the registry. + +If `True`, artifacts of any type can be added. If `False`, artifacts are +restricted to the types listed in `artifact_types`. + +## property artifact_types + +Returns the artifact types allowed in the registry. + +If `allow_all_artifact_types` is `True` then `artifact_types` reflects the +types previously saved or currently used in the registry. +If `allow_all_artifact_types` is `False` then artifacts are restricted to the +types in `artifact_types`. + +Note: + Previously saved artifact types cannot be removed. + +## property created_at + +Timestamp of when the registry was created. + +## property description + +Description of the registry. + +## property entity + +Organization entity of the registry. + +## property full_name + +Full name of the registry including the `wandb-registry-` prefix. + +## property id + +The unique ID for this registry. + +## property name + +Name of the registry without the `wandb-registry-` prefix. + +## property organization + +Organization name of the registry. + +## property path + + + +## property updated_at + +Timestamp of when the registry was last updated. + +## property visibility + +Visibility of the registry. + diff --git a/models/ref/python/public-api/reports.mdx b/models/ref/python/public-api/reports.mdx index 4a7d2f70a5..a483d8d7b2 100644 --- a/models/ref/python/public-api/reports.mdx +++ b/models/ref/python/public-api/reports.mdx @@ -7,18 +7,11 @@ namespace: wandb.apis.public.reports import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.apis.public.Reports -```python -(service_api: 'ServiceApi', -project: 'Project', -name: 'str | None' = None, -entity: 'str | None' = None, -per_page: 'int' = 50) -``` +## Class wandb.apis.public.Reports @@ -26,56 +19,35 @@ Reports is a lazy iterator of `BetaReport` objects. -## Args - -- `service_api`: Interface to the wandb-core service that performs W&B API calls for this collection. -- `project`: The project to fetch reports from. -- `name`: The name of the report to filter by. If `None`, fetches all reports. -- `entity`: The entity name for the project. Defaults to the project entity. -- `per_page`: Number of reports to fetch per page (default is 50). - - - - - - - - -## Methods - -### method Reports.convert_objects() - -```python -self -``` - -Converts GraphQL edges to File objects. - - - - - -### method Paginator.__next__() - ```python -self +(service_api: 'ServiceApi', +project: 'Project', +name: 'str | None' = None, +entity: 'str | None' = None, +per_page: 'int' = 50) ``` -Return the next item from the iterator. When exhausted, raise StopIteration - - - - +## Args -### method Reports.update_variables() + +Interface to the wandb-core service that performs W&B API calls for this collection. + -```python -self -``` + +The project to fetch reports from. + -Updates the GraphQL query variables for pagination. + +The name of the report to filter by. If `None`, fetches all reports. + + +The entity name for the project. Defaults to the project entity. + + +Number of reports to fetch per page (default is 50). + diff --git a/models/ref/python/public-api/reports/reports-methods.mdx b/models/ref/python/public-api/reports/reports-methods.mdx new file mode 100644 index 0000000000..272011f844 --- /dev/null +++ b/models/ref/python/public-api/reports/reports-methods.mdx @@ -0,0 +1,35 @@ +--- +title: Reports methods +sidebarTitle: Methods +page_kind: class-methods +parent_slug: reports +kind: class +namespace: wandb.apis.public.reports +--- + +## Class wandb.apis.public.Reports + +## method Reports.convert_objects() + +Converts GraphQL edges to File objects. + +```python +self +``` + +## method Paginator.__next__() + +Return the next item from the iterator. When exhausted, raise StopIteration + +```python +self +``` + +## method Reports.update_variables() + +Updates the GraphQL query variables for pagination. + +```python +self +``` + diff --git a/models/ref/python/public-api/run.mdx b/models/ref/python/public-api/run.mdx index f465e57fde..702263b2af 100644 --- a/models/ref/python/public-api/run.mdx +++ b/models/ref/python/public-api/run.mdx @@ -7,11 +7,18 @@ namespace: wandb.apis.public.runs import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + + + + +## Class wandb.apis.public.Run + + + +A single run associated with an entity and project. -## class wandb.apis.public.Run ```python (service_api: 'ServiceApi', entity: 'str', @@ -23,23 +30,39 @@ lazy: 'bool' = True, api_key: 'str | None' = None) ``` +## Args + +Interface to the wandb-core service that performs W&B API calls for this run. + -A single run associated with an entity and project. + +The entity associated with the run. + + +The project associated with the run. + + +The unique identifier for the run. + -## Args + +The attributes of the run. + + + +Whether to include sweeps in the run. + + + + + -- `service_api`: Interface to the wandb-core service that performs W&B API calls for this run. -- `entity`: The entity associated with the run. -- `project`: The project associated with the run. -- `run_id`: The unique identifier for the run. -- `attrs`: The attributes of the run. -- `include_sweeps`: Whether to include sweeps in the run. -- `lazy`: -- `api_key`: + + ## Attributes @@ -64,590 +87,3 @@ A single run associated with an entity and project. - -## Properties - -### property config - -Get run config. Auto-loads full data if in lazy mode. - -### property entity - -The entity associated with the run. - -### property id - -The unique identifier for the run. - -### property lastHistoryStep - -Returns the last step logged in the run's history. - -### property metadata - -Metadata about the run from wandb-metadata.json. - -Metadata includes the run's description, tags, start time, memory -usage and more. - -### property name - -The name of the run. - -### property path - -The path of the run. The path is a list containing the entity, project, and run_id. - -### property rawconfig - -Get raw run config including internal keys. Auto-loads full data if in lazy mode. - -### property state - -The state of the run. - -The following table describes the possible states a run can be in: - -| State | Description | -| -------- | ----------- | -| Crashed | Run stopped sending heartbeats in the internal process, which can happen if the machine crashes. | -| Failed | Run ended with a non-zero exit status. | -| Finished | Run ended and fully synced data, or called `wandb.Run.finish()`. | -| Killed | Run was forcibly stopped before it could finish. | -| Running | Run is still running and has recently sent a heartbeat. | -| Pending | Run is scheduled but not yet started (common in sweeps and Launch jobs). | - -### property storage_id - -The unique storage identifier for the run. - -### property summary - -Get run summary metrics. Auto-loads full data if in lazy mode. - -### property summary_metrics - -Get run summary metrics. Auto-loads full data if in lazy mode. - -### property sweep - -The sweep associated with this run. Loads sweep data if include_sweeps is False. - -### property sweep_name - -Get sweep name. Always available since sweepName is in lightweight fragment. - -### property system_metrics - -Get run system metrics. Auto-loads full data if in lazy mode. - -### property url - -The URL of the run. - -The run URL is generated from the entity, project, and run_id. For -SaaS users, it takes the form of `https://wandb.ai/entity/project/run_id`. - -### property username - -This API is deprecated. Use `entity` instead. - - - -## Methods - -### method Run.beta_scan_history() - -```python -self, -keys: 'list[str] | None' = None, -page_size: 'int' = 1000, -min_step: 'int' = 0, -max_step: 'int | None' = None, -use_cache: 'bool' = True -``` - - - -##### Arguments - -- `keys`: -- `page_size`: -- `min_step`: -- `max_step`: -- `use_cache`: - - - - -### method Run.create() - -```python -api: 'public.Api', -run_id: 'str | None' = None, -project: 'str | None' = None, -entity: 'str | None' = None, -state: "Literal['running', 'pending']" = 'running' -``` - -Create a run for the given project. - -For most use cases, use `wandb.init()`. `wandb.init()` provides more robust -logic for creating and updating runs. `wandb.apis.public.Run.create` -is intended for specific scenarios such as creating runs in -a "pending" state for jobs that may be unschedulable -(for example, in a Kubernetes cluster with insufficient GPUs or high -contention). These pending runs can later be resumed and tracked by W&B. - -Runs created with this method have limited functionality. Calling -`update()` on a run created this way may not work as expected. - -##### Arguments - -- `api`: The W&B API instance. -- `run_id`: Optional run ID. If not provided, a random ID will be generated. -- `project`: Optional project name. Defaults to the project in API settings or "uncategorized". -- `entity`: Optional entity (user or team) name. -- `state`: Initial state of the run. Use "pending" for runs that will be resumed later, or "running" for immediate execution. - - - - -##### Examples - -Creating a pending run for later execution - -```python -import wandb - -api = wandb.Api() - -run_name = "my-pending-run" - -run = Run.create( - api=api, - project="project", - entity="entity", - state="pending", - run_id=run_name, -) -``` - -### method Run.delete() - -```python -self, -delete_artifacts: 'bool' = False -``` - -Delete the given run from the wandb backend. - -##### Arguments - -- `delete_artifacts`: Whether to delete the artifacts associated with the run. - - - - -### method Run.download_history_exports() - -```python -self, -download_dir: 'pathlib.Path | str', -require_complete_history: 'bool' = True -``` - -Download any parquet history files for the run to the provided directory. - -##### Arguments - -- `download_dir`: The directory to download the history files to. -- `require_complete_history`: Whether to require the complete history to be downloaded. If true, and the run contains data that has not been exported to parquet files yet, an IncompleteRunHistoryError will be raised. - - -##### Raises - -- `IncompleteRunHistoryError`: If require_complete_history is True and the run contains data not yet exported to parquet files. -- `WandbApiFailedError`: If the API request fails for reasons other than incomplete history. - - -### method Run.file() - -```python -self, -name: 'str' -``` - -Return the path of a file with a given name in the artifact. - -##### Arguments - -- `name`: name of requested file. - - - - -### method Run.files() - -```python -self, -names: 'list[str] | None' = None, -pattern: 'str | None' = None, -per_page: 'int' = 50 -``` - -Returns a `Files` object for all files in the run which match the given criteria. - -You can specify a list of exact file names to match, or a pattern to match against. -If both are provided, the pattern will be ignored. - -##### Arguments - -- `names`: names of the requested files, if empty returns all files -- `pattern`: Pattern to match when returning files from W&B. This pattern uses mySQL's LIKE syntax, so matching all files that end with .json would be "%.json". If both names and pattern are provided, a ValueError will be raised. -- `per_page`: number of results per page. - - - - -### method Run.history() - -```python -self, -samples: 'int' = 500, -keys: 'list[str] | None' = None, -x_axis: 'str' = '_step', -pandas: 'bool' = True, -stream: "Literal['default', 'system']" = 'default' -``` - -Return sampled history metrics for a run. - -This is simpler and faster if you are ok with the history records being sampled. - -##### Arguments - -- `samples`: (int, optional) The number of samples to return -- `keys`: (list, optional) Only return metrics for specific keys -- `x_axis`: (str, optional) Use this metric as the xAxis defaults to _step -- `pandas`: (bool, optional) Return a pandas dataframe -- `stream`: (str, optional) "default" for metrics, "system" for machine metrics - - - - -### method Run.load() - -```python -self, -force: 'bool' = False -``` - -Load run data using appropriate fragment based on lazy mode. - -##### Arguments - -- `force`: If True, re-fetch the run data from the server, even if it is already loaded. - - -##### Raises - -- `RunNotFoundError`: If the run is not found, or the run data can not be loaded. - - -### method Run.load_full_data() - -```python -self, -force: 'bool' = False -``` - -Load full run data including heavy fields like config, systemMetrics, summaryMetrics. - -This method is useful when you initially used lazy=True for listing runs, -but need access to the full data for specific runs. - -##### Arguments - -- `force`: Force reload even if data is already loaded - - - - -### method Run.log_artifact() - -```python -self, -artifact: 'wandb.Artifact', -aliases: 'Collection[str] | None' = None, -tags: 'Collection[str] | None' = None -``` - -Declare an artifact as output of a run. - -##### Arguments - -- `artifact`: An artifact returned from `wandb.Api().artifact(name)`. -- `aliases`: Aliases to apply to this artifact. -- `tags`: (list, optional) Tags to apply to this artifact, if any. - - - - -### method Run.logged_artifacts() - -```python -self, -per_page: 'int' = 100 -``` - -Fetches all artifacts logged by this run. - -Retrieves all output artifacts that were logged during the run. Returns a -paginated result that can be iterated over or collected into a single list. - -##### Arguments - -- `per_page`: Number of artifacts to fetch per API request. - - - - -##### Examples - -```python -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) -``` - -### method Run.save() - -```python -self -``` - -Persist changes to the run object to the W&B backend. - - - - - -### method Run.scan_history() - -```python -self, -keys: 'list[str] | None' = None, -page_size: 'int' = 1000, -min_step: 'int' = 0, -max_step: 'int | None' = None, -use_cache: 'bool' = True -``` - -Returns an iterable collection of all history records for a run. - -##### Arguments - -- `keys`: list of metrics to read from the run's history. if no keys are provided then all metrics will be returned. -- `page_size`: the number of history records to read at a time. -- `min_step`: The minimum step to start reading history from (inclusive). -- `max_step`: The maximum step to read history up to (exclusive). -- `use_cache`: When set to True, checks the WANDB_CACHE_DIR for a run history. If the run history is not found in the cache, it will be downloaded from the server. If set to False, the run history will be downloaded every time. - - - - -### method Run.stop() - -```python -self -``` - -Request that this run stop gracefully. - -This sets the run's stop flag on the W&B backend, the same signal -sent by the "Stop run" button in the W&B App UI. The process running -the run picks the flag up through its regular heartbeat and shuts -the run down gracefully, so this is safe for terminating remote runs -(for example, runs on Kubernetes pods). - -Stopping is asynchronous: this method returns once the backend has -flagged the run, not once the run terminates. Calling it again, or -on a run that is no longer running, has no effect. - - - -##### Raises - -- ``wandb.Error``: If the request fails. - - -##### Examples - -```python -import wandb - -run = wandb.Api().run("entity/project/run_id") -run.stop() -``` - -### method Run.to_html() - -```python -self, -height: 'int' = 420, -hidden: 'bool' = False -``` - -Generate HTML containing an iframe displaying this run. - -##### Arguments - -- `height`: -- `hidden`: - - - - -### method Run.update() - -```python -self -``` - -Persist changes to the run object to the wandb backend. - - - - - -### method Run.update_state() - -```python -self, -state: 'str' -``` - -Update the state of a run. - -Supported transitions: - - to `pending` from `running`, `failed`, `crashed`, or `preempted` - (e.g. to requeue a terminated or in-progress run) - - to `failed` from `pending` or `running` - (e.g. to mark a preempted or lost run as failed) - -Sweep runs cannot have their state updated. - -See `Run.state` for the list of possible run states. - -##### Arguments - -- `state`: The target run state. One of `"pending"` or `"failed"`. - - -##### Raises - -- ``wandb.Error``: If the requested state transition is not allowed, or the server does not support this operation. - - -### method Run.upload_file() - -```python -self, -path: 'str', -root: 'str' = '.' -``` - -Upload a local file to W&B, associating it with this run. - -##### Arguments - -- `path`: Path to the file to upload. Can be absolute or relative. -- `root`: The root path to save the file relative to. For example, if you want to have the file saved in the run as "my_dir/file.txt" and you're currently in "my_dir" you would set root to "../". Defaults to current directory ("."). - - - - -### method Run.use_artifact() - -```python -self, -artifact: 'wandb.Artifact', -use_as: 'str | None' = None -``` - -Declare an artifact as an input to a run. - -##### Arguments - -- `artifact`: An artifact returned from `wandb.Api().artifact(name)` -- `use_as`: A string identifying how the artifact is used in the script. Used to easily differentiate artifacts used in a run, when using the beta wandb launch feature's artifact swapping functionality. - - - - -### method Run.used_artifacts() - -```python -self, -per_page: 'int' = 100 -``` - -Fetches artifacts explicitly used by this run. - -Retrieves only the input artifacts that were explicitly declared as used -during the run, typically via `run.use_artifact()`. Returns a paginated -result that can be iterated over or collected into a single list. - -##### Arguments - -- `per_page`: Number of artifacts to fetch per API request. - - - - -##### Examples - -```python -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 -``` - -### method Run.wait_until_finished() - -```python -self -``` - -Check the state of the run until it is finished. - - - - - - - diff --git a/models/ref/python/public-api/run/run-methods.mdx b/models/ref/python/public-api/run/run-methods.mdx new file mode 100644 index 0000000000..57fb9a6076 --- /dev/null +++ b/models/ref/python/public-api/run/run-methods.mdx @@ -0,0 +1,612 @@ +--- +title: Run methods +sidebarTitle: Methods +page_kind: class-methods +parent_slug: run +kind: class +namespace: wandb.apis.public.runs +--- + +## Class wandb.apis.public.Run + +## method Run.beta_scan_history() + +```python +self, +keys: 'list[str] | None' = None, +page_size: 'int' = 1000, +min_step: 'int' = 0, +max_step: 'int | None' = None, +use_cache: 'bool' = True +``` + +##### Arguments + + + + + + + + + + + + + + + + + + + + + +## method Run.create() + +Create a run for the given project. + +For most use cases, use `wandb.init()`. `wandb.init()` provides more robust +logic for creating and updating runs. `wandb.apis.public.Run.create` +is intended for specific scenarios such as creating runs in +a "pending" state for jobs that may be unschedulable +(for example, in a Kubernetes cluster with insufficient GPUs or high +contention). These pending runs can later be resumed and tracked by W&B. + +Runs created with this method have limited functionality. Calling +`update()` on a run created this way may not work as expected. + +```python +api: 'public.Api', +run_id: 'str | None' = None, +project: 'str | None' = None, +entity: 'str | None' = None, +state: "Literal['running', 'pending']" = 'running' +``` + +##### Arguments + + +The W&B API instance. + + + +Optional run ID. If not provided, a random ID will be generated. + + + +Optional project name. Defaults to the project in API settings or "uncategorized". + + + +Optional entity (user or team) name. + + + +Initial state of the run. Use "pending" for runs that will be resumed later, or "running" for immediate execution. + + +##### Returns + +A Run object representing the created run. + +##### Examples + +Creating a pending run for later execution + +```python +import wandb + +api = wandb.Api() + +run_name = "my-pending-run" + +run = Run.create( + api=api, + project="project", + entity="entity", + state="pending", + run_id=run_name, +) +``` + +## method Run.delete() + +Delete the given run from the wandb backend. + +```python +self, +delete_artifacts: 'bool' = False +``` + +##### Arguments + + +Whether to delete the artifacts associated with the run. + + +## method Run.download_history_exports() + +Download any parquet history files for the run to the provided directory. + +```python +self, +download_dir: 'pathlib.Path | str', +require_complete_history: 'bool' = True +``` + +##### Arguments + + +The directory to download the history files to. + + + +Whether to require the complete history to be downloaded. If true, and the run contains data that has not been exported to parquet files yet, an IncompleteRunHistoryError will be raised. + + +##### Returns + +A DownloadHistoryResult. + +##### Raises + + +If require_complete_history is True and the run contains data not yet exported to parquet files. + + + +If the API request fails for reasons other than incomplete history. + + +## method Run.file() + +Return the path of a file with a given name in the artifact. + +```python +self, +name: 'str' +``` + +##### Arguments + + +name of requested file. + + +##### Returns + +A `File` matching the name argument. + +## method Run.files() + +Returns a `Files` object for all files in the run which match the given criteria. + +You can specify a list of exact file names to match, or a pattern to match against. +If both are provided, the pattern will be ignored. + +```python +self, +names: 'list[str] | None' = None, +pattern: 'str | None' = None, +per_page: 'int' = 50 +``` + +##### Arguments + + +names of the requested files, if empty returns all files + + + +Pattern to match when returning files from W&B. This pattern uses mySQL's LIKE syntax, so matching all files that end with .json would be "%.json". If both names and pattern are provided, a ValueError will be raised. + + + +number of results per page. + + +##### Returns + +A `Files` object, which is an iterator over `File` objects. + +## method Run.history() + +Return sampled history metrics for a run. + +This is simpler and faster if you are ok with the history records being sampled. + +```python +self, +samples: 'int' = 500, +keys: 'list[str] | None' = None, +x_axis: 'str' = '_step', +pandas: 'bool' = True, +stream: "Literal['default', 'system']" = 'default' +``` + +##### Arguments + + +(int, optional) The number of samples to return + + + +(list, optional) Only return metrics for specific keys + + + +(str, optional) Use this metric as the xAxis defaults to _step + + + +(bool, optional) Return a pandas dataframe + + + +(str, optional) "default" for metrics, "system" for machine metrics + + +##### Returns + +`pandas.DataFrame`: If pandas=True returns a `pandas.DataFrame` of history metrics. + +## method Run.load() + +Load run data using appropriate fragment based on lazy mode. + +```python +self, +force: 'bool' = False +``` + +##### Arguments + + +If True, re-fetch the run data from the server, even if it is already loaded. + + +##### Returns + +A dictionary of the run data. + +##### Raises + + +If the run is not found, or the run data can not be loaded. + + +## method Run.load_full_data() + +Load full run data including heavy fields like config, systemMetrics, summaryMetrics. + +This method is useful when you initially used lazy=True for listing runs, +but need access to the full data for specific runs. + +```python +self, +force: 'bool' = False +``` + +##### Arguments + + +Force reload even if data is already loaded + + +##### Returns + +The loaded run attributes + +## method Run.log_artifact() + +Declare an artifact as output of a run. + +```python +self, +artifact: 'wandb.Artifact', +aliases: 'Collection[str] | None' = None, +tags: 'Collection[str] | None' = None +``` + +##### Arguments + + +An artifact returned from `wandb.Api().artifact(name)`. + + + +Aliases to apply to this artifact. + + + +(list, optional) Tags to apply to this artifact, if any. + + +##### Returns + +A `Artifact` object. + +## method Run.logged_artifacts() + +Fetches all artifacts logged by this run. + +Retrieves all output artifacts that were logged during the run. Returns a +paginated result that can be iterated over or collected into a single list. + +```python +self, +per_page: 'int' = 100 +``` + +##### Arguments + + +Number of artifacts to fetch per API request. + + +##### Returns + +An iterable collection of all Artifact objects logged as outputs during this run. + +##### Examples + +```python +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) +``` + +## method Run.save() + +Persist changes to the run object to the W&B backend. + +```python +self +``` + +## method Run.scan_history() + +Returns an iterable collection of all history records for a run. + +```python +self, +keys: 'list[str] | None' = None, +page_size: 'int' = 1000, +min_step: 'int' = 0, +max_step: 'int | None' = None, +use_cache: 'bool' = True +``` + +##### Arguments + + +list of metrics to read from the run's history. if no keys are provided then all metrics will be returned. + + + +the number of history records to read at a time. + + + +The minimum step to start reading history from (inclusive). + + + +The maximum step to read history up to (exclusive). + + + +When set to True, checks the WANDB_CACHE_DIR for a run history. If the run history is not found in the cache, it will be downloaded from the server. If set to False, the run history will be downloaded every time. + + +##### Returns + +A HistoryScan object, which can be iterator over to get history records. + +## method Run.stop() + +Request that this run stop gracefully. + +This sets the run's stop flag on the W&B backend, the same signal +sent by the "Stop run" button in the W&B App UI. The process running +the run picks the flag up through its regular heartbeat and shuts +the run down gracefully, so this is safe for terminating remote runs +(for example, runs on Kubernetes pods). + +Stopping is asynchronous: this method returns once the backend has +flagged the run, not once the run terminates. Calling it again, or +on a run that is no longer running, has no effect. + +```python +self +``` + +##### Raises + + +If the request fails. + + +##### Examples + +```python +import wandb + +run = wandb.Api().run("entity/project/run_id") +run.stop() +``` + +## method Run.to_html() + +Generate HTML containing an iframe displaying this run. + +```python +self, +height: 'int' = 420, +hidden: 'bool' = False +``` + +##### Arguments + + + + + + + + + +## method Run.update() + +Persist changes to the run object to the wandb backend. + +```python +self +``` + +## method Run.update_state() + +Update the state of a run. + +Supported transitions: + - to `pending` from `running`, `failed`, `crashed`, or `preempted` + (e.g. to requeue a terminated or in-progress run) + - to `failed` from `pending` or `running` + (e.g. to mark a preempted or lost run as failed) + +Sweep runs cannot have their state updated. + +See `Run.state` for the list of possible run states. + +```python +self, +state: 'str' +``` + +##### Arguments + + +The target run state. One of `"pending"` or `"failed"`. + + +##### Returns + +`True` if the state was successfully updated. + +##### Raises + + +If the requested state transition is not allowed, or the server does not support this operation. + + +## method Run.upload_file() + +Upload a local file to W&B, associating it with this run. + +```python +self, +path: 'str', +root: 'str' = '.' +``` + +##### Arguments + + +Path to the file to upload. Can be absolute or relative. + + + +The root path to save the file relative to. For example, if you want to have the file saved in the run as "my_dir/file.txt" and you're currently in "my_dir" you would set root to "../". Defaults to current directory ("."). + + +##### Returns + +A `File` object representing the uploaded file. + +## method Run.use_artifact() + +Declare an artifact as an input to a run. + +```python +self, +artifact: 'wandb.Artifact', +use_as: 'str | None' = None +``` + +##### Arguments + + +An artifact returned from `wandb.Api().artifact(name)` + + + +A string identifying how the artifact is used in the script. Used to easily differentiate artifacts used in a run, when using the beta wandb launch feature's artifact swapping functionality. + + +##### Returns + +An `Artifact` object. + +## method Run.used_artifacts() + +Fetches artifacts explicitly used by this run. + +Retrieves only the input artifacts that were explicitly declared as used +during the run, typically via `run.use_artifact()`. Returns a paginated +result that can be iterated over or collected into a single list. + +```python +self, +per_page: 'int' = 100 +``` + +##### Arguments + + +Number of artifacts to fetch per API request. + + +##### Returns + +An iterable collection of Artifact objects explicitly used as inputs in this run. + +##### Examples + +```python +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 +``` + +## method Run.wait_until_finished() + +Check the state of the run until it is finished. + +```python +self +``` + diff --git a/models/ref/python/public-api/run/run-properties.mdx b/models/ref/python/public-api/run/run-properties.mdx new file mode 100644 index 0000000000..1bec1bdda0 --- /dev/null +++ b/models/ref/python/public-api/run/run-properties.mdx @@ -0,0 +1,96 @@ +--- +title: Run properties +sidebarTitle: Properties +page_kind: class-properties +parent_slug: run +kind: class +namespace: wandb.apis.public.runs +--- + +## Class wandb.apis.public.Run + +## property config + +Get run config. Auto-loads full data if in lazy mode. + +## property entity + +The entity associated with the run. + +## property id + +The unique identifier for the run. + +## property lastHistoryStep + +Returns the last step logged in the run's history. + +## property metadata + +Metadata about the run from wandb-metadata.json. + +Metadata includes the run's description, tags, start time, memory +usage and more. + +## property name + +The name of the run. + +## property path + +The path of the run. The path is a list containing the entity, project, and run_id. + +## property rawconfig + +Get raw run config including internal keys. Auto-loads full data if in lazy mode. + +## property state + +The state of the run. + +The following table describes the possible states a run can be in: + +| State | Description | +| -------- | ----------- | +| Crashed | Run stopped sending heartbeats in the internal process, which can happen if the machine crashes. | +| Failed | Run ended with a non-zero exit status. | +| Finished | Run ended and fully synced data, or called `wandb.Run.finish()`. | +| Killed | Run was forcibly stopped before it could finish. | +| Running | Run is still running and has recently sent a heartbeat. | +| Pending | Run is scheduled but not yet started (common in sweeps and Launch jobs). | + +## property storage_id + +The unique storage identifier for the run. + +## property summary + +Get run summary metrics. Auto-loads full data if in lazy mode. + +## property summary_metrics + +Get run summary metrics. Auto-loads full data if in lazy mode. + +## property sweep + +The sweep associated with this run. Loads sweep data if include_sweeps is False. + +## property sweep_name + +Get sweep name. Always available since sweepName is in lightweight fragment. + +## property system_metrics + +Get run system metrics. Auto-loads full data if in lazy mode. + +## property url + +The URL of the run. + +The run URL is generated from the entity, project, and run_id. For +SaaS users, it takes the form of `https://wandb.ai/entity/project/run_id`. + +## property username + +This API is deprecated. Use `entity` instead. + diff --git a/models/ref/python/public-api/runartifacts.mdx b/models/ref/python/public-api/runartifacts.mdx index 132a7ebea8..182fbdcb77 100644 --- a/models/ref/python/public-api/runartifacts.mdx +++ b/models/ref/python/public-api/runartifacts.mdx @@ -7,12 +7,11 @@ namespace: wandb.apis.public.artifacts import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.apis.public.RunArtifacts - +## Class wandb.apis.public.RunArtifacts @@ -28,43 +27,3 @@ An iterable collection of artifacts associated with a specific run. -## Methods - -### method RelayPaginator.convert_objects() - -```python -self -``` - -Convert the last fetched response data into the iterated objects. - - - - - -### method Paginator.__next__() - -```python -self -``` - -Return the next item from the iterator. When exhausted, raise StopIteration - - - - - -### method Paginator.update_variables() - -```python -self -``` - -Update the query variables for the next page fetch. - - - - - - - diff --git a/models/ref/python/public-api/runartifacts/runartifacts-methods.mdx b/models/ref/python/public-api/runartifacts/runartifacts-methods.mdx new file mode 100644 index 0000000000..a33737974a --- /dev/null +++ b/models/ref/python/public-api/runartifacts/runartifacts-methods.mdx @@ -0,0 +1,35 @@ +--- +title: RunArtifacts methods +sidebarTitle: Methods +page_kind: class-methods +parent_slug: runartifacts +kind: class +namespace: wandb.apis.public.artifacts +--- + +## Class wandb.apis.public.RunArtifacts + +## method RelayPaginator.convert_objects() + +Convert the last fetched response data into the iterated objects. + +```python +self +``` + +## method Paginator.__next__() + +Return the next item from the iterator. When exhausted, raise StopIteration + +```python +self +``` + +## method Paginator.update_variables() + +Update the query variables for the next page fetch. + +```python +self +``` + diff --git a/models/ref/python/public-api/runs.mdx b/models/ref/python/public-api/runs.mdx index b551ca5016..5649978e8c 100644 --- a/models/ref/python/public-api/runs.mdx +++ b/models/ref/python/public-api/runs.mdx @@ -7,22 +7,11 @@ namespace: wandb.apis.public.runs import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.apis.public.Runs -```python -(service_api: 'ServiceApi', -entity: 'str', -project: 'str', -filters: 'dict[str, Any] | None' = None, -order: 'str' = '+created_at', -per_page: 'int' = 50, -include_sweeps: 'bool' = False, -lazy: 'bool' = True, -api_key: 'str | None' = None) -``` +## Class wandb.apis.public.Runs @@ -34,88 +23,55 @@ This is generally used indirectly using the `Api.runs` namespace. -## Args - -- `service_api`: The service API to use for requests. -- `entity`: The entity (username or team) that owns the project. -- `project`: The name of the project to fetch runs from. -- `filters`: Filters to apply to the runs query. -- `order`: Order can be `created_at`, `heartbeat_at`, `config.*.value`, or `summary_metrics.*`. If you prepend order with a + order is ascending (default). If you prepend order with a - order is descending. The default order is run.created_at from oldest to newest. -- `per_page`: The number of runs to fetch per request (default is 50). -- `include_sweeps`: Whether to include sweep information in the runs. Defaults to True. -- `lazy`: Whether to defer loading heavy fields (config, summaryMetrics, systemMetrics) until they are accessed. Defaults to True. -- `api_key`: - - - - - - - - -## Methods - -### method Runs.histories() - -```python -self, -samples: 'int' = 500, -keys: 'list[str] | None' = None, -x_axis: 'str' = '_step', -format: "Literal['default', 'pandas', 'polars']" = 'default', -stream: "Literal['default', 'system']" = 'default' -``` - -Return sampled history metrics for all runs that fit the filters conditions. - -##### Arguments - -- `samples`: The number of samples to return per run -- `keys`: Only return metrics for specific keys -- `x_axis`: Use this metric as the xAxis defaults to _step -- `format`: Format to return data in, options are "default", "pandas", "polars" -- `stream`: "default" for metrics, "system" for machine metrics - - - - -### method Paginator.__next__() - ```python -self -``` - -Return the next item from the iterator. When exhausted, raise StopIteration - - - - - -### method Paginator.update_variables() - -```python -self +(service_api: 'ServiceApi', +entity: 'str', +project: 'str', +filters: 'dict[str, Any] | None' = None, +order: 'str' = '+created_at', +per_page: 'int' = 50, +include_sweeps: 'bool' = False, +lazy: 'bool' = True, +api_key: 'str | None' = None) ``` -Update the query variables for the next page fetch. +## Args + +The service API to use for requests. + + +The entity (username or team) that owns the project. + + +The name of the project to fetch runs from. + + +Filters to apply to the runs query. + -### method Runs.upgrade_to_full() + +Order can be `created_at`, `heartbeat_at`, `config.*.value`, or `summary_metrics.*`. If you prepend order with a + order is ascending (default). If you prepend order with a - order is descending. The default order is run.created_at from oldest to newest. + -```python -self -``` + +The number of runs to fetch per request (default is 50). + -Upgrade this Runs collection from lazy to full mode. + +Whether to include sweep information in the runs. Defaults to True. + -This switches to fetching full run data and -upgrades any already-loaded Run objects to have full data. -Uses parallel loading for better performance when upgrading multiple runs. + +Whether to defer loading heavy fields (config, summaryMetrics, systemMetrics) until they are accessed. Defaults to True. + + + diff --git a/models/ref/python/public-api/runs/runs-methods.mdx b/models/ref/python/public-api/runs/runs-methods.mdx new file mode 100644 index 0000000000..4314db9e8e --- /dev/null +++ b/models/ref/python/public-api/runs/runs-methods.mdx @@ -0,0 +1,78 @@ +--- +title: Runs methods +sidebarTitle: Methods +page_kind: class-methods +parent_slug: runs +kind: class +namespace: wandb.apis.public.runs +--- + +## Class wandb.apis.public.Runs + +## method Runs.histories() + +Return sampled history metrics for all runs that fit the filters conditions. + +```python +self, +samples: 'int' = 500, +keys: 'list[str] | None' = None, +x_axis: 'str' = '_step', +format: "Literal['default', 'pandas', 'polars']" = 'default', +stream: "Literal['default', 'system']" = 'default' +``` + +##### Arguments + + +The number of samples to return per run + + + +Only return metrics for specific keys + + + +Use this metric as the xAxis defaults to _step + + + +Format to return data in, options are "default", "pandas", "polars" + + + +"default" for metrics, "system" for machine metrics + + +##### Returns + +`pandas.DataFrame`: If `format="pandas"`, returns a `pandas.DataFrame` of history metrics. + +## method Paginator.__next__() + +Return the next item from the iterator. When exhausted, raise StopIteration + +```python +self +``` + +## method Paginator.update_variables() + +Update the query variables for the next page fetch. + +```python +self +``` + +## method Runs.upgrade_to_full() + +Upgrade this Runs collection from lazy to full mode. + +This switches to fetching full run data and +upgrades any already-loaded Run objects to have full data. +Uses parallel loading for better performance when upgrading multiple runs. + +```python +self +``` + diff --git a/models/ref/python/public-api/sweep.mdx b/models/ref/python/public-api/sweep.mdx index 6efca4956c..1e67b2aa85 100644 --- a/models/ref/python/public-api/sweep.mdx +++ b/models/ref/python/public-api/sweep.mdx @@ -7,11 +7,18 @@ namespace: wandb.apis.public.sweeps import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + + + + +## Class wandb.apis.public.Sweep + + + +The set of runs associated with the sweep. -## class wandb.apis.public.Sweep ```python (service_api: 'ServiceApi', entity: 'str', @@ -20,20 +27,27 @@ sweep_id: 'str', attrs: 'Mapping[str, Any] | None' = None) ``` +## Args + -The set of runs associated with the sweep. + + + -## Args + + + + + -- `service_api`: -- `entity`: -- `project`: -- `sweep_id`: -- `attrs`: + + + + ## Attributes @@ -46,144 +60,3 @@ The set of runs associated with the sweep. - -## Properties - -### property config - -The sweep configuration used for the sweep. - -### property entity - -The entity associated with the sweep. - -### property expected_run_count - -Return the number of expected runs in the sweep or None for infinite runs. - -### property name - -The name of the sweep. - -Returns the first name that exists in the following priority order: - -1. User-edited display name -2. Name configured at creation time -3. Sweep ID - -### property order - -Return the order key for the sweep. - -### property path - -Returns the path of the project. - -The path is a list containing the entity, project name, and sweep ID. - -### property url - -The URL of the sweep. - -The sweep URL is generated from the entity, project, the term -"sweeps", and the sweep ID.run_id. For -SaaS users, it takes the form -of `https://wandb.ai/entity/project/sweeps/sweeps_ID`. - -### property username - -Deprecated. Use `Sweep.entity` instead. - - - -## Methods - -### method Sweep.agent() - -```python -self, -agent_id: 'str' -``` - -Query an agent by ID for this sweep. - -##### Arguments - -- `agent_id`: The ID of the agent to look up. - - - - -### method Sweep.agents() - -```python -self -``` - -Query the list of all agents for this sweep. - - - - - -### method Sweep.best_run() - -```python -(self, order=None) -``` - -Return the best run sorted by the metric defined in config or the order passed in. - -##### Arguments - -- `order`: - - - - -### method Sweep.get() - -```python -(api: 'Api', -entity: 'str | None' = None, -project: 'str | None' = None, -sid: 'str | None' = None, -order: 'str | None' = None, -query: 'str | None' = None, **kwargs) -``` - -Execute a query against the cloud backend. - -##### Arguments - -- `api`: The W&B API instance. -- `entity`: The entity (username or team) that owns the project. -- `project`: The name of the project to fetch sweep from. -- `sid`: The sweep ID to query. -- `order`: The order in which the sweep's runs are returned. -- `query`: The query to use to execute the query. -- `kwargs`: - - - - -### method Sweep.to_html() - -```python -self, -height: 'int' = 420, -hidden: 'bool' = False -``` - -Generate HTML containing an iframe displaying this sweep. - -##### Arguments - -- `height`: -- `hidden`: - - - - - - diff --git a/models/ref/python/public-api/sweep/sweep-methods.mdx b/models/ref/python/public-api/sweep/sweep-methods.mdx new file mode 100644 index 0000000000..b1db51d664 --- /dev/null +++ b/models/ref/python/public-api/sweep/sweep-methods.mdx @@ -0,0 +1,111 @@ +--- +title: Sweep methods +sidebarTitle: Methods +page_kind: class-methods +parent_slug: sweep +kind: class +namespace: wandb.apis.public.sweeps +--- + +## Class wandb.apis.public.Sweep + +## method Sweep.agent() + +Query an agent by ID for this sweep. + +```python +self, +agent_id: 'str' +``` + +##### Arguments + + +The ID of the agent to look up. + + +## method Sweep.agents() + +Query the list of all agents for this sweep. + +```python +self +``` + +## method Sweep.best_run() + +Return the best run sorted by the metric defined in config or the order passed in. + +```python +(self, order=None) +``` + +##### Arguments + + + + + +## method Sweep.get() + +Execute a query against the cloud backend. + +```python +(api: 'Api', +entity: 'str | None' = None, +project: 'str | None' = None, +sid: 'str | None' = None, +order: 'str | None' = None, +query: 'str | None' = None, **kwargs) +``` + +##### Arguments + + +The W&B API instance. + + + +The entity (username or team) that owns the project. + + + +The name of the project to fetch sweep from. + + + +The sweep ID to query. + + + +The order in which the sweep's runs are returned. + + + +The query to use to execute the query. + + + + + + +## method Sweep.to_html() + +Generate HTML containing an iframe displaying this sweep. + +```python +self, +height: 'int' = 420, +hidden: 'bool' = False +``` + +##### Arguments + + + + + + + + + diff --git a/models/ref/python/public-api/sweep/sweep-properties.mdx b/models/ref/python/public-api/sweep/sweep-properties.mdx new file mode 100644 index 0000000000..fe976312a8 --- /dev/null +++ b/models/ref/python/public-api/sweep/sweep-properties.mdx @@ -0,0 +1,56 @@ +--- +title: Sweep properties +sidebarTitle: Properties +page_kind: class-properties +parent_slug: sweep +kind: class +namespace: wandb.apis.public.sweeps +--- + +## Class wandb.apis.public.Sweep + +## property config + +The sweep configuration used for the sweep. + +## property entity + +The entity associated with the sweep. + +## property expected_run_count + +Return the number of expected runs in the sweep or None for infinite runs. + +## property name + +The name of the sweep. + +Returns the first name that exists in the following priority order: + +1. User-edited display name +2. Name configured at creation time +3. Sweep ID + +## property order + +Return the order key for the sweep. + +## property path + +Returns the path of the project. + +The path is a list containing the entity, project name, and sweep ID. + +## property url + +The URL of the sweep. + +The sweep URL is generated from the entity, project, the term +"sweeps", and the sweep ID.run_id. For +SaaS users, it takes the form +of `https://wandb.ai/entity/project/sweeps/sweeps_ID`. + +## property username + +Deprecated. Use `Sweep.entity` instead. + diff --git a/models/ref/python/public-api/sweeps.mdx b/models/ref/python/public-api/sweeps.mdx index 9365c9f0b9..89af53a839 100644 --- a/models/ref/python/public-api/sweeps.mdx +++ b/models/ref/python/public-api/sweeps.mdx @@ -7,11 +7,18 @@ namespace: wandb.apis.public.sweeps import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + + + + +## Class wandb.apis.public.Sweeps + + + +A lazy iterator over a collection of `Sweep` objects. -## class wandb.apis.public.Sweeps ```python service_api: 'ServiceApi', entity: 'str', @@ -20,20 +27,27 @@ per_page: 'int' = 50, filters: 'dict[str, Any] | None' = None ``` +## Args + +The service API used to query W&B. + -A lazy iterator over a collection of `Sweep` objects. - - + +The entity which owns the sweeps. + -## Args + +The project which contains the sweeps. + -- `service_api`: The service API used to query W&B. -- `entity`: The entity which owns the sweeps. -- `project`: The project which contains the sweeps. -- `per_page`: The number of sweeps to fetch per request to the API. -- `filters`: (dict) queries for specific sweeps using the runs filters, See wandb/apis/public/api.py:runs for more details. + +The number of sweeps to fetch per request to the API. + + +(dict) queries for specific sweeps using the runs filters, See wandb/apis/public/api.py:runs for more details. + @@ -52,33 +66,3 @@ for sweep in sweeps: print("----------") ``` - - -## Methods - -### method Paginator.__next__() - -```python -self -``` - -Return the next item from the iterator. When exhausted, raise StopIteration - - - - - -### method Paginator.update_variables() - -```python -self -``` - -Update the query variables for the next page fetch. - - - - - - - diff --git a/models/ref/python/public-api/sweeps/sweeps-methods.mdx b/models/ref/python/public-api/sweeps/sweeps-methods.mdx new file mode 100644 index 0000000000..aeecd7506a --- /dev/null +++ b/models/ref/python/public-api/sweeps/sweeps-methods.mdx @@ -0,0 +1,27 @@ +--- +title: Sweeps methods +sidebarTitle: Methods +page_kind: class-methods +parent_slug: sweeps +kind: class +namespace: wandb.apis.public.sweeps +--- + +## Class wandb.apis.public.Sweeps + +## method Paginator.__next__() + +Return the next item from the iterator. When exhausted, raise StopIteration + +```python +self +``` + +## method Paginator.update_variables() + +Update the query variables for the next page fetch. + +```python +self +``` + diff --git a/models/ref/python/public-api/team.mdx b/models/ref/python/public-api/team.mdx index ab50087ef7..6b01feb1e0 100644 --- a/models/ref/python/public-api/team.mdx +++ b/models/ref/python/public-api/team.mdx @@ -7,16 +7,11 @@ namespace: wandb.apis.public.teams import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.apis.public.Team -```python -(service_api: 'ServiceApi', -name: 'str', -attrs: 'Mapping[str, Any] | None' = None) -``` +## Class wandb.apis.public.Team @@ -28,12 +23,25 @@ to handle team attributes. +```python +(service_api: 'ServiceApi', +name: 'str', +attrs: 'Mapping[str, Any] | None' = None) +``` + ## Args -- `service_api`: The service API instance to use for querying W&B. -- `name`: The name of the team -- `attrs`: Optional dictionary of team attributes + +The service API instance to use for querying W&B. + + + +The name of the team + + +Optional dictionary of team attributes + @@ -59,62 +67,3 @@ team = api.create_team("my-team") team.create_service_account("CI service account") ``` - - -## Methods - -### method Team.create() - -```python -api: 'Api', -team: 'str', -admin_username: 'str | None' = None -``` - -Create a new team. - -##### Arguments - -- `api`: (`Api`) The api instance to use -- `team`: (str) The name of the team -- `admin_username`: (str) optional username of the admin user of the team, defaults to the current user. - - - - -### method Team.create_service_account() - -```python -self, -description: 'str' -``` - -Create a service account for the team. - -##### Arguments - -- `description`: (str) A description for this service account - - - - -### method Team.invite() - -```python -self, -username_or_email: 'str', -admin: 'bool' = False -``` - -Invite a user to a team. - -##### Arguments - -- `username_or_email`: (str) The username or email address of the user you want to invite. -- `admin`: (bool) Whether to make this user a team admin. Defaults to `False`. - - - - - - diff --git a/models/ref/python/public-api/team/team-methods.mdx b/models/ref/python/public-api/team/team-methods.mdx new file mode 100644 index 0000000000..9a51a7c5db --- /dev/null +++ b/models/ref/python/public-api/team/team-methods.mdx @@ -0,0 +1,82 @@ +--- +title: Team methods +sidebarTitle: Methods +page_kind: class-methods +parent_slug: team +kind: class +namespace: wandb.apis.public.teams +--- + +## Class wandb.apis.public.Team + +## method Team.create() + +Create a new team. + +```python +api: 'Api', +team: 'str', +admin_username: 'str | None' = None +``` + +##### Arguments + + +(`Api`) The api instance to use + + + +(str) The name of the team + + + +(str) optional username of the admin user of the team, defaults to the current user. + + +##### Returns + +A `Team` object + +## method Team.create_service_account() + +Create a service account for the team. + +```python +self, +description: 'str' +``` + +##### Arguments + + +(str) A description for this service account + + +##### Returns + +The service account `Member` object, or None on failure + +## method Team.invite() + +Invite a user to a team. + +```python +self, +username_or_email: 'str', +admin: 'bool' = False +``` + +##### Arguments + + +(str) The username or email address of the user you want to invite. + + + +(bool) Whether to make this user a team admin. Defaults to `False`. + + +##### Returns + +`True` on success, `False` if user was already invited or didn't exist. + diff --git a/models/ref/python/public-api/user.mdx b/models/ref/python/public-api/user.mdx index 3589995287..8231f9dead 100644 --- a/models/ref/python/public-api/user.mdx +++ b/models/ref/python/public-api/user.mdx @@ -7,12 +7,11 @@ namespace: wandb.apis.public.users import { GitHubLink } from '/snippets/_includes/github-source-link.mdx'; - + -## class wandb.apis.public.User - +## Class wandb.apis.public.User @@ -30,89 +29,5 @@ user. -## Properties - -### property api_keys - -Names of the user's API keys. - -This property returns the names of the the API keys, *not* the secret -associated with the key. The name of the key cannot be used as an API -key. - -The list is empty if the user has no API keys or if API keys have not -been loaded. - -### property teams - -Names of the user's teams. - -This is an empty list if the user has no team memberships or if teams -data was not loaded. - -### property user_api - -A `wandb.Api` instance using the user's credentials. - - - -## Methods - -### method User.create() - -```python -api: 'Api', -email: 'str', -admin: 'bool | None' = False -``` - -Create a new user. - -This is an internal method. Use the `create_user()` method of -`wandb.Api` instead. - -##### Arguments - -- `api`: The API instance to use to create the user. -- `email`: The email for the user. -- `admin`: Whether this user should be a global instance admin. - - - - -### method User.delete_api_key() - -```python -self, -api_key: 'str' -``` - -Delete a user's API key. - -Only the owner of the key or an admin can delete it. - -##### Arguments - -- `api_key`: The name of the API key to delete. Use one of the names returned by the `api_keys` property. - - - - -### method User.generate_api_key() - -```python -self, -description: 'str | None' = None -``` - -Generate a new API key. - -##### Arguments - -- `description`: A description for the new API key. This can be used to identify the purpose of the API key. - - - - diff --git a/models/ref/python/public-api/user/user-methods.mdx b/models/ref/python/public-api/user/user-methods.mdx new file mode 100644 index 0000000000..4295add7ad --- /dev/null +++ b/models/ref/python/public-api/user/user-methods.mdx @@ -0,0 +1,82 @@ +--- +title: User methods +sidebarTitle: Methods +page_kind: class-methods +parent_slug: user +kind: class +namespace: wandb.apis.public.users +--- + +## Class wandb.apis.public.User + +## method User.create() + +Create a new user. + +This is an internal method. Use the `create_user()` method of +`wandb.Api` instead. + +```python +api: 'Api', +email: 'str', +admin: 'bool | None' = False +``` + +##### Arguments + + +The API instance to use to create the user. + + + +The email for the user. + + + +Whether this user should be a global instance admin. + + +##### Returns + +A `User` object. + +## method User.delete_api_key() + +Delete a user's API key. + +Only the owner of the key or an admin can delete it. + +```python +self, +api_key: 'str' +``` + +##### Arguments + + +The name of the API key to delete. Use one of the names returned by the `api_keys` property. + + +##### Returns + +True on success, false on failure. + +## method User.generate_api_key() + +Generate a new API key. + +```python +self, +description: 'str | None' = None +``` + +##### Arguments + + +A description for the new API key. This can be used to identify the purpose of the API key. + + +##### Returns + +The generated API key (the full secret, not just the name), or None on failure. + diff --git a/models/ref/python/public-api/user/user-properties.mdx b/models/ref/python/public-api/user/user-properties.mdx new file mode 100644 index 0000000000..01e61c4c0e --- /dev/null +++ b/models/ref/python/public-api/user/user-properties.mdx @@ -0,0 +1,33 @@ +--- +title: User properties +sidebarTitle: Properties +page_kind: class-properties +parent_slug: user +kind: class +namespace: wandb.apis.public.users +--- + +## Class wandb.apis.public.User + +## property api_keys + +Names of the user's API keys. + +This property returns the names of the the API keys, *not* the secret +associated with the key. The name of the key cannot be used as an API +key. + +The list is empty if the user has no API keys or if API keys have not +been loaded. + +## property teams + +Names of the user's teams. + +This is an empty list if the user has no team memberships or if teams +data was not loaded. + +## property user_api + +A `wandb.Api` instance using the user's credentials. + diff --git a/snippets/_includes/github-source-link.mdx b/snippets/_includes/github-source-link.mdx index 866aaec570..21eea76ad0 100644 --- a/snippets/_includes/github-source-link.mdx +++ b/snippets/_includes/github-source-link.mdx @@ -1,10 +1,14 @@ -export const GitHubLink = ({ url }) => ( +export const GitHubLink = ({ url, compact = false }) => ( + {compact ? ( + "View source" + ) : ( + <> ( GitHub source + + )} -); +); \ No newline at end of file