Documentation
Search…
wandb.apis.public.Api
Used for querying the wandb server.
1
Api(
2
overrides={},
3
timeout: Optional[int] = None
4
)
Copied!

Examples:

Most common way to initialize
1
>>> wandb.Api()
Copied!
Arguments
Text
overrides
(dict) You can set base_url if you are using a wandb server other than https://api.wandb.ai. You can also set defaults for entity, project, and run.

Methods

artifact

1
artifact(
2
name, type=None
3
)
Copied!
Returns a single artifact by parsing path in the form entity/project/run_id.
Arguments
Text
name
(str) An artifact name. May be prefixed with entity/project. Valid names can be in the following forms: name:version name:alias digest
type
(str, optional) The type of artifact to fetch.
Returns
Text
A Artifact object.

artifact_type

1
artifact_type(
2
type_name, project=None
3
)
Copied!

artifact_types

1
artifact_types(
2
project=None
3
)
Copied!

artifact_versions

1
artifact_versions(
2
type_name, name, per_page=50
3
)
Copied!

create_run

1
create_run(
2
**kwargs
3
)
Copied!
Create a new run

create_team

1
create_team(
2
team, admin_username=None
3
)
Copied!
Creates a new team
Arguments
Text
team
(str) The name of the team
admin_username
(str) optional username of the admin user of the team, defaults to the current user.
Returns
Text
A Team object

flush

1
flush()
Copied!
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.

from_path

1
from_path(
2
path
3
)
Copied!
Return a run, sweep, project or report from a path

Examples:

1
project = api.from_path("my_project")
2
team_project = api.from_path("my_team/my_project")
3
run = api.from_path("my_team/my_project/runs/id")
4
sweep = api.from_path("my_team/my_project/sweeps/id")
5
report = api.from_path("my_team/my_project/reports/My-Report-Vm11dsdf")
Copied!
Arguments
Text
path
(str) The path to the project, run, sweep or report
Returns
Text
A Project, Run, Sweep, or BetaReport instance.
Raises
Text
wandb.Error if path is invalid or the object doesn't exist

project

1
project(
2
name, entity=None
3
)
Copied!

projects

1
projects(
2
entity=None, per_page=200
3
)
Copied!
Get projects for a given entity.
Arguments
Text
entity
(str) Name of the entity requested. If None will fallback to default entity passed to Api. If no default entity, will raise a ValueError.
per_page
(int) Sets the page size for query pagination. None will use the default size. Usually there is no reason to change this.
Returns
Text
A Projects object which is an iterable collection of Project objects.

queued_job

1
queued_job(
2
path=""
3
)
Copied!
Returns a single queued run by parsing the path in the form entity/project/queue_id/run_queue_item_id

reports

1
reports(
2
path="", name=None, per_page=50
3
)
Copied!
Get reports for a given project path.
WARNING: This api is in beta and will likely change in a future release
Arguments
Text
path
(str) path to project the report resides in, should be in the form: "entity/project"
name
(str) optional name of the report requested.
per_page
(int) Sets the page size for query pagination. None will use the default size. Usually there is no reason to change this.
Returns
Text
A Reports object which is an iterable collection of BetaReport objects.

run

1
run(
2
path=""
3
)
Copied!
Returns a single run by parsing path in the form entity/project/run_id.
Arguments
Text
path
(str) 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
Text
A Run object.

runs

1
runs(
2
path=None, filters=None, order="-created_at", per_page=50
3
)
Copied!
Return a set of runs from a project that match the filters provided.
You can filter by config.*, summary_metrics.*, tags, state, entity, createdAt, etc.

Examples:

Find runs in my_project where config.experiment_name has been set to "foo"
1
api.runs(path="my_entity/my_project", filters={"config.experiment_name": "foo"})
Copied!
Find runs in my_project where config.experiment_name has been set to "foo" or "bar"
1
api.runs(
2
path="my_entity/my_project",
3
filters={"$or": [{"config.experiment_name": "foo"}, {"config.experiment_name": "bar"}]}
4
)
Copied!
Find runs in my_project where config.experiment_name matches a regex (anchors are not supported)
1
api.runs(
2
path="my_entity/my_project",
3
filters={"config.experiment_name": {"$regex": "b.*"}}
4
)
Copied!
Find runs in my_project where the run name matches a regex (anchors are not supported)
1
api.runs(
2
path="my_entity/my_project",
3
filters={"display_name": {"$regex": "^foo.*"}}
4
)
Copied!
Find runs in my_project sorted by ascending loss
1
api.runs(path="my_entity/my_project", order="+summary_metrics.loss")
Copied!
Arguments
Text
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" You can compose operations to make more complicated queries, see Reference for the language is at https://docs.mongodb.com/manual/reference/operator/query
order
(str) Order can be created_at, heartbeat_at, config.*.value, or summary_metrics.*. If you prepend order with a + order is ascending. If you prepend order with a - order is descending (default). The default order is run.created_at from newest to oldest.
Returns
Text
A Runs object, which is an iterable collection of Run objects.

sweep

1
sweep(
2
path=""
3
)
Copied!
Returns a sweep by parsing path in the form entity/project/sweep_id.
Arguments
Text
path
(str, optional) 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
Text
A Sweep object.

sync_tensorboard

1
sync_tensorboard(
2
root_dir, run_id=None, project=None, entity=None
3
)
Copied!
Sync a local directory containing tfevent files to wandb

team

1
team(
2
team
3
)
Copied!

user

1
user(
2
username_or_email
3
)
Copied!
Return a user from a username or email address
Arguments
Text
username_or_email
(str) The username or email address of the user
Returns
Text
A User object or None if a user couldn't be found

users

1
users(
2
username_or_email
3
)
Copied!
Return all users from a partial username or email address query
Arguments
Text
username_or_email
(str) The prefix or suffix of the user you want to find
Returns
Text
An array of User objects
Class Variables
Text
USERS_QUERY
VIEWER_QUERY