Interface IDownloadable
- Namespace
- AiDotNet.Interfaces
- Assembly
- AiDotNet.dll
Defines capability to automatically download and cache datasets.
public interface IDownloadable
Remarks
Data loaders that implement this interface can fetch datasets from remote sources and cache them locally, making it easy to use standard benchmark datasets without manual setup.
For Beginners: Many standard datasets (MNIST, CIFAR, Cora, etc.) are available online. Instead of manually downloading and extracting files, the data loader can do it for you automatically and remember where the files are stored.
Properties
CachePath
Gets the local path where the dataset is cached.
string CachePath { get; }
Property Value
DownloadUrls
Gets the URLs where the dataset can be downloaded from.
IReadOnlyList<string> DownloadUrls { get; }
Property Value
IsDownloaded
Gets whether the dataset has been downloaded and is available locally.
bool IsDownloaded { get; }
Property Value
Methods
ClearCache()
Deletes the locally cached dataset files.
void ClearCache()
Remarks
Use this to free disk space or force a fresh download next time.
DownloadAsync(bool, IProgress<double>?, CancellationToken)
Downloads the dataset asynchronously if not already cached.
Task DownloadAsync(bool forceRedownload = false, IProgress<double>? progress = null, CancellationToken cancellationToken = default)
Parameters
forceRedownloadboolIf true, redownloads even if already cached.
progressIProgress<double>Optional progress reporter (0.0 to 1.0).
cancellationTokenCancellationTokenToken to cancel the download.
Returns
- Task
A task that completes when download is finished.
Remarks
For Beginners: This method: 1. Checks if the data already exists locally 2. If not (or forceRedownload is true), downloads from the internet 3. Extracts and prepares the files 4. Reports progress so you can show a progress bar
Example usage:
await loader.DownloadAsync(progress: new Progress<double>(p =>
Console.WriteLine($"Download: {p:P0}")));