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.

Example:

from wandb.apis.public.files import Files
from wandb.apis.public.api import Api

# Example run object
run = Api().run("entity/project/run-id")

# Create a Files object to iterate over files in the run
files = Files(api.client, run)

# Iterate over files
for file in files:
    print(file.name)
    print(file.url)
    print(file.size)

    # Download the file
    file.download(root="download_directory", replace=True)
Attributes
cursor Returns the cursor position for pagination of file results.
more Returns whether there are more files to fetch.

Methods

convert_objects

View source

convert_objects()

Converts GraphQL edges to File objects.

next

View source

next() -> T

Return the next item from the iterator. When exhausted, raise StopIteration

update_variables

View source

update_variables()

Updates the GraphQL query variables for pagination.

__getitem__

View source

__getitem__(
    index: (int | slice)
) -> (T | list[T])

__iter__

View source

__iter__() -> Iterator[T]

__len__

View source

__len__() -> int
Class Variables
QUERY None