| title |
|---|
API Documentation |
class RetryingClient(object) | __init__(client) | @property
| app_url() | @retriable(
| retry_timedelta=RETRY_TIMEDELTA,
| check_retry_fn=util.no_retry_auth,
| retryable_exceptions=(RetryError, requests.RequestException),
| )
| execute(*args, **kwargs)class Api(object)Used for querying the wandb server.
Examples:
Most common way to initialize
wandb.Api()
Arguments:
overridesdict - You can setbase_urlif you are using a wandb server other than https://api.wandb.ai. You can also set defaults forentity,project, andrun.
| __init__(overrides={}) | create_run(**kwargs) | @property
| client() | @property
| user_agent() | @property
| api_key() | @property
| default_entity() | flush()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.
| projects(entity=None, per_page=200)Get projects for a given entity.
Arguments:
entitystr - Name of the entity requested. If None will fallback to default entity passed toApi. If no default entity, will raise aValueError.per_pageint - Sets the page size for query pagination. None will use the default size. Usually there is no reason to change this.
Returns:
A Projects object which is an iterable collection of Project objects.
| reports(path="", name=None, per_page=50)Get reports for a given project path.
WARNING: This api is in beta and will likely change in a future release
Arguments:
pathstr - path to project the report resides in, should be in the form: "entity/project"namestr - optional name of the report requested.per_pageint - Sets the page size for query pagination. None will use the default size. Usually there is no reason to change this.
Returns:
A Reports object which is an iterable collection of BetaReport objects.
| runs(path="", filters={}, order="-created_at", per_page=50)Return a set of runs from a project that match the filters provided.
You can filter by config.*, summary.*, state, entity, createdAt, etc.
Examples:
Find runs in my_project config.experiment_name has been set to "foo"
api.runs(path="my_entity/my_project", {"config.experiment_name": "foo"})
Find runs in my_project config.experiment_name has been set to "foo" or "bar"
api.runs(path="my_entity/my_project",
- `{"$or"` - [{"config.experiment_name": "foo"}, {"config.experiment_name": "bar"}]})
Find runs in my_project sorted by ascending loss
api.runs(path="my_entity/my_project", {"order": "+summary_metrics.loss"})
Arguments:
pathstr - path to project, should be in the form: "entity/project"filtersdict - 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/queryorderstr - Order can becreated_at,heartbeat_at,config.*.value, orsummary_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:
A Runs object, which is an iterable collection of Run objects.
| @normalize_exceptions
| run(path="")Returns a single run by parsing path in the form entity/project/run_id.
Arguments:
pathstr - 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.
| @normalize_exceptions
| sweep(path="")Returns a sweep by parsing path in the form entity/project/sweep_id.
Arguments:
pathstr, 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:
A Sweep object.
| @normalize_exceptions
| artifact_types(project=None) | @normalize_exceptions
| artifact_type(type_name, project=None) | @normalize_exceptions
| artifact_versions(type_name, name, per_page=50) | @normalize_exceptions
| artifact(name, type=None)Returns a single artifact by parsing path in the form entity/project/run_id.
Arguments:
namestr - An artifact name. May be prefixed with entity/project. Valid names can be in the following forms: name:version name:alias digesttypestr, optional - The type of artifact to fetch.
Returns:
A Artifact object.
| artifact_from_id(id)class Attrs(object) | __init__(attrs) | snake_to_camel(string) | __getattr__(name)class Paginator(object) | __init__(client, variables, per_page=None) | __iter__() | __len__() | @property
| length() | @property
| more() | @property
| cursor() | convert_objects() | update_variables() | __getitem__(index) | __next__()class User(Attrs) | init(attrs)class Projects(Paginator)An iterable collection of Project objects.
| __init__(client, entity, per_page=50) | @property
| length() | @property
| more() | @property
| cursor() | convert_objects() | __repr__()class Project(Attrs)A project is a namespace for runs
| __init__(client, entity, project, attrs) | @property
| path() | __repr__() | @normalize_exceptions
| artifacts_types(per_page=50)class Runs(Paginator)An iterable collection of runs associated with a project and optional filter.
This is generally used indirectly via the Api.runs method
| __init__(client, entity, project, filters={}, order=None, per_page=50) | @property
| length() | @property
| more() | @property
| cursor() | convert_objects() | __repr__()class Run(Attrs)A single run associated with an entity and project.
Attributes:
tags[str] - a list of tags associated with the runurlstr - the url of this runidstr - unique identifier for the run (defaults to eight characters)namestr - the name of the runstatestr - one of: running, finished, crashed, abortedconfigdict - a dict of hyperparameters associated with the runcreated_atstr - ISO timestamp when the run was startedsystem_metricsdict - the latest system metrics recorded for the runsummarydict - A mutable dict-like property that holds the current summary. Calling update will persist any changes.projectstr - the project associated with the runentitystr - the name of the entity associated with the runuserstr - the name of the user who created the runpathstr - Unique identifier [entity]/[project]/[run_id]notesstr - Notes about the runread_onlyboolean - Whether the run is editablehistory_keysstr - Keys of the history metrics that have been logged withwandb.log({key: value})
| __init__(client, entity, project, run_id, attrs={})Run is always initialized by calling api.runs() where api is an instance of wandb.Api
| @property
| entity() | @property
| username() | @property
| storage_id() | @property
| id() | @id.setter
| id(new_id) | @property
| name() | @name.setter
| name(new_name) | @classmethod
| create(cls, api, run_id=None, project=None, entity=None)Create a run for the given project
| load(force=False) | @normalize_exceptions
| update()Persists changes to the run object to the wandb backend.
| save() | @property
| json_config() | @normalize_exceptions
| files(names=[], per_page=50)Arguments:
nameslist - names of the requested files, if empty returns all filesper_pageint - number of results per page
Returns:
A Files object, which is an iterator over File obejcts.
| @normalize_exceptions
| file(name)Arguments:
namestr - name of requested file.
Returns:
A File matching the name argument.
| @normalize_exceptions
| upload_file(path, root=".")Arguments:
pathstr - name of file to upload.rootstr - the root path to save the file relative to. i.e. 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 "../"
Returns:
A File matching the name argument.
| @normalize_exceptions
| history(samples=500, keys=None, x_axis="_step", pandas=True, stream="default")Returns sampled history metrics for a run. This is simpler and faster if you are ok with the history records being sampled.
Arguments:
samplesint, optional - The number of samples to returnpandasbool, optional - Return a pandas dataframekeyslist, optional - Only return metrics for specific keysx_axisstr, optional - Use this metric as the xAxis defaults to _stepstreamstr, optional - "default" for metrics, "system" for machine metrics
Returns:
If pandas=True returns a pandas.DataFrame of history metrics.
If pandas=False returns a list of dicts of history metrics.
| @normalize_exceptions
| scan_history(keys=None, page_size=1000, min_step=None, max_step=None)Returns an iterable collection of all history records for a run.
Example:
Export all the loss values for an example run
run = api.run("l2k2/examples-numpy-boston/i0wt6xua")
history = run.scan_history(keys=["Loss"])
losses = [row["Loss"] for row in history]Arguments:
keys[str], optional - only fetch these keys, and only fetch rows that have all of keys defined.page_sizeint, optional - size of pages to fetch from the api
Returns:
An iterable collection over history records (dict).
| @normalize_exceptions
| logged_artifacts(per_page=100) | @normalize_exceptions
| used_artifacts(per_page=100) | @normalize_exceptions
| use_artifact(artifact)Declare an artifact as an input to a run.
Arguments:
artifactArtifact- An artifact returned fromwandb.Api().artifact(name)
Returns:
A Artifact object.
| @normalize_exceptions
| log_artifact(artifact, aliases=None)Declare an artifact as output of a run.
Arguments:
artifactArtifact- An artifact returned fromwandb.Api().artifact(name)aliaseslist, optional - Aliases to apply to this artifact
Returns:
A Artifact object.
| @property
| summary() | @property
| path() | @property
| url() | @property
| lastHistoryStep() | __repr__()class Sweep(Attrs)A set of runs associated with a sweep Instantiate with: api.sweep(sweep_path)
Attributes:
runsRuns- list of runsidstr - sweep idprojectstr - name of projectconfigstr - dictionary of sweep configuration
| __init__(client, entity, project, sweep_id, attrs={}) | @property
| entity() | @property
| username() | @property
| config() | load(force=False) | @property
| order() | best_run(order=None)Returns the best run sorted by the metric defined in config or the order passed in
| @property
| path() | @property
| url() | @classmethod
| get(cls, client, entity=None, project=None, sid=None, withRuns=True, order=None, query=None, **kwargs)Execute a query against the cloud backend
| __repr__()class Files(Paginator)Files is an iterable collection of File objects.
| __init__(client, run, names=[], per_page=50, upload=False) | @property
| length() | @property
| more() | @property
| cursor() | update_variables() | convert_objects() | __repr__()class File(object)File is a class associated with a file saved by wandb.
Attributes:
namestring - filenameurlstring - path to filemd5string - md5 of filemimetypestring - mimetype of fileupdated_atstring - timestamp of last updatesizeint - size of file in bytes
| __init__(client, attrs) | @property
| name() | @property
| url() | @property
| md5() | @property
| digest() | @property
| mimetype() | @property
| updated_at() | @property
| size() | @normalize_exceptions
| @retriable(
| retry_timedelta=RETRY_TIMEDELTA,
| check_retry_fn=util.no_retry_auth,
| retryable_exceptions=(RetryError, requests.RequestException),
| )
| download(root=".", replace=False)Downloads a file previously saved by a run from the wandb server.
Arguments:
replaceboolean - IfTrue, download will overwrite a local file if it exists. Defaults toFalse.rootstr - Local directory to save the file. Defaults to ".".
Raises:
ValueError if file already exists and replace=False
| __repr__()class Reports(Paginator)Reports is an iterable collection of BetaReport objects.
| __init__(client, project, name=None, entity=None, per_page=50) | @property
| length() | @property
| more() | @property
| cursor() | update_variables() | convert_objects() | __repr__()class QueryGenerator(object)QueryGenerator is a helper object to write filters for runs
| __init__() | @classmethod
| format_order_key(cls, key) | key_to_server_path(key) | filter_to_mongo(filter)class BetaReport(Attrs)BetaReport is a class associated with reports created in wandb.
WARNING: this API will likely change in a future release
Attributes:
namestring - report namedescriptionstring - report descirpiton;userUser - the user that created the reportspecdict - the spec off the report;updated_atstring - timestamp of last update
| __init__(client, attrs, entity=None, project=None) | @property
| sections() | runs(section, per_page=50, only_selected=True) | @property
| updated_at()class HistoryScan(object) | __init__(client, run, min_step, max_step, page_size=1000) | __iter__() | __next__()class SampledHistoryScan(object) | __init__(client, run, keys, min_step, max_step, page_size=1000) | __iter__() | __next__()class ProjectArtifactTypes(Paginator) | __init__(client, entity, project, name=None, per_page=50) | @property
| length() | @property
| more() | @property
| cursor() | update_variables() | convert_objects()class ProjectArtifactCollections(Paginator) | __init__(client, entity, project, type_name, per_page=50) | @property
| length() | @property
| more() | @property
| cursor() | update_variables() | convert_objects()class RunArtifacts(Paginator) | __init__(client, run, mode="logged", per_page=50) | @property
| length() | @property
| more() | @property
| cursor() | update_variables() | convert_objects()class ArtifactType(object) | __init__(client, entity, project, type_name, attrs=None) | load() | @property
| id() | @property
| name() | @normalize_exceptions
| collections(per_page=50)Artifact collections
| collection(name) | __repr__()class ArtifactCollection(object) | __init__(client, entity, project, name, type, attrs=None) | @property
| id() | @normalize_exceptions
| versions(per_page=50)Artifact versions
| __repr__()class Artifact(object) | @classmethod
| from_id(cls, client, id) | __init__(client, entity, project, name, attrs=None) | @property
| id() | @property
| metadata() | @metadata.setter
| metadata(metadata) | @property
| manifest() | @property
| digest() | @property
| state() | @property
| size() | @property
| created_at() | @property
| updated_at() | @property
| description() | @description.setter
| description(desc) | @property
| type() | @property
| name() | @property
| aliases() | @aliases.setter
| aliases(aliases) | delete()Delete artifact and it's files.
| new_file(name, mode=None) | add_file(path, name=None) | add_dir(path, name=None) | add_reference(path, name=None) | get_path(name) | get(name)Returns the wandb.Media resource stored in the artifact. Media can be stored in the artifact via Artifact#add(obj: wandbMedia, name: str)`
Arguments:
namestr - name of resource.
Returns:
A wandb.Media which has been stored at name
| download(root=None)Download the artifact to dir specified by the
Arguments:
rootstr, optional - directory to download artifact to. If None artifact will be downloaded to './artifacts/<self.name>/'
Returns:
The path to the downloaded contents.
| file(root=None)Download a single file artifact to dir specified by the
Arguments:
rootstr, optional - directory to download artifact to. If None artifact will be downloaded to './artifacts/<self.name>/'
Returns:
The full path of the downloaded file
| @normalize_exceptions
| save()Persists artifact changes to the wandb backend.
| verify(root=None)Verify an artifact by checksumming its downloaded contents.
Raises a ValueError if the verification fails. Does not verify downloaded reference files.
Arguments:
rootstr, optional - directory to download artifact to. If None artifact will be downloaded to './artifacts/<self.name>/'
| __repr__()class ArtifactVersions(Paginator)An iterable collection of artifact versions associated with a project and optional filter.
This is generally used indirectly via the Api.artifact_versions method
| __init__(client, entity, project, collection_name, type, filters={}, order=None, per_page=50) | @property
| length() | @property
| more() | @property
| cursor() | convert_objects()class ArtifactFiles(Paginator) | __init__(client, artifact, names=None, per_page=50) | @property
| length() | @property
| more() | @property
| cursor() | update_variables() | convert_objects() | __repr__()