File
2 minute read
Training and fine-tuning models is done elsewhere in the W&B Python SDK. Use the Public API for querying and managing data after it has been logged to W&B.
class File
File saved to W&B.
Represents a single file stored in W&B. Includes access to file metadata. Files are associated with a specific run and can include text files, model weights, datasets, visualizations, and other artifacts. You can download the file, delete the file, and access file properties.
Specify one or more attributes in a dictionary to fine a specific file logged to a specific run. You can search using the following keys:
- id (str): The ID of the run that contains the file
- name (str): Name of the file
- url (str): path to file
- direct_url (str): path to file in the bucket
- sizeBytes (int): size of file in bytes
- md5 (str): md5 of file
- mimetype (str): mimetype of file
- updated_at (str): timestamp of last update
- path_uri (str): path to file in the bucket, currently only available for S3 objects and reference files
Args:
client
: The run object that contains the fileattrs
(dict): A dictionary of attributes that define the filerun
: The run object that contains the file
property File.path_uri
Returns the URI path to the file in the storage bucket.
Returns:
str
: The S3 URI (e.g., ‘s3://bucket/path/to/file’) if the file is stored in S3, the direct URL if it’s a reference file, or an empty string if unavailable.
Returns:
str
: The path_uri property value.
property File.size
Returns the size of the file in bytes.
method File.delete
delete()
Delete the file from the W&B server.
method File.download
download(
root: 'str' = '.',
replace: 'bool' = False,
exist_ok: 'bool' = False,
api: 'Api | None' = None
) → io.TextIOWrapper
Downloads a file previously saved by a run from the wandb server.
Args:
root
: Local directory to save the file. Defaults to the current working directory (".").replace
: IfTrue
, download will overwrite a local file if it exists. Defaults toFalse
.exist_ok
: IfTrue
, will not raise ValueError if file already exists and will not re-download unless replace=True. Defaults toFalse
.api
: If specified, theApi
instance used to download the file.
Raises:
ValueError
if file already exists, replace=False
and exist_ok=False
.
Feedback
Was this page helpful?
Glad to hear it! If you have more to say, please let us know.
Sorry to hear that. Please tell us how we can improve.